dokkit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/CONTRIBUTORS +0 -0
  2. data/DONE +0 -0
  3. data/LICENSE +20 -0
  4. data/README +0 -0
  5. data/Rakefile +62 -0
  6. data/TODO +0 -0
  7. data/bin/dokkit +53 -0
  8. data/lib/dokkit/app.rb +305 -0
  9. data/lib/dokkit/builtin.rake +55 -0
  10. data/lib/dokkit/deplate/fmt/html-notemplate.rb +21 -0
  11. data/lib/dokkit/deplate/fmt/latex-notemplate.rb +22 -0
  12. data/lib/dokkit/dokkittasks.rb +69 -0
  13. data/lib/dokkit/filters/deplate.rb +37 -0
  14. data/lib/dokkit/filters.rb +26 -0
  15. data/lib/dokkit/page.rb +54 -0
  16. data/lib/dokkit/projects/invoice/README +49 -0
  17. data/lib/dokkit/projects/invoice/Rakefile +100 -0
  18. data/lib/dokkit/projects/invoice/doc/config/company.yaml +12 -0
  19. data/lib/dokkit/projects/invoice/doc/config/customer.yaml +4 -0
  20. data/lib/dokkit/projects/invoice/doc/layouts/invoice.dpltex +90 -0
  21. data/lib/dokkit/projects/invoice/doc/pages/COMMON.rb +12 -0
  22. data/lib/dokkit/projects/invoice/doc/pages/invoice.rb +5 -0
  23. data/lib/dokkit/projects/invoice/doc/pages/invoice.yamltex +16 -0
  24. data/lib/dokkit/projects/invoice/doc/res/tex/deplate.sty +46 -0
  25. data/lib/dokkit/projects/invoice/doc/res/tex/images/logo.eps +209 -0
  26. data/lib/dokkit/projects/invoice/doc/res/tex/include/deplate.sty +46 -0
  27. data/lib/dokkit/projects/invoice/doc/res/tex/include/layout.inc +24 -0
  28. data/lib/dokkit/projects/invoice/doc/res/tex/include/macro.inc +67 -0
  29. data/lib/dokkit/projects/invoice/doc/res/tex/include/packages.inc +51 -0
  30. data/lib/dokkit/projects/invoice/lib/invoice.rb +104 -0
  31. data/lib/dokkit/projects/tech_report/README +49 -0
  32. data/lib/dokkit/projects/tech_report/Rakefile +102 -0
  33. data/lib/dokkit/projects/tech_report/doc/config/company.yaml +13 -0
  34. data/lib/dokkit/projects/tech_report/doc/config/tech_report.yaml +3 -0
  35. data/lib/dokkit/projects/tech_report/doc/layouts/report.dpltex +40 -0
  36. data/lib/dokkit/projects/tech_report/doc/pages/COMMON.rb +12 -0
  37. data/lib/dokkit/projects/tech_report/doc/pages/report.dpltex +37 -0
  38. data/lib/dokkit/projects/tech_report/doc/pages/report.inc +2 -0
  39. data/lib/dokkit/projects/tech_report/doc/pages/report.rb +3 -0
  40. data/lib/dokkit/projects/tech_report/doc/res/attachments/attachment_1 +0 -0
  41. data/lib/dokkit/projects/tech_report/doc/res/attachments/attachment_2 +0 -0
  42. data/lib/dokkit/projects/tech_report/doc/res/tex/images/logo.eps +311 -0
  43. data/lib/dokkit/projects/tech_report/doc/res/tex/include/deplate.sty +46 -0
  44. data/lib/dokkit/projects/tech_report/doc/res/tex/include/layout.inc +24 -0
  45. data/lib/dokkit/projects/tech_report/doc/res/tex/include/macro.inc +67 -0
  46. data/lib/dokkit/projects/tech_report/doc/res/tex/include/packages.inc +48 -0
  47. data/lib/dokkit/projects/tech_report/doc/res/tex/report.bib +4 -0
  48. data/lib/dokkit/projects/tech_report/lib/tech_report.rb +17 -0
  49. data/lib/dokkit/projects/website/README +49 -0
  50. data/lib/dokkit/projects/website/Rakefile +81 -0
  51. data/lib/dokkit/projects/website/doc/layouts/normal.thtml +38 -0
  52. data/lib/dokkit/projects/website/doc/pages/COMMON.rb +9 -0
  53. data/lib/dokkit/projects/website/doc/pages/deplate.dplhtml +9 -0
  54. data/lib/dokkit/projects/website/doc/pages/index.rb +10 -0
  55. data/lib/dokkit/projects/website/doc/pages/index.thtml +12 -0
  56. data/lib/dokkit/projects/website/doc/res/images/rote-tiny.png +0 -0
  57. data/lib/dokkit/projects/website/html/deplate.html +21 -0
  58. data/lib/dokkit/projects/website/html/images/rote-tiny.png +0 -0
  59. data/lib/dokkit/projects/website/html/index.html +37 -0
  60. data/lib/dokkit.rb +71 -0
  61. data/tests/gem_tests.rb +4 -0
  62. data/tests/test_filters.rb +46 -0
  63. metadata +177 -0
data/CONTRIBUTORS ADDED
File without changes
data/DONE ADDED
File without changes
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c)2006 Andrea Fazzi (and contributors). All rights reserved.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,62 @@
1
+ # Standard Rakefile for custom Dokkit build
2
+ #
3
+ #
4
+
5
+ begin
6
+ require 'rubygems'
7
+ rescue LoadError
8
+ nil # optional
9
+ end
10
+
11
+ require 'rake'
12
+ require 'rake/clean'
13
+ require 'rake/testtask'
14
+ require 'rake/rdoctask'
15
+ require 'rake/gempackagetask'
16
+
17
+ CLOBBER.include('html')
18
+ CLOBBER.include('tex')
19
+
20
+ Rake::RDocTask.new do |rd|
21
+ rd.main = "README"
22
+ rd.rdoc_files.include("README", "lib/**/*.rb", "tests/*.rb")
23
+ rd.rdoc_dir = "apidoc"
24
+ rd.options.push('-d').push('-F')
25
+ end
26
+
27
+ desc "Run basic tests"
28
+ Rake::TestTask.new("test_units") { |t|
29
+ t.pattern = 'tests/ts_*.rb'
30
+ t.verbose = true
31
+ #t.warning = true
32
+ }
33
+
34
+ spec = Gem::Specification.new do |s|
35
+ s.platform = Gem::Platform::RUBY
36
+ s.summary = "Ruby Documentation ToolKit."
37
+ s.name = 'dokkit'
38
+ s.version = '0.1.0'
39
+
40
+ s.add_dependency('deplate', '>= 0.8')
41
+ s.add_dependency('rote', '>= 0.3.2.2')
42
+ s.add_dependency('rake')
43
+ s.add_dependency('syntax')
44
+
45
+ s.has_rdoc = true
46
+ s.test_file = 'tests/gem_tests.rb'
47
+
48
+ s.require_path = 'lib'
49
+ s.autorequire = 'dokkit'
50
+ s.bindir = 'bin'
51
+ s.executables << 'dokkit'
52
+ s.extra_rdoc_files << 'README'
53
+ s.files = FileList['lib/**/*', 'bin/*', '[A-Z]*', 'tests/*', 'tests/**/**'].exclude(/alca/).to_a
54
+ s.description = <<-EOF
55
+ Dokkit is a documentation toolkit based on Rote.
56
+ EOF
57
+ end
58
+
59
+ Rake::GemPackageTask.new(spec) do |pkg|
60
+ pkg.need_zip = true
61
+ pkg.need_tar = true
62
+ end
data/TODO ADDED
File without changes
data/bin/dokkit ADDED
@@ -0,0 +1,53 @@
1
+ #
2
+ # Commandline launcher for Dokkit, (c)2006 Andrea Fazzi (and contributors)
3
+ #
4
+ # Get set up with library paths, however we're installed.
5
+
6
+ def croak
7
+ puts "Cannot locate Dokkit libraries - Do you need to set $DOKKIT_LIB ?"
8
+ exit(1)
9
+ end
10
+
11
+ begin
12
+ require 'rubygems'
13
+ rescue LoadError
14
+ # just ignore, don't use gems
15
+ end
16
+
17
+ fail = false
18
+
19
+ dokkit_lib = nil
20
+
21
+ begin
22
+ require 'dokkit'
23
+ require 'dokkit/app'
24
+
25
+ # find this later
26
+ dokkit_lib = nil
27
+ rescue LoadError
28
+ unless fail || !(dokkit_lib = ENV['DOKKIT_LIB'])
29
+ $: << dokkit_lib
30
+ # at least we can know this now...
31
+ builtin = File.join(dokkit_lib,'dokkit/builtin.rake')
32
+ fail = true # next time.
33
+ retry
34
+ else
35
+ croak
36
+ end
37
+ end
38
+
39
+ # If we're loaded via RubyGems or some such we need to locate
40
+ # the builtin rakefile.
41
+ unless dokkit_lib
42
+ $:.each { |it|
43
+ if File.exists?(File.join(it,'dokkit/builtin.rake'))
44
+ dokkit_lib = it
45
+ break
46
+ end
47
+ }
48
+ end
49
+
50
+ croak unless dokkit_lib
51
+
52
+ Dokkit::Application.new(dokkit_lib).run
53
+
data/lib/dokkit/app.rb ADDED
@@ -0,0 +1,305 @@
1
+ # Dokkit application class
2
+ # (c)2006 Andrea Fazzi (and contributors)
3
+ #
4
+ # See 'dokkit.rb' or LICENSE for licence information.
5
+
6
+ require 'optparse'
7
+ require 'rake'
8
+
9
+ DEFAULT_PROJECT_MODEL = "tech_report"
10
+
11
+ module Rake
12
+
13
+ class Application
14
+
15
+ def do_option(opt, value)
16
+ case opt
17
+ when '--directory'
18
+ Dir.chdir( File.expand_path(value) )
19
+ options.directory = true
20
+ when '--dry-run'
21
+ verbose(true)
22
+ nowrite(true)
23
+ options.dryrun = true
24
+ options.trace = true
25
+ when '--help'
26
+ help
27
+ exit
28
+ when '--libdir'
29
+ $:.push(value)
30
+ when '--nosearch'
31
+ options.nosearch = true
32
+ when '--prereqs'
33
+ options.show_prereqs = true
34
+ when '--quiet'
35
+ verbose(false)
36
+ when '--rakefile'
37
+ RAKEFILES.clear
38
+ RAKEFILES << value
39
+ when '--rakelibdir'
40
+ options.rakelib = value.split(':')
41
+ when '--require'
42
+ begin
43
+ require value
44
+ rescue LoadError => ex
45
+ begin
46
+ rake_require value
47
+ rescue LoadError => ex2
48
+ raise ex
49
+ end
50
+ end
51
+ when '--silent'
52
+ verbose(false)
53
+ options.silent = true
54
+ when '--tasks'
55
+ options.show_tasks = true
56
+ options.show_task_pattern = Regexp.new(value || '.')
57
+ when '--trace'
58
+ options.trace = true
59
+ verbose(true)
60
+ when '--usage'
61
+ usage
62
+ exit
63
+ when '--verbose'
64
+ verbose(true)
65
+ when '--version'
66
+ puts "rake, version #{RAKEVERSION}"
67
+ exit
68
+ when '--classic-namespace'
69
+ require 'rake/classic_namespace'
70
+ options.classic_namespace = true
71
+ else
72
+ fail "Unknown option: #{opt}"
73
+ end
74
+ end
75
+
76
+ def handle_options
77
+ options.rakelib ||= 'rakelib'
78
+ options.each { |opt, value| do_option(opt, value) }
79
+ end
80
+
81
+ def display_tasks_and_comments
82
+ displayable_tasks = Rake::Task.tasks.select { |t|
83
+ t.comment && t.name =~ options.show_task_pattern
84
+ }
85
+ width = displayable_tasks.collect { |t|
86
+ t.name.length
87
+ }.max
88
+ displayable_tasks.each do |t|
89
+ printf "dokkit %-#{width}s # %s\n", t.name, t.comment
90
+ end
91
+ end
92
+
93
+ # Search for a Rakefile
94
+ def search_for_rakefile
95
+ initial_dir = here = Dir.pwd
96
+ while ! have_rakefile
97
+ Dir.chdir("..")
98
+ if Dir.pwd == here
99
+ Dir.chdir(initial_dir)
100
+ return false
101
+ end
102
+ here = Dir.pwd
103
+ end
104
+ return true
105
+ end
106
+
107
+ end
108
+
109
+ end
110
+
111
+ module Dokkit
112
+
113
+ # Command-line launcher for Dokkit.
114
+ class Application
115
+
116
+ attr_accessor :dokkit_lib
117
+ attr_accessor :debug
118
+ attr_accessor :tasks
119
+ attr_accessor :trace
120
+ attr_accessor :usage
121
+ attr_accessor :version
122
+ attr_accessor :rake
123
+ attr_accessor :rakefile
124
+ attr_accessor :rakeopts
125
+ attr_accessor :rake_env
126
+ attr_accessor :list_projects
127
+
128
+ @@project_dirs = nil
129
+
130
+ # Create a new Application instance, processing command-line arguments,
131
+ # optionally passing +self+ to the supplied block for further
132
+ # configuration.
133
+
134
+ def initialize(dokkit_lib) # :yield: self if block_given?
135
+ # init vars
136
+ @@project_dirs = ($:.collect { |dir| File.join(dir,"dokkit/projects")}).concat(Array["~/.dokkit/projects"])
137
+
138
+ @dokkit_lib = dokkit_lib
139
+ @debug = false
140
+ @tasks = false
141
+ @trace = false
142
+ @usage = false
143
+ @version = false
144
+ @list_projects = false
145
+ @directory = false
146
+ @rf = false
147
+ @rakefile = "#{dokkit_lib}/dokkit/builtin.rake"
148
+ raise "Missing builtin.rake (expected at '#{@rakefile}')!" unless File.exists?(@rakefile)
149
+
150
+ @rakeopts = ENV['RAKE_OPTS'] || ''
151
+ @rake_env = "PROJECT=#{@project}"
152
+
153
+ ENV['PROJECT'] = @project = DEFAULT_PROJECT_MODEL
154
+
155
+ @rake = Rake::Application.new
156
+
157
+ process_args
158
+
159
+ yield self if block_given?
160
+ end
161
+
162
+ # Gets the list of the directory to search into for project models
163
+ def Application.get_project_dirs
164
+ @@project_dirs
165
+ end
166
+
167
+ # Run the application with the current options.
168
+ def run
169
+
170
+ @rake.do_option("--libdir",dokkit_lib)
171
+
172
+ if @version
173
+ print "dokkit, version #{DOKKITVERSION}\n"
174
+
175
+ elsif @tasks
176
+ if @rake.search_for_rakefile
177
+ @rake.do_option("--rakelibdir","#{dokkit_lib}/dokkit/")
178
+ @rake.do_option("--tasks",nil)
179
+ @rake.run
180
+ else
181
+ @rake.do_option("--tasks",nil)
182
+ @rake.do_option("--rakefile","#{rakefile}")
183
+ @rake.run
184
+ end
185
+ elsif @list_projects
186
+ show_all_projects
187
+ elsif @usage
188
+ show_usage()
189
+ else
190
+ if @trace
191
+ @rake.do_option("--trace",nil)
192
+ elsif @debug
193
+ @rake.do_option("--verbose",nil)
194
+ elsif @rf
195
+ @rake.do_option("--rakefile",@rf)
196
+ elsif @directory
197
+ @rake.do_option("--directory",@directory)
198
+ elsif @project
199
+ ENV['PROJECT'] = @project
200
+ end
201
+
202
+ if @rake.search_for_rakefile
203
+ @rake.do_option("--rakelibdir","#{dokkit_lib}/dokkit/")
204
+ else
205
+ @rake.do_option("--rakefile","#{rakefile}")
206
+ end
207
+
208
+ @rake.run
209
+
210
+ end
211
+ end
212
+
213
+ private
214
+
215
+ # Process commandline
216
+ def process_args
217
+ GetoptLong.new(
218
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
219
+ [ "--tasks", "-T", GetoptLong::NO_ARGUMENT ],
220
+ [ "--trace", "-t", GetoptLong::NO_ARGUMENT ],
221
+ [ "--usage", "-u", GetoptLong::NO_ARGUMENT ],
222
+ [ "--project", "-P", GetoptLong::REQUIRED_ARGUMENT],
223
+ [ "--rakefile","-f", GetoptLong::REQUIRED_ARGUMENT],
224
+ [ "--directory","-D", GetoptLong::REQUIRED_ARGUMENT],
225
+ [ "--list", "-l", GetoptLong::NO_ARGUMENT ],
226
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
227
+ [ "--version", "-V", GetoptLong::NO_ARGUMENT ]
228
+ ).each { |opt,arg|
229
+ @debug = true if opt == '--verbose'
230
+ @trace = true if opt == '--trace'
231
+ @tasks = true if opt == '--tasks'
232
+ @project = arg if opt == '--project'
233
+ @rf = arg if opt == '--rakefile'
234
+ @directory = arg if opt == '--directory'
235
+ @list_projects = true if opt == '--list'
236
+ @usage = true if opt == '--usage' || opt == '--help'
237
+ @version = true if opt == '--version'
238
+ }
239
+ end
240
+
241
+ # Show all the projects present in the distro default dir $DOKKIT_LIB/dokkit/projects/
242
+ # and into the user dir $HOME/.dokkit/projects
243
+ def show_all_projects
244
+ puts "Searching in #{dokkit_lib}.."
245
+ puts "Available project models are:"
246
+ Dir["#{dokkit_lib}/dokkit/projects/**/Rakefile"].concat(Dir["#{File.expand_path("~/.dokkit/projects/**/Rakefile")}"]).each do |project|
247
+ puts File.dirname(project).scan(/projects\/\w+\/*\w+/).to_s.gsub!(/projects\//,"")
248
+ end
249
+ end
250
+
251
+ # Display help text
252
+ def show_usage
253
+ print <<-EOM
254
+ Usage: dokkit [options] [task1] .. [taskN]
255
+
256
+ Where [taskN] is a valid task or target name for the current project.
257
+ Dokkit generates targets for each page source, and also defines a number
258
+ of top-level tasks for various things. Use the '--tasks' option to get
259
+ a list of valid tasks.
260
+
261
+ Recognised options are:
262
+
263
+ --directory=DIR -D
264
+ Change to directory DIR before reading the rakefiles or doing anything else.
265
+
266
+ --rakefile=FILE -f
267
+ Use FILE as a Rakefile.
268
+
269
+ --list -l
270
+ Display the list of model projects available.
271
+
272
+ --help -h
273
+ Synonym for --usage
274
+
275
+ --project=PROJECT -P
276
+ Sets the model project to create. Use --list for the full list of available projects.
277
+
278
+ --tasks -T
279
+ Display a list of tasks in this project.
280
+
281
+ --trace -t
282
+ Enables trace-level output (debugging).
283
+
284
+ --usage -u
285
+ Display this help message and quit.
286
+
287
+ --verbose -v
288
+ Enable verbose output.
289
+
290
+ --version -V
291
+ Display Dokkit's version and quit
292
+
293
+ In addition to the standard doc_XXX tasks and those provided by any
294
+ local configuration, the following 'special' tasks are recognised:
295
+
296
+ create <project> Create a blank project from the built-in template using the #{DEFAULT_PROJECT_MODEL} project model.
297
+
298
+ In non-standard environments, it may be necessary to set the DOKKIT_LIB
299
+ variable to point to the location of Dokkit's libraries.
300
+
301
+ EOM
302
+ end
303
+
304
+ end # Application
305
+ end # Dokkit
@@ -0,0 +1,55 @@
1
+ # Built-in Dokkit rakefile
2
+ #
3
+ # This is effectively a copy of the template rakefile,
4
+ # but with extra tasks for the command-line wrapper.
5
+ #
6
+ # (c)2006 Andrea Fazzi (and contributors)
7
+ #
8
+ begin
9
+ require 'rubygems'
10
+ rescue LoadError
11
+ nil # optional
12
+ end
13
+ require 'rake'
14
+ require 'rake/clean'
15
+ require 'dokkit'
16
+
17
+ # Import tasks for current project
18
+
19
+ #################### CREATE NEW PROJECT FROM TEMPLATE ###############
20
+ #
21
+ # This works in a slightly odd way. The 'create' task simply sets up
22
+ # a rule that catches anything. This rule will then be triggered by
23
+ # the task that follows on the command-line, and taken as the
24
+ # target directory name.
25
+ #
26
+ # So instead of 'dokkit create NAME=foo' we have 'dokkit create foo'
27
+ #
28
+ # Note that this does preclude having other tasks on the same
29
+ # invocation (after the create at least) but does also allow
30
+ # multiple projects to be created at once.
31
+ #
32
+ # Also need a way to display error message if the rule isn't
33
+ # invoked at least once...
34
+ # /(((\w*\/)*)(\w*))\/{2}(((\w*\/)*)(\w*))/.match(t.name)
35
+
36
+ desc "Bootstrap a new documentation project"
37
+ task :create do
38
+ rule '' do |t|
39
+ fail "#{t.name} already exists" if File.exists?(t.name)
40
+
41
+ src = ENV['PROJECT']
42
+ src_dir = Dokkit::Application.get_project_dirs.detect { |it| File.exists?(File.join(File.expand_path(it),src)) }
43
+
44
+ fail "Cannot locate project template #{src}!\n" unless src_dir
45
+
46
+ cp_r File.join(File.expand_path(src_dir), src), t.name
47
+ end
48
+ end
49
+
50
+ #src = ENV['PROJECT']
51
+ #src_dir = Dokkit::Application.get_project_dirs.detect { |it| File.exists?(File.join(File.expand_path(it),src)) }
52
+
53
+ #import "#{File.join(File.join(src_dir,src),'Rakefile')}" if File.exists?(File.join(File.join(src_dir,src),'Rakefile'))
54
+ #import File.join(File.dirname(__FILE__),('/projects/tech_report/Rakefile'))
55
+
@@ -0,0 +1,21 @@
1
+ # latex-notemplate.rb
2
+ # @Author: Andrea Fazzi (andrea.fazzi AT alca.le.it)
3
+ # @Website: http://alca.le.it/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 04-Dic-2006.
6
+ # @Last Change: 04-Dic-2006.
7
+ # @Revision: 0.1
8
+
9
+ require 'deplate/fmt/html'
10
+
11
+ class Deplate::Formatter::HTMLNoTemplate < Deplate::Formatter::HTML
12
+ self.myname = "html-notemplate"
13
+ self.rx = /html?(-notemplate)?/i
14
+
15
+
16
+ def prepare
17
+ end
18
+
19
+ def add_package(pkg, *options)
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ # latex-notemplate.rb
2
+ # @Author: Luca Greco (luca.greco AT alca.le.it)
3
+ # @Website: http://alca.le.it/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 16-Oct-2006.
6
+ # @Last Change: 16-Oct-2006.
7
+ # @Revision: 0.1
8
+
9
+ require 'deplate/fmt/latex'
10
+
11
+ class Deplate::Formatter::LatexNoTemplate < Deplate::Formatter::LaTeX
12
+ self.myname = "latex-notemplate"
13
+ self.rx = /(la)?tex(-notemplate)?/i
14
+
15
+
16
+ def prepare
17
+ end
18
+
19
+ def add_package(pkg, *options)
20
+ end
21
+ end
22
+
@@ -0,0 +1,69 @@
1
+ #--
2
+ # Rake tasklib for Dokkit
3
+ # (c)2006 Andrea Fazzi (and contributors)
4
+ #
5
+ # See 'dokkit.rb' or LICENSE for licence information.
6
+ #++
7
+
8
+ require 'rote/rotetasks.rb'
9
+
10
+ module Rote
11
+
12
+ class DocTask
13
+
14
+ # Base directories used by the task.
15
+ attr_accessor :config_dir
16
+
17
+ # define a task for each page, and 'all pages' task
18
+ def define_page_tasks
19
+ pages_fl = pages.to_filelist
20
+
21
+ gen_files = pages_fl.select { |fn| not File.directory?(fn) }.map do |fn|
22
+ tfn, blk = target_fn(/^#{pages.dir}/, fn)
23
+
24
+ desc "#{fn} => #{tfn}" #if show_file_tasks?
25
+ file tfn => [fn] do
26
+ dn = File.dirname(tfn)
27
+ mkdir_p dn unless File.exists?(dn)
28
+ puts "tr #{fn} => #{tfn}"
29
+ begin
30
+ File.open(tfn, 'w+') do |f|
31
+ # new page, run extension block, render out, throw away
32
+ f << Page.new(fn,pages.dir,layout_dir,config_dir,&blk).render
33
+ end
34
+ rescue => e
35
+ # Oops... Unlink file and dump backtrace
36
+ File.unlink(tfn)
37
+ bt = e.backtrace
38
+ end_idx = bt.each_with_index do |entry, idx|
39
+ break idx if entry =~ /^#{File.dirname(__FILE__)}/
40
+ end
41
+ puts bt[0...end_idx]
42
+ raise
43
+ end
44
+ end
45
+
46
+ # Each page depends properly on source and common - thx again
47
+ # Jonathan :)
48
+ src_rb = Page::page_ruby_filename(fn)
49
+ if File.exists?(src_rb)
50
+ file tfn => [src_rb]
51
+ end
52
+
53
+ common_rbs = Page::resolve_common_rubys(File.dirname(fn))
54
+ file tfn => common_rbs unless common_rbs.empty?
55
+
56
+ tfn
57
+ end
58
+
59
+ desc "Render new/changed documentation pages"
60
+ task "#{name}_pages" => gen_files
61
+ task "clobber_#{name}_pages" do
62
+ gen_files.each do |f|
63
+ rm_f f
64
+ end
65
+ end
66
+ end
67
+
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ #--
2
+ # Dokkit filter for Deplate
3
+ # (c)2006 Andrea Fazzi (and contributors)
4
+ #
5
+ # See 'dokkit.rb' or LICENSE for licence information.
6
+
7
+ require 'deplate/converter'
8
+ require 'deplate/core'
9
+ require 'rote/filters/base'
10
+ require 'dokkit/deplate/fmt/latex-notemplate'
11
+ require 'dokkit/deplate/fmt/html-notemplate'
12
+
13
+ module Dokkit
14
+ module Filters
15
+ #####
16
+ ## Page filter that converts emacs-wiki formatting to tex using
17
+ ## deplate.
18
+ ##
19
+ class Deplate < Rote::Filters::TextFilter
20
+
21
+ # Create a new filter instance. If a block is defined returns a Deplate::Converter instance.
22
+ # You can supply options directly to the instance. See deplate docs for a full list
23
+ # of options.
24
+ def initialize(formatter)
25
+ super()
26
+ ::Deplate::Core.declare_formatter(::Deplate::Formatter::LatexNoTemplate,'latex-notemplate')
27
+ ::Deplate::Core.declare_formatter(::Deplate::Formatter::HTMLNoTemplate,'html-notemplate')
28
+ @deplate = ::Deplate::Converter.new(formatter) { |instance| yield(instance) if block_given? }
29
+ end
30
+
31
+ def handler(text,page)
32
+ @deplate.convert_string(text)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,26 @@
1
+ #--
2
+ # Require all filters
3
+ # (c)2005, 2006 Ross Bamford (and contributors)
4
+ #
5
+ # See 'rote.rb' or LICENSE for licence information.
6
+ # $Id: filters.rb 156 2006-01-05 01:13:43 +0000 (Thu, 05 Jan 2006) roscopeco $
7
+ #++
8
+
9
+ # Everyone requires this, we need to get it loaded first.
10
+ require 'rote/filters/base'
11
+
12
+ # This now requires conservatively, ignoring any filters that
13
+ # throw a LoadError. This allows a simple 'require rote/filters' to
14
+ # be used to load all filters _for which dependencies are
15
+ # available_.
16
+ Dir[File.join(File.dirname(__FILE__), 'filters/*.rb')].each do |fn|
17
+ begin
18
+ require fn unless fn =~ /[\\\/]base.rb$/
19
+ rescue LoadError
20
+
21
+ # ignore, different filters require different library
22
+ # support.
23
+
24
+ end
25
+ end
26
+