dokkit 0.4.1 → 0.4.2

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 (68) hide show
  1. data/Manifest.txt +1 -59
  2. data/lib/dokkit.rb +1 -1
  3. data/lib/dokkit/environment/basic.rb +23 -8
  4. data/lib/dokkit/filters.rb +1 -0
  5. data/lib/dokkit/filters/erb.rb +3 -3
  6. data/lib/dokkit/filters/haml.rb +31 -0
  7. data/lib/dokkit/models/simple/doc/layouts/simple.html +1 -1
  8. data/lib/dokkit/resource/document.rb +59 -63
  9. metadata +3 -61
  10. data/spec/dokkit/application_spec.rb +0 -141
  11. data/spec/dokkit/cache/cache_spec.rb +0 -87
  12. data/spec/dokkit/dokkit_spec.rb +0 -20
  13. data/spec/dokkit/environment/basic_spec.rb +0 -138
  14. data/spec/dokkit/environment/helpers/extmap_spec.rb +0 -52
  15. data/spec/dokkit/environment/helpers/fileselection_spec.rb +0 -80
  16. data/spec/dokkit/environment/helpers/test_data/doc/pages/document_1.ext_1 +0 -0
  17. data/spec/dokkit/environment/helpers/test_data/doc/pages/document_2 +0 -0
  18. data/spec/dokkit/environment/helpers/test_data/doc/pages/document_3.ext_3 +0 -0
  19. data/spec/dokkit/environment/test_data/doc/data/data +0 -0
  20. data/spec/dokkit/environment/test_data/doc/pages/document_1 +0 -0
  21. data/spec/dokkit/environment/test_data/doc/pages/document_1.yaml +0 -3
  22. data/spec/dokkit/environment/test_data/doc/pages/document_2 +0 -0
  23. data/spec/dokkit/environment/test_data/doc/pages/subdir/document_1 +0 -0
  24. data/spec/dokkit/factory/factory_spec.rb +0 -69
  25. data/spec/dokkit/filters/deplate_spec.rb +0 -47
  26. data/spec/dokkit/filters/erb_spec.rb +0 -26
  27. data/spec/dokkit/filters/maruku_spec.rb +0 -28
  28. data/spec/dokkit/filters/nil_spec.rb +0 -29
  29. data/spec/dokkit/filters/tidy_spec.rb +0 -48
  30. data/spec/dokkit/hash_spec.rb +0 -89
  31. data/spec/dokkit/logging/logger_spec.rb +0 -138
  32. data/spec/dokkit/logging/observers/console_spec.rb +0 -68
  33. data/spec/dokkit/resource/data_spec.rb +0 -32
  34. data/spec/dokkit/resource/document_spec.rb +0 -523
  35. data/spec/dokkit/resource/extensions/html_spec.rb +0 -35
  36. data/spec/dokkit/resource/extensions/url_spec.rb +0 -29
  37. data/spec/dokkit/resource/filenamehelper_spec.rb +0 -33
  38. data/spec/dokkit/resource/test_data/doc/configs/config_1.yaml +0 -3
  39. data/spec/dokkit/resource/test_data/doc/configs/config_2.yaml +0 -3
  40. data/spec/dokkit/resource/test_data/doc/configs/required.yaml +0 -3
  41. data/spec/dokkit/resource/test_data/doc/configs/subdir/document.yaml +0 -3
  42. data/spec/dokkit/resource/test_data/doc/layouts/container.html +0 -6
  43. data/spec/dokkit/resource/test_data/doc/layouts/layout.html +0 -6
  44. data/spec/dokkit/resource/test_data/doc/layouts/layout.latex +0 -8
  45. data/spec/dokkit/resource/test_data/doc/layouts/nested/nested.html +0 -4
  46. data/spec/dokkit/resource/test_data/doc/layouts/subdir/document.html +0 -6
  47. data/spec/dokkit/resource/test_data/doc/layouts/subdir/document.latex +0 -8
  48. data/spec/dokkit/resource/test_data/doc/pages/COMMON.yaml +0 -4
  49. data/spec/dokkit/resource/test_data/doc/pages/document_with_many_config.ext +0 -7
  50. data/spec/dokkit/resource/test_data/doc/pages/document_with_many_errors.ext +0 -12
  51. data/spec/dokkit/resource/test_data/doc/pages/document_with_many_targets.ext +0 -19
  52. data/spec/dokkit/resource/test_data/doc/pages/document_with_nested_layout.ext +0 -13
  53. data/spec/dokkit/resource/test_data/doc/pages/document_with_nil_target.ext +0 -5
  54. data/spec/dokkit/resource/test_data/doc/pages/document_with_not_defined_target.ext +0 -6
  55. data/spec/dokkit/resource/test_data/doc/pages/document_with_one_target.ext +0 -8
  56. data/spec/dokkit/resource/test_data/doc/pages/document_with_postfilter.ext +0 -10
  57. data/spec/dokkit/resource/test_data/doc/pages/subdir/COMMON.yaml +0 -3
  58. data/spec/dokkit/resource/test_data/doc/pages/subdir/document.ext +0 -8
  59. data/spec/dokkit/resource/test_data/doc/pages/subdir/document.yaml +0 -5
  60. data/spec/dokkit/tasklib/clean_spec.rb +0 -75
  61. data/spec/dokkit/tasklib/render_spec.rb +0 -125
  62. data/spec/dokkit/tasklib/test_data/doc/data/data_1 +0 -0
  63. data/spec/dokkit/tasklib/test_data/doc/pages/document_1 +0 -0
  64. data/spec/dokkit/tasklib/test_data/doc/pages/document_2 +0 -0
  65. data/spec/dokkit/test_data/dokkit/models/model1/doc/pages/model1 +0 -0
  66. data/spec/dokkit/test_data/dokkit/models/model2/doc/pages/model2 +0 -0
  67. data/spec/spec.opts +0 -4
  68. data/spec/spec_helper.rb +0 -139
data/Manifest.txt CHANGED
@@ -17,6 +17,7 @@ lib/dokkit/factory/factory.rb
17
17
  lib/dokkit/filters.rb
18
18
  lib/dokkit/filters/deplate.rb
19
19
  lib/dokkit/filters/erb.rb
20
+ lib/dokkit/filters/haml.rb
20
21
  lib/dokkit/filters/maruku.rb
21
22
  lib/dokkit/filters/nil.rb
22
23
  lib/dokkit/filters/tidy.rb
@@ -45,65 +46,6 @@ lib/dokkit/resource/filenamehelper.rb
45
46
  lib/dokkit/tasklib.rb
46
47
  lib/dokkit/tasklib/clean.rb
47
48
  lib/dokkit/tasklib/render.rb
48
- spec/dokkit/application_spec.rb
49
- spec/dokkit/cache/cache_spec.rb
50
- spec/dokkit/dokkit_spec.rb
51
- spec/dokkit/environment/basic_spec.rb
52
- spec/dokkit/environment/helpers/extmap_spec.rb
53
- spec/dokkit/environment/helpers/fileselection_spec.rb
54
- spec/dokkit/environment/helpers/test_data/doc/pages/document_1.ext_1
55
- spec/dokkit/environment/helpers/test_data/doc/pages/document_2
56
- spec/dokkit/environment/helpers/test_data/doc/pages/document_3.ext_3
57
- spec/dokkit/environment/test_data/doc/data/data
58
- spec/dokkit/environment/test_data/doc/pages/document_1
59
- spec/dokkit/environment/test_data/doc/pages/document_1.yaml
60
- spec/dokkit/environment/test_data/doc/pages/document_2
61
- spec/dokkit/environment/test_data/doc/pages/subdir/document_1
62
- spec/dokkit/factory/factory_spec.rb
63
- spec/dokkit/filters/deplate_spec.rb
64
- spec/dokkit/filters/erb_spec.rb
65
- spec/dokkit/filters/maruku_spec.rb
66
- spec/dokkit/filters/nil_spec.rb
67
- spec/dokkit/filters/tidy_spec.rb
68
- spec/dokkit/hash_spec.rb
69
- spec/dokkit/logging/logger_spec.rb
70
- spec/dokkit/logging/observers/console_spec.rb
71
- spec/dokkit/resource/data_spec.rb
72
- spec/dokkit/resource/document_spec.rb
73
- spec/dokkit/resource/extensions/html_spec.rb
74
- spec/dokkit/resource/extensions/url_spec.rb
75
- spec/dokkit/resource/filenamehelper_spec.rb
76
- spec/dokkit/resource/test_data/doc/configs/config_1.yaml
77
- spec/dokkit/resource/test_data/doc/configs/config_2.yaml
78
- spec/dokkit/resource/test_data/doc/configs/required.yaml
79
- spec/dokkit/resource/test_data/doc/configs/subdir/document.yaml
80
- spec/dokkit/resource/test_data/doc/layouts/container.html
81
- spec/dokkit/resource/test_data/doc/layouts/layout.html
82
- spec/dokkit/resource/test_data/doc/layouts/layout.latex
83
- spec/dokkit/resource/test_data/doc/layouts/nested/nested.html
84
- spec/dokkit/resource/test_data/doc/layouts/subdir/document.html
85
- spec/dokkit/resource/test_data/doc/layouts/subdir/document.latex
86
- spec/dokkit/resource/test_data/doc/pages/COMMON.yaml
87
- spec/dokkit/resource/test_data/doc/pages/document_with_many_config.ext
88
- spec/dokkit/resource/test_data/doc/pages/document_with_many_errors.ext
89
- spec/dokkit/resource/test_data/doc/pages/document_with_many_targets.ext
90
- spec/dokkit/resource/test_data/doc/pages/document_with_nested_layout.ext
91
- spec/dokkit/resource/test_data/doc/pages/document_with_nil_target.ext
92
- spec/dokkit/resource/test_data/doc/pages/document_with_not_defined_target.ext
93
- spec/dokkit/resource/test_data/doc/pages/document_with_one_target.ext
94
- spec/dokkit/resource/test_data/doc/pages/document_with_postfilter.ext
95
- spec/dokkit/resource/test_data/doc/pages/subdir/COMMON.yaml
96
- spec/dokkit/resource/test_data/doc/pages/subdir/document.ext
97
- spec/dokkit/resource/test_data/doc/pages/subdir/document.yaml
98
- spec/dokkit/tasklib/clean_spec.rb
99
- spec/dokkit/tasklib/render_spec.rb
100
- spec/dokkit/tasklib/test_data/doc/data/data_1
101
- spec/dokkit/tasklib/test_data/doc/pages/document_1
102
- spec/dokkit/tasklib/test_data/doc/pages/document_2
103
- spec/dokkit/test_data/dokkit/models/model1/doc/pages/model1
104
- spec/dokkit/test_data/dokkit/models/model2/doc/pages/model2
105
- spec/spec.opts
106
- spec/spec_helper.rb
107
49
  tasks/annotations.rake
108
50
  tasks/doc.rake
109
51
  tasks/gem.rake
data/lib/dokkit.rb CHANGED
@@ -51,5 +51,5 @@ rescue LoadError
51
51
  end
52
52
 
53
53
  module Dokkit
54
- VERSION = '0.4.1'
54
+ VERSION = '0.4.2'
55
55
  end
@@ -48,6 +48,18 @@ module Dokkit
48
48
  @cache ||= Cache.new
49
49
  end
50
50
 
51
+ def default_filter_chain
52
+ {
53
+ 'deplate' => { 'html' => ['erb', 'deplate-html'], 'latex' => ['erb', 'deplate-latex'], 'text' => ['erb', 'deplate-text']},
54
+ 'maruku' => { 'html' => ['erb', 'maruku-html'], 'latex' => ['erb', 'maruku-latex'], 'text' => ['erb', 'maruku-text']},
55
+ 'haml' => { 'html' => ['haml'] },
56
+ }
57
+ end
58
+
59
+ def default_postfilter_chain
60
+ { 'html' => ['erb'], 'latex' => ['erb'], 'text' => ['erb'] }
61
+ end
62
+
51
63
  # Return an OpenStruct object to setup documentation
52
64
  # directories. Instantiate the object only once.
53
65
  #
@@ -59,16 +71,17 @@ module Dokkit
59
71
  # configuration.cache_dir :: set/get cache folder.
60
72
  #
61
73
  def configuration
62
- @configuration ||= OpenStruct.new({
63
- :document_dir => 'doc/pages',
64
- :config_dir => 'doc/configs',
65
- :layout_dir => 'doc/layouts',
66
- :data_dir => 'doc/data',
67
- :output_dir => 'output',
68
- :cache_dir => '.cache'
69
- })
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 })
70
82
  end
71
83
 
84
+
72
85
  # Return a Dokkit::Environment::Helper::FileSelection object
73
86
  # with the list of documents in configuration.document_dir
74
87
  # folder and its subdir. The object is instantiated only
@@ -97,12 +110,14 @@ module Dokkit
97
110
  # Construct a filter factory and register filters.
98
111
  def filter_factory
99
112
  @filter_factory ||= Dokkit::Factory.new do |factory|
113
+ factory.add('nil' => lambda { Dokkit::Filter::Nil.new } )
100
114
  factory.add('erb' => lambda { |binding| Dokkit::Filter::ERB.new(binding) } )
101
115
  factory.add('tidy' => lambda { Dokkit::Filter::Tidy.new } )
102
116
  factory.add('maruku-html' => lambda { Dokkit::Filter::MarukuHTML.new } )
103
117
  factory.add('deplate-latex' => lambda { Dokkit::Filter::DeplateLatex.new } )
104
118
  factory.add('deplate-html' => lambda { Dokkit::Filter::DeplateHTML.new } )
105
119
  factory.add('deplate-text' => lambda { Dokkit::Filter::DeplateText.new } )
120
+ factory.add('haml' => lambda { |document| Dokkit::Filter::Haml.new(document) } )
106
121
  end
107
122
  end
108
123
 
@@ -11,3 +11,4 @@ require 'dokkit/filters/erb'
11
11
  require 'dokkit/filters/deplate'
12
12
  require 'dokkit/filters/maruku'
13
13
  require 'dokkit/filters/tidy'
14
+ require 'dokkit/filters/haml'
@@ -13,12 +13,12 @@ module Dokkit
13
13
 
14
14
  class ERB
15
15
 
16
- def initialize(binding)
17
- @binding = binding
16
+ def initialize(document)
17
+ @document = document
18
18
  end
19
19
 
20
20
  def filter(text)
21
- ::ERB.new(text).result(@binding)
21
+ ::ERB.new(text).result(@document.get_binding)
22
22
  end
23
23
 
24
24
  end
@@ -0,0 +1,31 @@
1
+ #
2
+ # File 'haml.rb' created on 04 ago 2008 at 17:05:24.
3
+ #
4
+ # See 'dokkit.rb' or +LICENSE+ for licence information.
5
+ #
6
+ # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
+ #
8
+
9
+ require 'haml'
10
+
11
+ module Dokkit
12
+ module Filter
13
+
14
+ class Haml
15
+
16
+ def initialize(document)
17
+ @document = document
18
+ end
19
+
20
+ def filter(text)
21
+ ::Haml::Engine.new(text).to_html(@document.get_binding)
22
+ end
23
+
24
+ end
25
+
26
+
27
+ end
28
+ end
29
+
30
+
31
+
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
  <link href="<%= relative('/html/css/style.css') %>" rel="stylesheet" type="text/css" media="screen" />
3
3
  <head>
4
- <title><%= @configuration['title'] %></title>
4
+ <title><%= title %></title>
5
5
  </head>
6
6
  <body>
7
7
  <%= @content_for_layout %>
@@ -23,24 +23,12 @@ module Dokkit
23
23
  # Includes the builtin extensions to be used by Document objects.
24
24
  include Extension::Builtin
25
25
 
26
- # Set the default filters chain for commonly used output format.
27
- DEFAULT_FILTERS_CHAIN = {
28
- 'html' => ['erb', 'deplate-html'],
29
- 'latex' => ['erb', 'deplate-latex'],
30
- 'text' => ['erb', 'deplate-text']
31
- }
32
- DEFAULT_POST_FILTERS_CHAIN = {
33
- 'html' => ['erb'],
34
- 'latex' => ['erb'],
35
- 'text' => ['erb']
36
- }
37
- attr_reader :configuration
38
26
  attr_reader :source_fn
39
27
  attr_reader :basename, :name_noext, :dirname, :relativename
40
28
  attr_reader :config_fns, :layout_fns, :target_fns
41
29
  attr_reader :targets, :layouts, :deps
42
- attr_reader :default_config_ext, :default_format
43
- attr_accessor :default_configuration_value
30
+ attr_reader :default_config_ext, :default_format, :default_formatter
31
+ attr_accessor :configuration, :default_configuration_value
44
32
 
45
33
  # Initialize a Document instance.
46
34
  # +source_fn+:: is the file name of the document source file.
@@ -66,23 +54,44 @@ module Dokkit
66
54
  # Get name relative to configuration.document_dir
67
55
  @relativename = filename_helper(@name_noext, configuration[:document_dir], '')
68
56
 
69
- # Set defaults
57
+ # Set default configuration file extension
70
58
  @default_config_ext = '.yaml'
59
+ # Set default output format
71
60
  @default_format = 'html'
61
+ # Set default input formatter format
62
+ @default_formatter = 'deplate'
72
63
 
64
+ @default_configuration_value = 'not defined'
65
+
73
66
  # yield self to an optional configuration block
74
67
  yield self if block_given?
75
68
 
76
69
  # Setup hashes
77
70
  setup_header_configuration
78
- setup_configuration_hash(configuration.recursive_merge('layout' => @relativename))
71
+ @configuration = configuration.recursive_merge('layout' => @relativename)
79
72
  setup_targets(@default_format)
80
73
 
81
74
  # Configure the document
82
75
  configure
76
+
77
+ @formatter = @configuration['formatter'] || @default_formatter
78
+
83
79
  collect_all
84
80
  end
85
81
 
82
+ def method_missing(meth)
83
+ if @configuration.has_key?(meth.to_s)
84
+ @configuration[meth.to_s]
85
+ else
86
+ @logger.warn("Configuration key '#{meth.to_s}' is not defined for #{source_fn}.")
87
+ @default_configuration_value
88
+ end
89
+ end
90
+
91
+ def get_binding
92
+ binding
93
+ end
94
+
86
95
  # Read the configuration file +fn+ and return:
87
96
  # * the resulting configuration hash
88
97
  # * an array containing the names of the read config files
@@ -111,33 +120,33 @@ module Dokkit
111
120
  end
112
121
  end
113
122
 
114
- # Return the filters chain associated with the given format.
115
- def filters_for(format)
116
- if @targets.has_key?(format)
117
- if @targets[format].has_key?('filter')
118
- @targets[format]['filter']
119
- elsif DEFAULT_FILTERS_CHAIN.has_key?(format)
120
- DEFAULT_FILTERS_CHAIN[format]
121
- end
122
- elsif DEFAULT_FILTERS_CHAIN.has_key?(format)
123
- DEFAULT_FILTERS_CHAIN[format]
123
+ def default_filter_chain_for(formatter, format)
124
+ @configuration[:default_filter_chain][formatter][format]
125
+ end
126
+
127
+ def default_postfilter_chain_for(format)
128
+ @configuration[:default_postfilter_chain][format]
129
+ end
130
+
131
+ def has_format?(format)
132
+ @targets.has_key?(format)
133
+ end
134
+
135
+ # Return the filters chain associated with the given formatter and output format.
136
+ def filters_for(formatter, format)
137
+ if has_format?(format)
138
+ process_filter_key('filter', format, default_filter_chain_for(formatter, format))
124
139
  else
125
- @logger.error("No defined filters chain for format '#{format}'!")
140
+ default_filter_chain_for(formatter, format)
126
141
  end
127
142
  end
128
143
 
129
144
  # Return the post filters chain associated with the given format.
130
145
  def post_filters_for(format)
131
- if @targets.has_key?(format)
132
- if @targets[format].has_key?('postfilter')
133
- @targets[format]['postfilter']
134
- elsif DEFAULT_POST_FILTERS_CHAIN.has_key?(format)
135
- DEFAULT_POST_FILTERS_CHAIN[format]
136
- end
137
- elsif DEFAULT_POST_FILTERS_CHAIN.has_key?(format)
138
- DEFAULT_POST_FILTERS_CHAIN[format]
146
+ if has_format?(format)
147
+ process_filter_key('postfilter', format, default_postfilter_chain_for(format))
139
148
  else
140
- @logger.error("No defined post filters chain for format '#{format}'!")
149
+ default_postfilter_chain_for(format)
141
150
  end
142
151
  end
143
152
 
@@ -152,14 +161,7 @@ module Dokkit
152
161
  def current_format
153
162
  @current_format || @default_format
154
163
  end
155
-
156
- def include(fn)
157
- @cache.add_dependency(source_fn, current_format, fn)
158
- erb = ERB.new(File.read(fn))
159
- erb.filename = fn
160
- erb.result
161
- end
162
-
164
+
163
165
  # Render the document in the specified format.
164
166
  def render(args = { })
165
167
  @current_format = args[:format]
@@ -169,7 +171,7 @@ module Dokkit
169
171
  @cache.add_dependency(source_fn, args[:format], document.source_fn)
170
172
  document.render(:format => args[:format])
171
173
  else
172
- do_render!(args[:format])
174
+ do_render!(@formatter, args[:format])
173
175
  end
174
176
  end
175
177
 
@@ -180,6 +182,10 @@ module Dokkit
180
182
 
181
183
  private
182
184
 
185
+ def process_filter_key(key, format, default_filter_chain)
186
+ @targets[format].has_key?(key) ? @targets[format][key] : default_filter_chain
187
+ end
188
+
183
189
  # Read the content of the source document file from disk.
184
190
  def read_source
185
191
  File.read(source_fn)
@@ -201,16 +207,6 @@ module Dokkit
201
207
  @config_fns << fn
202
208
  process_config_configuration_key if @configuration.has_key?('config')
203
209
  end
204
-
205
- # Setup configuration hash with initial value.
206
- def setup_configuration_hash(configuration)
207
- @default_configuration_value = "not defined"
208
- @configuration = Hash.new do |h, k|
209
- @logger.warn("Configuration key '#{k}' is not defined for #{source_fn}.")
210
- h[k] = @default_configuration_value
211
- end
212
- @configuration.merge! configuration
213
- end
214
210
 
215
211
  def setup_header_configuration
216
212
  @header_configuration = extract_configuration_from_source!
@@ -222,9 +218,9 @@ module Dokkit
222
218
  end
223
219
 
224
220
  # Render document in the given format.
225
- def do_render!(format)
221
+ def do_render!(formatter, format)
226
222
  if @targets[format]
227
- render_source!(format)
223
+ render_source!(formatter, format)
228
224
  render_all_layouts!(format)
229
225
  else
230
226
  @logger.error("Don't know how to render '#{source_fn}': format '#{format}' is unknown.")
@@ -233,8 +229,8 @@ module Dokkit
233
229
  end
234
230
 
235
231
  # Produce output from source.
236
- def render_source!(format)
237
- @content_for_layout = apply_filters(@source, filters_for(format), format) unless @source.nil?
232
+ def render_source!(formatter, format)
233
+ @content_for_layout = apply_filters(@source, filters_for(formatter, format), format) unless @source.nil?
238
234
  end
239
235
 
240
236
  def render_layout!(layout_fn, format)
@@ -272,7 +268,7 @@ module Dokkit
272
268
  @layouts[format] = []
273
269
 
274
270
  process_layout_configuration_key(format)
275
-
271
+
276
272
  @layouts[format].uniq!
277
273
  @layouts[format].compact!
278
274
  end
@@ -302,8 +298,8 @@ module Dokkit
302
298
  opts = format.values.first
303
299
  if opts
304
300
  ext = (opts['ext'] if opts.has_key?('ext')) || format_key
305
- filters = (opts['filter'] if opts.has_key?('filter')) || DEFAULT_FILTERS_CHAIN['html']
306
- post_filters = (opts['postfilter'] if opts.has_key?('postfilter')) || DEFAULT_POST_FILTERS_CHAIN['html']
301
+ filters = (opts['filter'] if opts.has_key?('filter')) || default_filter_chain_for(@formatter, 'html')
302
+ post_filters = (opts['postfilter'] if opts.has_key?('postfilter')) || default_postfilter_chain_for('html')
307
303
  { :target_fn => target_fn(ext.to_sym), 'filter' => filters, 'postfilter' => post_filters }
308
304
  else
309
305
  @logger.error("You must define format '#{format}'!")
@@ -379,7 +375,7 @@ module Dokkit
379
375
 
380
376
  # Apply filters on text to produce the given format.
381
377
  def apply_filters(text, filters_chain, format)
382
- filters_chain.collect { |filter| @filter_factory.get(filter, binding) }.inject(text) { |s, f| f.filter(s) }
378
+ filters_chain.collect { |filter| @filter_factory.get(filter, self) }.inject(text) { |s, f| f.filter(s) }
383
379
  end
384
380
 
385
381
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dokkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Fazzi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-27 00:00:00 +00:00
12
+ date: 2008-08-05 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -69,6 +69,7 @@ files:
69
69
  - lib/dokkit/filters.rb
70
70
  - lib/dokkit/filters/deplate.rb
71
71
  - lib/dokkit/filters/erb.rb
72
+ - lib/dokkit/filters/haml.rb
72
73
  - lib/dokkit/filters/maruku.rb
73
74
  - lib/dokkit/filters/nil.rb
74
75
  - lib/dokkit/filters/tidy.rb
@@ -97,65 +98,6 @@ files:
97
98
  - lib/dokkit/tasklib.rb
98
99
  - lib/dokkit/tasklib/clean.rb
99
100
  - lib/dokkit/tasklib/render.rb
100
- - spec/dokkit/application_spec.rb
101
- - spec/dokkit/cache/cache_spec.rb
102
- - spec/dokkit/dokkit_spec.rb
103
- - spec/dokkit/environment/basic_spec.rb
104
- - spec/dokkit/environment/helpers/extmap_spec.rb
105
- - spec/dokkit/environment/helpers/fileselection_spec.rb
106
- - spec/dokkit/environment/helpers/test_data/doc/pages/document_1.ext_1
107
- - spec/dokkit/environment/helpers/test_data/doc/pages/document_2
108
- - spec/dokkit/environment/helpers/test_data/doc/pages/document_3.ext_3
109
- - spec/dokkit/environment/test_data/doc/data/data
110
- - spec/dokkit/environment/test_data/doc/pages/document_1
111
- - spec/dokkit/environment/test_data/doc/pages/document_1.yaml
112
- - spec/dokkit/environment/test_data/doc/pages/document_2
113
- - spec/dokkit/environment/test_data/doc/pages/subdir/document_1
114
- - spec/dokkit/factory/factory_spec.rb
115
- - spec/dokkit/filters/deplate_spec.rb
116
- - spec/dokkit/filters/erb_spec.rb
117
- - spec/dokkit/filters/maruku_spec.rb
118
- - spec/dokkit/filters/nil_spec.rb
119
- - spec/dokkit/filters/tidy_spec.rb
120
- - spec/dokkit/hash_spec.rb
121
- - spec/dokkit/logging/logger_spec.rb
122
- - spec/dokkit/logging/observers/console_spec.rb
123
- - spec/dokkit/resource/data_spec.rb
124
- - spec/dokkit/resource/document_spec.rb
125
- - spec/dokkit/resource/extensions/html_spec.rb
126
- - spec/dokkit/resource/extensions/url_spec.rb
127
- - spec/dokkit/resource/filenamehelper_spec.rb
128
- - spec/dokkit/resource/test_data/doc/configs/config_1.yaml
129
- - spec/dokkit/resource/test_data/doc/configs/config_2.yaml
130
- - spec/dokkit/resource/test_data/doc/configs/required.yaml
131
- - spec/dokkit/resource/test_data/doc/configs/subdir/document.yaml
132
- - spec/dokkit/resource/test_data/doc/layouts/container.html
133
- - spec/dokkit/resource/test_data/doc/layouts/layout.html
134
- - spec/dokkit/resource/test_data/doc/layouts/layout.latex
135
- - spec/dokkit/resource/test_data/doc/layouts/nested/nested.html
136
- - spec/dokkit/resource/test_data/doc/layouts/subdir/document.html
137
- - spec/dokkit/resource/test_data/doc/layouts/subdir/document.latex
138
- - spec/dokkit/resource/test_data/doc/pages/COMMON.yaml
139
- - spec/dokkit/resource/test_data/doc/pages/document_with_many_config.ext
140
- - spec/dokkit/resource/test_data/doc/pages/document_with_many_errors.ext
141
- - spec/dokkit/resource/test_data/doc/pages/document_with_many_targets.ext
142
- - spec/dokkit/resource/test_data/doc/pages/document_with_nested_layout.ext
143
- - spec/dokkit/resource/test_data/doc/pages/document_with_nil_target.ext
144
- - spec/dokkit/resource/test_data/doc/pages/document_with_not_defined_target.ext
145
- - spec/dokkit/resource/test_data/doc/pages/document_with_one_target.ext
146
- - spec/dokkit/resource/test_data/doc/pages/document_with_postfilter.ext
147
- - spec/dokkit/resource/test_data/doc/pages/subdir/COMMON.yaml
148
- - spec/dokkit/resource/test_data/doc/pages/subdir/document.ext
149
- - spec/dokkit/resource/test_data/doc/pages/subdir/document.yaml
150
- - spec/dokkit/tasklib/clean_spec.rb
151
- - spec/dokkit/tasklib/render_spec.rb
152
- - spec/dokkit/tasklib/test_data/doc/data/data_1
153
- - spec/dokkit/tasklib/test_data/doc/pages/document_1
154
- - spec/dokkit/tasklib/test_data/doc/pages/document_2
155
- - spec/dokkit/test_data/dokkit/models/model1/doc/pages/model1
156
- - spec/dokkit/test_data/dokkit/models/model2/doc/pages/model2
157
- - spec/spec.opts
158
- - spec/spec_helper.rb
159
101
  - tasks/annotations.rake
160
102
  - tasks/doc.rake
161
103
  - tasks/gem.rake