dokkit 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +135 -3
- data/Manifest.txt +9 -2
- data/README.txt +35 -17
- data/Rakefile +12 -8
- data/lib/dokkit.rb +1 -1
- data/lib/dokkit/cache/cache.rb +6 -1
- data/lib/dokkit/environment.rb +1 -0
- data/lib/dokkit/environment/basic.rb +148 -122
- data/lib/dokkit/environment/container.rb +35 -0
- data/lib/dokkit/environment/helpers.rb +43 -0
- data/lib/dokkit/environment/helpers/fileselection.rb +17 -6
- data/lib/dokkit/factory/factory.rb +4 -4
- data/lib/dokkit/filters.rb +1 -0
- data/lib/dokkit/filters/maruku.rb +9 -1
- data/lib/dokkit/filters/yaml.rb +26 -0
- data/lib/dokkit/logging.rb +1 -1
- data/lib/dokkit/resource/document.rb +141 -142
- data/lib/dokkit/resource/extensions/builtin.rb +2 -0
- data/lib/dokkit/resource/extensions/url.rb +1 -1
- data/lib/dokkit/resource/filenamehelper.rb +5 -1
- data/lib/dokkit/tasklib.rb +5 -0
- data/lib/dokkit/tasklib/base.rb +36 -0
- data/lib/dokkit/tasklib/clean.rb +12 -19
- data/lib/dokkit/tasklib/render.rb +20 -24
- data/lib/models/simple/setup/setup.rb +5 -3
- data/tasks/ann.rake +81 -0
- data/tasks/bones.rake +21 -0
- data/tasks/gem.rake +67 -30
- data/tasks/git.rake +41 -0
- data/tasks/manifest.rake +30 -22
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/{doc.rake → rdoc.rake} +11 -9
- data/tasks/rubyforge.rake +12 -12
- data/tasks/setup.rb +189 -72
- data/tasks/spec.rake +24 -9
- data/tasks/svn.rake +15 -11
- data/tasks/test.rake +7 -9
- metadata +14 -7
- data/tasks/annotations.rake +0 -30
data/History.txt
CHANGED
@@ -1,7 +1,139 @@
|
|
1
|
-
== 0.
|
1
|
+
== 0.5.0 / 2008-08-21
|
2
2
|
|
3
|
-
*
|
4
|
-
|
3
|
+
* huge code refactoring
|
4
|
+
|
5
|
+
* many bug fixes
|
6
|
+
|
7
|
+
* improved support for partial; now, by default, file name beginning
|
8
|
+
with an underscore are considered partial, e.g.:
|
9
|
+
|
10
|
+
render :partial => 'partial'
|
11
|
+
|
12
|
+
The code above, will render 'doc/pages/_partial' using the current
|
13
|
+
output format.
|
14
|
+
|
15
|
+
* new configuration dsl syntax, e.g.:
|
16
|
+
|
17
|
+
environment do |env|
|
18
|
+
|
19
|
+
env.configure do |configure|
|
20
|
+
configure.document_dir = 'doc/documents'
|
21
|
+
end
|
22
|
+
|
23
|
+
env.select_document do |selection|
|
24
|
+
selection.include('*')
|
25
|
+
selection.exclude('*.draft')
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
== 0.4.4 / 2008-08-10
|
31
|
+
|
32
|
+
* fixed a bug that prevented to use custom dokkit models; to get
|
33
|
+
more information about custom models please refer to
|
34
|
+
http://dokkit.rubyforge.org/models/models.html
|
35
|
+
|
36
|
+
* dokkit gem no longer depends on haml; if you want to use haml you
|
37
|
+
have to install it
|
38
|
+
|
39
|
+
* an error message is displayed when an output format is associated
|
40
|
+
to a formatter that doesn't support it
|
41
|
+
|
42
|
+
== 0.4.3 / 2008-08-05
|
43
|
+
|
44
|
+
* fixed haml dependency in gem package
|
45
|
+
|
46
|
+
== 0.4.2 / 2008-08-05
|
47
|
+
|
48
|
+
* added 'formatter' configuration key
|
49
|
+
|
50
|
+
With the 'formatter' key, users can select the formatter to use for
|
51
|
+
rendering the current document.
|
52
|
+
|
53
|
+
The example configuration below tell dokkit to use maruku filters
|
54
|
+
(maruku-html, maruku-latex) to render the same markdown source document
|
55
|
+
in html and latex format:
|
56
|
+
|
57
|
+
---
|
58
|
+
formatter: maruku
|
59
|
+
format:
|
60
|
+
- html
|
61
|
+
- latex
|
62
|
+
---
|
63
|
+
|
64
|
+
The example above is equivalent to:
|
65
|
+
|
66
|
+
---
|
67
|
+
format:
|
68
|
+
- html
|
69
|
+
filter:
|
70
|
+
- erb
|
71
|
+
- maruku-html
|
72
|
+
- latex
|
73
|
+
filter:
|
74
|
+
- erb
|
75
|
+
- maruku-latex
|
76
|
+
---
|
77
|
+
|
78
|
+
The default value for 'formatter' key is 'deplate'. Current available
|
79
|
+
formatters are: deplate, maruku, haml.
|
80
|
+
|
81
|
+
* added haml filter
|
82
|
+
|
83
|
+
The example below will applies haml postfiltering to the document layout:
|
84
|
+
|
85
|
+
---
|
86
|
+
format:
|
87
|
+
- html
|
88
|
+
postfilter:
|
89
|
+
- haml
|
90
|
+
---
|
91
|
+
|
92
|
+
* easier access to configuration hash
|
93
|
+
|
94
|
+
The erb code below returns the value of @configuration['title']:
|
95
|
+
|
96
|
+
---
|
97
|
+
title: Document title
|
98
|
+
---
|
99
|
+
Title of the document: <%= title %>
|
100
|
+
|
101
|
+
== 0.4.1 / 2008-07-27
|
102
|
+
|
103
|
+
* added support for postfiltering (now erb processing is done in the
|
104
|
+
postfiltering step)
|
105
|
+
|
106
|
+
* added experimental support for tidy postfilter
|
107
|
+
|
108
|
+
Postfiltering is accessible through postfilter configuration key.
|
109
|
+
|
110
|
+
Example:
|
111
|
+
|
112
|
+
---
|
113
|
+
format:
|
114
|
+
- text
|
115
|
+
- latex
|
116
|
+
- html:
|
117
|
+
postfilter:
|
118
|
+
- erb
|
119
|
+
- tidy
|
120
|
+
---
|
121
|
+
Content of the document.
|
122
|
+
|
123
|
+
The example above will render the document producing plain text, latex
|
124
|
+
and html output. In particular, the html output will be postprocessed by
|
125
|
+
erb and tidy filters.
|
126
|
+
|
127
|
+
== 0.4.0 / 2008-07-18
|
128
|
+
|
129
|
+
* improved support for partials and nested layouts
|
130
|
+
|
131
|
+
* added cache support
|
132
|
+
|
133
|
+
* easy environment setup with the introduction of a configuration
|
134
|
+
container
|
135
|
+
|
136
|
+
* a lot of code refactoring and bug fixes
|
5
137
|
|
6
138
|
== 0.3.0 / 2008-01-09
|
7
139
|
|
data/Manifest.txt
CHANGED
@@ -9,6 +9,7 @@ lib/dokkit/cache.rb
|
|
9
9
|
lib/dokkit/cache/cache.rb
|
10
10
|
lib/dokkit/environment.rb
|
11
11
|
lib/dokkit/environment/basic.rb
|
12
|
+
lib/dokkit/environment/container.rb
|
12
13
|
lib/dokkit/environment/helpers.rb
|
13
14
|
lib/dokkit/environment/helpers/extmap.rb
|
14
15
|
lib/dokkit/environment/helpers/fileselection.rb
|
@@ -21,6 +22,7 @@ lib/dokkit/filters/haml.rb
|
|
21
22
|
lib/dokkit/filters/maruku.rb
|
22
23
|
lib/dokkit/filters/nil.rb
|
23
24
|
lib/dokkit/filters/tidy.rb
|
25
|
+
lib/dokkit/filters/yaml.rb
|
24
26
|
lib/dokkit/hash.rb
|
25
27
|
lib/dokkit/logging.rb
|
26
28
|
lib/dokkit/logging/logger.rb
|
@@ -35,6 +37,7 @@ lib/dokkit/resource/extensions/html.rb
|
|
35
37
|
lib/dokkit/resource/extensions/url.rb
|
36
38
|
lib/dokkit/resource/filenamehelper.rb
|
37
39
|
lib/dokkit/tasklib.rb
|
40
|
+
lib/dokkit/tasklib/base.rb
|
38
41
|
lib/dokkit/tasklib/clean.rb
|
39
42
|
lib/dokkit/tasklib/render.rb
|
40
43
|
lib/models/simple/Rakefile
|
@@ -46,10 +49,14 @@ lib/models/simple/doc/layouts/simple.latex
|
|
46
49
|
lib/models/simple/doc/layouts/simple.text
|
47
50
|
lib/models/simple/doc/pages/simple.deplate
|
48
51
|
lib/models/simple/setup/setup.rb
|
49
|
-
tasks/
|
50
|
-
tasks/
|
52
|
+
tasks/ann.rake
|
53
|
+
tasks/bones.rake
|
51
54
|
tasks/gem.rake
|
55
|
+
tasks/git.rake
|
52
56
|
tasks/manifest.rake
|
57
|
+
tasks/notes.rake
|
58
|
+
tasks/post_load.rake
|
59
|
+
tasks/rdoc.rake
|
53
60
|
tasks/rubyforge.rake
|
54
61
|
tasks/setup.rb
|
55
62
|
tasks/spec.rake
|
data/README.txt
CHANGED
@@ -4,34 +4,52 @@ dokkit
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
dokkit is a document generator
|
8
|
-
|
9
|
-
|
10
|
-
docbook, plain text, ...).
|
7
|
+
dokkit is a document generator that is suitable for static website
|
8
|
+
generation too. dokkit uses formatters like deplate and maruku to
|
9
|
+
generate output in tex, html and plain text.
|
11
10
|
|
12
11
|
With dokkit you can:
|
13
12
|
|
14
13
|
* generate static websites
|
15
|
-
|
16
|
-
*
|
14
|
+
|
15
|
+
* generate many types of documents in many formats
|
16
|
+
|
17
|
+
* write your documents using a simple wiki syntax and obtain high
|
18
|
+
quality output (with pdflatex)
|
19
|
+
|
17
20
|
* generate different output formats from the same source document
|
18
|
-
|
21
|
+
|
22
|
+
* use models to quickly generate the documents you want (technical
|
23
|
+
report, howto, guides, presentation, website, etc.)
|
24
|
+
|
19
25
|
* simply derive new documentation models from the existing ones
|
20
|
-
* simply modify existing models to fit your needs
|
21
26
|
|
22
|
-
|
27
|
+
* simply modify existing models to fit your needs
|
23
28
|
|
24
|
-
|
29
|
+
For more information about dokkit visit the website[http://dokkit.rubyforge.org/]
|
25
30
|
|
26
31
|
== FEATURES/PROBLEMS:
|
27
32
|
|
28
|
-
dokkit
|
33
|
+
dokkit's features are:
|
34
|
+
|
35
|
+
* a smart building system based on rake
|
29
36
|
|
30
|
-
* a smart building system based on rake[http://rake.rubyforge.org]
|
31
|
-
* a documentation directory structure organized in pages, layouts, configuration files, resources
|
32
37
|
* a templating system based on ERB
|
33
|
-
|
38
|
+
|
39
|
+
* a flexible configuration system based on YAML that supports shared
|
40
|
+
configuration files and ‘in header’ configuration
|
41
|
+
|
42
|
+
* an extensible formatting system that uses deplate and maruku as built-in filters
|
43
|
+
|
44
|
+
* convention over configuration: for example, you don’t need to give a
|
45
|
+
layout name to use if a layout with the same name of the processed
|
46
|
+
document is found in doc/layouts folder
|
47
|
+
|
48
|
+
* support for nested layouts
|
49
|
+
|
34
50
|
* support for partials
|
51
|
+
|
52
|
+
* support for caching
|
35
53
|
|
36
54
|
== SYNOPSIS:
|
37
55
|
|
@@ -51,9 +69,9 @@ To create a new documentation environment in <dirname> run:
|
|
51
69
|
|
52
70
|
== QUICK START
|
53
71
|
|
54
|
-
|
55
|
-
|
56
|
-
|
72
|
+
dokkit mydocument
|
73
|
+
cd mydocument
|
74
|
+
rake
|
57
75
|
|
58
76
|
== LICENSE:
|
59
77
|
|
data/Rakefile
CHANGED
@@ -11,15 +11,19 @@ task :default => 'spec:run'
|
|
11
11
|
|
12
12
|
PROJ.name = 'dokkit'
|
13
13
|
PROJ.version = Dokkit::VERSION
|
14
|
-
|
14
|
+
|
15
|
+
PROJ.summary = 'dokkit is an open source document generator that is suitable for static website generation too.'
|
16
|
+
|
15
17
|
PROJ.authors = 'Andrea Fazzi'
|
16
18
|
PROJ.email = 'andrea.fazzi@alca.le.it'
|
17
19
|
PROJ.url = 'http://dokkit.rubyforge.org'
|
18
|
-
PROJ.
|
19
|
-
PROJ.
|
20
|
-
PROJ.
|
21
|
-
PROJ.
|
22
|
-
PROJ.
|
23
|
-
PROJ.
|
24
|
-
|
20
|
+
PROJ.rubyforge.name = 'dokkit'
|
21
|
+
PROJ.gem.dependencies = ['deplate', ['rake', '>= 0.8.1'], 'maruku']
|
22
|
+
PROJ.gem.need_zip = true
|
23
|
+
PROJ.spec.opts << ['--format', 'specdoc', '--color']
|
24
|
+
PROJ.rdoc.exclude << "models/simple"
|
25
|
+
PROJ.rdoc.remote_dir = 'rdoc'
|
26
|
+
|
27
|
+
PROJ.svn.path = 'dokkit-core'
|
28
|
+
|
25
29
|
# EOF
|
data/lib/dokkit.rb
CHANGED
data/lib/dokkit/cache/cache.rb
CHANGED
@@ -23,7 +23,12 @@ module Dokkit
|
|
23
23
|
|
24
24
|
def add_dependency(source_fn, format, dep)
|
25
25
|
@deps[source_fn] ||= { format => [] }
|
26
|
-
|
26
|
+
if @deps[source_fn][format]
|
27
|
+
@deps[source_fn][format] << dep unless (dep.nil? or @deps[source_fn][format].include?(dep))
|
28
|
+
else
|
29
|
+
@deps[source_fn][format] = []
|
30
|
+
@deps[source_fn][format] << dep unless (dep.nil? or @deps[source_fn][format].include?(dep))
|
31
|
+
end
|
27
32
|
end
|
28
33
|
|
29
34
|
def load
|
data/lib/dokkit/environment.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# File 'basic.rb' created on 01 mag 2008 at 15:37:33.
|
3
3
|
#
|
4
|
-
# See 'dokkit.rb' or +LICENSE+ for
|
4
|
+
# See 'dokkit.rb' or +LICENSE+ for license information.
|
5
5
|
#
|
6
6
|
# (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
7
7
|
#
|
@@ -9,6 +9,7 @@
|
|
9
9
|
require 'ostruct'
|
10
10
|
require 'dokkit'
|
11
11
|
require 'dokkit/environment'
|
12
|
+
require 'dokkit/environment/helpers'
|
12
13
|
require 'dokkit/logging'
|
13
14
|
require 'dokkit/factory'
|
14
15
|
require 'dokkit/resource'
|
@@ -18,40 +19,135 @@ require 'dokkit/cache'
|
|
18
19
|
|
19
20
|
module Dokkit
|
20
21
|
module Environment
|
21
|
-
module Basic
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
def environment(&blk) Basic.new(&blk); end
|
24
|
+
|
25
|
+
class Basic < Container
|
26
|
+
|
27
|
+
include Dokkit::Environment::Helper
|
28
|
+
|
29
|
+
def initialize(&blk)
|
30
|
+
super
|
25
31
|
add_lib_to_load_path
|
26
|
-
|
27
|
-
|
28
|
-
|
32
|
+
|
33
|
+
init_extmap
|
34
|
+
init_services
|
35
|
+
|
36
|
+
yield self if block_given?
|
29
37
|
|
30
|
-
|
31
|
-
def add_lib_to_load_path
|
32
|
-
$: << 'lib'
|
38
|
+
define_tasks
|
33
39
|
end
|
34
|
-
|
35
|
-
# Define rake tasks for the environment.
|
40
|
+
|
36
41
|
def define_tasks
|
37
42
|
render
|
38
43
|
clean
|
39
44
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@logger ||= Logging::Observer::Console.logger
|
45
|
+
|
46
|
+
def init_services
|
47
|
+
methods.select { |meth| meth =~ /register_/ }.each { |meth| send(meth) }
|
44
48
|
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
+
|
50
|
+
def register_document_fs
|
51
|
+
register :document_fs do
|
52
|
+
Environment::Helper::FileSelection.new(configuration.document_dir) do |fs|
|
53
|
+
fs.include('**/*')
|
54
|
+
fs.exclude('**/*.yaml')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def register_data_fs
|
60
|
+
register :data_fs do
|
61
|
+
Environment::Helper::FileSelection.new(configuration.data_dir) do |fs|
|
62
|
+
fs.include('**/*')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def register_extmap
|
68
|
+
register :extmap do
|
69
|
+
Helper::ExtMap.new(configuration.document_dir)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def register_filter_factory
|
74
|
+
register :filter_factory do
|
75
|
+
Dokkit::Factory.new do |factory|
|
76
|
+
factory.add('nil') { Dokkit::Filter::Nil.new }
|
77
|
+
factory.add('erb') { |document| Dokkit::Filter::ERB.new(document) }
|
78
|
+
factory.add('yaml') { |document| Dokkit::Filter::YAML.new(document) }
|
79
|
+
factory.add('tidy') { Dokkit::Filter::Tidy.new }
|
80
|
+
factory.add('maruku-html') { Dokkit::Filter::MarukuHTML.new }
|
81
|
+
factory.add('deplate-latex') { Dokkit::Filter::DeplateLatex.new }
|
82
|
+
factory.add('deplate-html') { Dokkit::Filter::DeplateHTML.new }
|
83
|
+
factory.add('deplate-text') { Dokkit::Filter::DeplateText.new }
|
84
|
+
factory.add('haml') { |document| Dokkit::Filter::Haml.new(document) }
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def register_resource_factory
|
91
|
+
register :resource_factory do
|
92
|
+
Factory.new do |factory|
|
93
|
+
factory.add(:document, &document_factory_block)
|
94
|
+
factory.add(:data, &data_factory_block)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def register_cache
|
100
|
+
register :cache do
|
101
|
+
Cache.new
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def register_render
|
106
|
+
register :render do
|
107
|
+
TaskLib::Render.new do |task|
|
108
|
+
task.logger = logger
|
109
|
+
task.resource_factory = resource_factory
|
110
|
+
task.document_fns = document_fs.files
|
111
|
+
task.data_fns = data_fs.files
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def register_clean
|
117
|
+
register :clean do
|
118
|
+
TaskLib::Clean.new do |task|
|
119
|
+
task.logger = logger
|
120
|
+
task.output_dir = configuration.output_dir
|
121
|
+
task.cache_dir = configuration.cache_dir
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def register_logger
|
127
|
+
register :logger do
|
128
|
+
Logging::Observer::Console.logger
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def register_configuration
|
133
|
+
register :configuration do
|
134
|
+
OpenStruct.new(default_configuration)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Add lib folder to the load path.
|
139
|
+
def add_lib_to_load_path
|
140
|
+
$: << 'lib'
|
49
141
|
end
|
50
142
|
|
143
|
+
def init_extmap
|
144
|
+
@extmap = { }
|
145
|
+
end
|
146
|
+
|
51
147
|
def default_filter_chain
|
52
148
|
{
|
53
149
|
'deplate' => { 'html' => ['erb', 'deplate-html'], 'latex' => ['erb', 'deplate-latex'], 'text' => ['erb', 'deplate-text']},
|
54
|
-
'maruku' => { 'html' => ['erb', 'maruku-html'], 'latex' => ['erb', 'maruku-latex']
|
150
|
+
'maruku' => { 'html' => ['erb', 'maruku-html'], 'latex' => ['erb', 'maruku-latex'] },
|
55
151
|
'haml' => { 'html' => ['haml'] },
|
56
152
|
}
|
57
153
|
end
|
@@ -59,121 +155,51 @@ module Dokkit
|
|
59
155
|
def default_postfilter_chain
|
60
156
|
{ 'html' => ['erb'], 'latex' => ['erb'], 'text' => ['erb'] }
|
61
157
|
end
|
62
|
-
|
63
|
-
# Return an OpenStruct object to setup documentation
|
64
|
-
# directories. Instantiate the object only once.
|
65
|
-
#
|
66
|
-
# configuration.document_dir :: set/get documents folder.
|
67
|
-
# configuration.config_dir :: set/get configs folder.
|
68
|
-
# configuration.layout_dir :: set/get layouts folder.
|
69
|
-
# configuration.data_dir :: set/get data folder.
|
70
|
-
# configuration.output_dir :: set/get output folder.
|
71
|
-
# configuration.cache_dir :: set/get cache folder.
|
72
|
-
#
|
73
|
-
def configuration
|
74
|
-
@configuration ||= OpenStruct.new({ :document_dir => 'doc/pages',
|
75
|
-
:config_dir => 'doc/configs',
|
76
|
-
:layout_dir => 'doc/layouts',
|
77
|
-
:data_dir => 'doc/data',
|
78
|
-
:output_dir => 'output',
|
79
|
-
:cache_dir => '.cache',
|
80
|
-
:default_filter_chain => default_filter_chain,
|
81
|
-
:default_postfilter_chain => default_postfilter_chain })
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
# Return a Dokkit::Environment::Helper::FileSelection object
|
86
|
-
# with the list of documents in configuration.document_dir
|
87
|
-
# folder and its subdir. The object is instantiated only
|
88
|
-
# once. By default all files in configuration.document_dir and
|
89
|
-
# subdirs are included.
|
90
|
-
def documents
|
91
|
-
@documents ||= Environment::Helper::FileSelection.new(configuration.document_dir) do |fs|
|
92
|
-
fs.include('**/*')
|
93
|
-
fs.exclude('**/*.yaml')
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Return a Dokkit::Environment::Helper::FileSelection object
|
98
|
-
# with the list of data files in configuration.data_dir folder
|
99
|
-
# and its subdir. The object is instantiated only once.
|
100
|
-
def data
|
101
|
-
@data ||= Environment::Helper::FileSelection.new(configuration.data_dir).include('**/*')
|
102
|
-
end
|
103
|
-
|
104
|
-
# Return a Dokkit::Environment::Helper::ExtMap object that map
|
105
|
-
# an extension code block to document files using glob patterns.
|
106
|
-
def extmap
|
107
|
-
@extmap ||= Helper::ExtMap.new(configuration.document_dir)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Construct a filter factory and register filters.
|
111
|
-
def filter_factory
|
112
|
-
@filter_factory ||= Dokkit::Factory.new do |factory|
|
113
|
-
factory.add('nil' => lambda { Dokkit::Filter::Nil.new } )
|
114
|
-
factory.add('erb' => lambda { |binding| Dokkit::Filter::ERB.new(binding) } )
|
115
|
-
factory.add('tidy' => lambda { Dokkit::Filter::Tidy.new } )
|
116
|
-
factory.add('maruku-html' => lambda { Dokkit::Filter::MarukuHTML.new } )
|
117
|
-
factory.add('deplate-latex' => lambda { Dokkit::Filter::DeplateLatex.new } )
|
118
|
-
factory.add('deplate-html' => lambda { Dokkit::Filter::DeplateHTML.new } )
|
119
|
-
factory.add('deplate-text' => lambda { Dokkit::Filter::DeplateText.new } )
|
120
|
-
factory.add('haml' => lambda { |document| Dokkit::Filter::Haml.new(document) } )
|
121
|
-
end
|
122
|
-
end
|
123
158
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
159
|
+
def default_configuration
|
160
|
+
{
|
161
|
+
:document_dir => 'doc/pages',
|
162
|
+
:config_dir => 'doc/configs',
|
163
|
+
:layout_dir => 'doc/layouts',
|
164
|
+
:data_dir => 'doc/data',
|
165
|
+
:output_dir => 'output',
|
166
|
+
:cache_dir => '.cache',
|
167
|
+
:default_filter_chain => default_filter_chain,
|
168
|
+
:default_postfilter_chain => default_postfilter_chain
|
169
|
+
}
|
170
|
+
end
|
171
|
+
|
172
|
+
def document
|
173
|
+
register :document do
|
174
|
+
Resource::Document.new(source_fn, configuration.marshal_dump) do |document|
|
175
|
+
document.logger = logger
|
176
|
+
document.cache = cache
|
177
|
+
document.resource_factory = resource_factory
|
178
|
+
document.filter_factory = filter_factory
|
179
|
+
end
|
131
180
|
end
|
132
181
|
end
|
133
|
-
|
182
|
+
|
134
183
|
# Return a block that is able to construct a Document instance.
|
135
184
|
def document_factory_block
|
136
185
|
lambda do |source_fn|
|
137
|
-
Resource::Document.new(source_fn,
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
186
|
+
Resource::Document.new(source_fn, configuration.marshal_dump) do |document|
|
187
|
+
document.logger = logger
|
188
|
+
document.cache = cache
|
189
|
+
document.resource_factory = resource_factory
|
190
|
+
document.filter_factory = filter_factory
|
191
|
+
document.extend @extmap[source_fn] if @extmap[source_fn]
|
192
|
+
end
|
144
193
|
end
|
145
194
|
end
|
146
|
-
|
147
|
-
# Return a block that is able to construct a Data instance.
|
195
|
+
|
148
196
|
def data_factory_block
|
149
197
|
lambda do |source_fn|
|
150
198
|
Resource::Data.new(source_fn, configuration.marshal_dump)
|
151
199
|
end
|
152
200
|
end
|
153
201
|
|
154
|
-
# Define render tasklib.
|
155
|
-
def render
|
156
|
-
TaskLib::Render.new(logger, resource_factory, documents.files, data.files)
|
157
|
-
end
|
158
|
-
|
159
|
-
# Define clean tasklib.
|
160
|
-
def clean
|
161
|
-
TaskLib::Clean.new(logger, configuration.marshal_dump)
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
module Dokkit
|
169
|
-
module Environment
|
170
|
-
module Basic
|
171
|
-
|
172
|
-
# Define a setup container.
|
173
|
-
class Container
|
174
|
-
include Dokkit::Environment::Basic
|
175
|
-
end
|
176
|
-
|
177
202
|
end
|
203
|
+
|
178
204
|
end
|
179
205
|
end
|