dokkit 0.4.4 → 0.5.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.
@@ -0,0 +1,35 @@
1
+ #
2
+ # File 'container.rb' created on 15 ago 2008 at 15:16:11.
3
+ #
4
+ # See 'dokkit.rb' or +LICENSE+ for license information.
5
+ #
6
+ # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
+ #
8
+
9
+ module Dokkit
10
+ module Environment
11
+
12
+ class Container
13
+
14
+ def initialize
15
+ @registry = { }
16
+ @instances = { }
17
+ end
18
+
19
+ def method_missing(meth)
20
+ self[meth]
21
+ end
22
+
23
+ def [](service_name)
24
+ @instances[service_name] || (@instances[service_name] = @registry[service_name].call)
25
+ end
26
+
27
+ def register(service_name, &blk)
28
+ @instances[service_name] = nil
29
+ @registry[service_name] = blk
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+ end
@@ -6,6 +6,7 @@
6
6
  # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
7
  #
8
8
 
9
+ require 'ostruct'
9
10
  require 'dokkit/environment/helpers/fileselection'
10
11
  require 'dokkit/environment/helpers/extmap'
11
12
 
@@ -14,7 +15,49 @@ module Dokkit
14
15
  # Collect helper class that simplify the setup of
15
16
  # documentation environment.
16
17
  module Helper
18
+
19
+ def configure(&blk)
20
+
21
+ yield ostruct = OpenStruct.new
22
+
23
+ register :configuration do
24
+ OpenStruct.new(default_configuration.merge(ostruct.marshal_dump))
25
+ end
26
+
27
+ end
17
28
 
29
+ def select_document(&blk)
30
+
31
+ yield new_fs = document_fs
32
+
33
+ register :document_fs do
34
+ FileSelection.new(configuration.document_dir) do |fs|
35
+ fs.include(*new_fs.includes)
36
+ fs.exclude(*new_fs.excludes)
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ def select_data(&blk)
43
+
44
+ yield new_fs = data_fs
45
+
46
+ register :data_fs do
47
+ FileSelection.new(configuration.data_dir) do |fs|
48
+ fs.include(*new_fs.includes)
49
+ fs.exclude(*new_fs.excludes)
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ def extend_document(glob, extension)
56
+ FileSelection.new(configuration.document_dir).include(glob).files.each do |document_fn|
57
+ @extmap[document_fn] = extension
58
+ end
59
+ end
60
+
18
61
  end
19
62
  end
20
63
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # File 'fileselection.rb' created on 01 mag 2008 at 16:31:18.
3
3
  #
4
- # See 'dokkit.rb' or +LICENSE+ for licence information.
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
  #
@@ -11,6 +11,7 @@ require 'rake'
11
11
  module Dokkit
12
12
  module Environment
13
13
  module Helper
14
+
14
15
  # FileSelection encapsulates the behaviour of Rake::FileList
15
16
  # class. Objects of class FileSelection are capable to return
16
17
  # the list of file in a directory. Objects are initialized with
@@ -18,8 +19,10 @@ module Dokkit
18
19
  # FileSelection#include and FileSelection#exclude instance
19
20
  # methods.
20
21
  class FileSelection
21
- attr_reader :base_dir
22
+
23
+ attr_reader :base_dir, :includes, :excludes
22
24
  alias :dir :base_dir
25
+
23
26
  # Initialize a FileSelection object.
24
27
  # base_dir :: the base dir for all inclusion/exclusion operations.
25
28
  def initialize(base_dir = '.')
@@ -28,25 +31,33 @@ module Dokkit
28
31
  @excludes = []
29
32
  yield self if block_given?
30
33
  end
34
+
31
35
  # Include files to the list.
32
36
  # patterns :: array of glob patterns
33
37
  def include(*patterns)
38
+ @includes.clear
34
39
  patterns.each { |pattern| @includes << pattern }
35
40
  self
36
41
  end
42
+
37
43
  # Exclude files from the list.
38
44
  # patterns :: array of glob patterns
39
45
  def exclude(*patterns)
46
+ @excludes.clear
40
47
  patterns.each { |pattern| @excludes << pattern }
41
48
  self
42
49
  end
50
+
43
51
  # Return an array containing the file list.
44
52
  def files
45
- FileList.new(@base_dir) do |fl|
46
- fl.exclude *@excludes.collect { |exclude| File.join(@base_dir, exclude) } unless @excludes.empty?
47
- fl.include *@includes.collect { |include| File.join(@base_dir, include) } unless @includes.empty?
48
- end.uniq.select { |fn| not File.directory?(fn) }
53
+ if File.exists?(@base_dir)
54
+ FileList.new(@base_dir) do |fl|
55
+ fl.exclude *@excludes.collect { |exclude| File.join(@base_dir, exclude) } unless @excludes.empty?
56
+ fl.include *@includes.collect { |include| File.join(@base_dir, include) } unless @includes.empty?
57
+ end.uniq.select { |fn| not File.directory?(fn) }
58
+ end
49
59
  end
60
+
50
61
  end
51
62
  end
52
63
  end
@@ -27,11 +27,11 @@ module Dokkit
27
27
  #
28
28
  # Example:
29
29
  #
30
- # factory.add(:bar => bar_factory_method) # add a method that
31
- # # instantiates Bar object
30
+ # factory.add(:bar) { Bar.new } # add a method that
31
+ # # instantiates Bar object
32
32
  #
33
- def add(factory_method)
34
- @methods.merge! factory_method
33
+ def add(key, &factory_method)
34
+ @methods[key] = factory_method
35
35
  end
36
36
 
37
37
  # Construct an instance for the given class. Note that, if an
@@ -12,3 +12,4 @@ require 'dokkit/filters/deplate'
12
12
  require 'dokkit/filters/maruku'
13
13
  require 'dokkit/filters/tidy'
14
14
  require 'dokkit/filters/haml'
15
+ require 'dokkit/filters/yaml'
@@ -18,7 +18,15 @@ module Dokkit
18
18
  end
19
19
 
20
20
  end
21
-
21
+
22
+ class MarukuLatex
23
+
24
+ def filter(text)
25
+ Maruku.new(text).to_latex
26
+ end
27
+
28
+ end
29
+
22
30
  end
23
31
  end
24
32
 
@@ -0,0 +1,26 @@
1
+ #
2
+ # File 'yaml.rb' created on 18 ago 2008 at 14:56:12.
3
+ #
4
+ # See 'dokkit.rb' or +LICENSE+ for license information.
5
+ #
6
+ # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
+ #
8
+
9
+ require 'yaml'
10
+
11
+ module Dokkit
12
+ module Filter
13
+ class YAML
14
+
15
+ def initialize(document)
16
+ @document = document
17
+ end
18
+
19
+ def filter(text)
20
+ @document.configuration.recursive_merge! ::YAML::load(text)
21
+ nil
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # File 'logging.rb' created on 04 mag 2008 at 17:39:01.
3
3
  #
4
- # See 'dokkit.rb' or +LICENSE+ for licence information.
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
  #
@@ -6,6 +6,8 @@
6
6
  # (C) 2006, 2007, 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
7
  #
8
8
 
9
+ require 'rubygems'
10
+
9
11
  require 'yaml'
10
12
  require 'erb'
11
13
  require 'dokkit/hash'
@@ -18,140 +20,58 @@ module Dokkit
18
20
  # instances are usually created on demand by
19
21
  # Dokkit::Resource::Factory.
20
22
  class Document
21
- include FilenameHelper
22
-
23
- # Includes the builtin extensions to be used by Document objects.
24
- include Extension::Builtin
23
+ include FilenameHelper, Extension::Builtin
24
+
25
+ attr_accessor :logger, :cache, :resource_factory, :filter_factory
25
26
 
26
- attr_reader :source_fn
27
- attr_reader :basename, :name_noext, :dirname, :relativename
28
- attr_reader :config_fns, :layout_fns, :target_fns
29
- attr_reader :targets, :layouts, :deps
30
- attr_reader :default_config_ext, :default_format, :default_formatter
31
- attr_accessor :configuration, :default_configuration_value
27
+ attr_reader :source_fn, :env_configuration, :configuration
28
+ attr_reader :configs, :targets, :layouts, :deps
29
+ attr_reader :formatter, :format
32
30
 
33
31
  # Initialize a Document instance.
34
32
  # +source_fn+:: is the file name of the document source file.
35
33
  # +configuration+:: is the configuration hash to be associated with the document.
36
34
  # +logger+:: is the logger instance.
37
35
  # +cache+:: is the cache manager instance.
38
- def initialize(source_fn, configuration, logger, cache, resource_factory, filter_factory, &blk)
39
- @source_fn, @logger, @cache, @resource_factory, @filter_factory = source_fn, logger, cache, resource_factory, filter_factory
40
- @config_fns = []
41
- @targets = { }
42
- @layouts = { }
43
- @deps = { }
44
-
45
- # Get basename stripping out path and extension from +source_fn+
46
- @basename = File.basename(source_fn, File.extname(source_fn))
47
-
48
- # Get the directory part of source_fn
49
- @dirname = File.dirname(source_fn)
36
+ def initialize(source_fn, env_configuration, &blk)
37
+ @source_fn = source_fn
38
+ @env_configuration = env_configuration
50
39
 
51
- # Set the document name with path but without extension
52
- @name_noext = File.join(@dirname, @basename)
53
-
54
- # Get name relative to configuration.document_dir
55
- @relativename = filename_helper(@name_noext, configuration[:document_dir], '')
56
-
57
- # Set default configuration file extension
58
- @default_config_ext = '.yaml'
59
- # Set default output format
60
- @default_format = 'html'
61
- # Set default input formatter format
62
- @default_formatter = 'deplate'
40
+ reconfigure(&blk)
41
+ end
42
+
43
+ def config(config_fn)
44
+ reconfigure('config' => config_fn)
45
+ end
46
+
47
+ def layout(layout_fn)
48
+ reconfigure('layout' => layout_fn)
49
+ end
50
+
51
+ def reconfigure(configuration = { }, &blk)
52
+ init_default(configuration)
63
53
 
64
- @default_configuration_value = 'not defined'
65
-
66
- # yield self to an optional configuration block
67
54
  yield self if block_given?
68
55
 
69
- # Setup hashes
70
- setup_header_configuration
71
- @configuration = configuration.recursive_merge('layout' => @relativename)
72
- setup_targets(@default_format)
73
-
74
- # Configure the document
75
56
  configure
76
-
77
- @formatter = @configuration['formatter'] || @default_formatter
78
-
79
- collect_all
80
57
  end
81
58
 
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
59
  def get_binding
92
60
  binding
93
61
  end
94
62
 
95
- # Read the configuration file +fn+ and return:
96
- # * the resulting configuration hash
97
- # * an array containing the names of the read config files
98
- # If +fn+ contains configuration data in the
99
- # header then this method extract it. Note that the method read
100
- # *recursively* the configuration file specified in config key
101
- # loading it from config_dir folder.
102
- # For example:
103
- #
104
- # ---
105
- # key: value
106
- # config: required
107
- #
108
- #
109
- # The resulting configuration hash will be the key/value pair
110
- # *plus* the configuration in +config_dir/required.yaml+.
111
- def add_config(fn)
112
- File.exists?(fn) ? merge_configuration_file(fn) : @logger.error("Configuration file '#{fn}' not found for '#{@source_fn}'!")
113
- end
114
-
115
- def add_layout(name, format = @default_format)
116
- if File.exists?(get_layout_filename(name, format))
117
- @layouts[format] << get_layout_filename(name, format)
118
- else
119
- @logger.warn("Layout file '#{get_layout_filename(name, format)}' does not exists for '#{source_fn}'!")
120
- end
121
- end
122
-
123
- def default_filter_chain_for(formatter, format)
124
- if @configuration[:default_filter_chain][formatter].has_key?(format)
125
- @configuration[:default_filter_chain][formatter][format]
126
- else
127
- @logger.error("Output format '#{format}' is not available for '#{formatter}' formatter.")
128
- end
129
- end
130
-
131
- def default_postfilter_chain_for(format)
132
- @configuration[:default_postfilter_chain][format]
133
- end
134
-
135
63
  def has_format?(format)
136
64
  @targets.has_key?(format)
137
65
  end
138
66
 
139
67
  # Return the filters chain associated with the given formatter and output format.
140
- def filters_for(formatter, format)
141
- if has_format?(format)
142
- process_filter_key('filter', format, default_filter_chain_for(formatter, format))
143
- else
144
- default_filter_chain_for(formatter, format)
145
- end
68
+ def filters_for(format, formatter = @formatter)
69
+ process_filter_key('filter', format) || default_filter_chain_for(formatter, format)
146
70
  end
147
71
 
148
72
  # Return the post filters chain associated with the given format.
149
73
  def post_filters_for(format)
150
- if has_format?(format)
151
- process_filter_key('postfilter', format, default_postfilter_chain_for(format))
152
- else
153
- default_postfilter_chain_for(format)
154
- end
74
+ process_filter_key('postfilter', format) || default_postfilter_chain_for(format)
155
75
  end
156
76
 
157
77
  def target_for(format)
@@ -162,32 +82,104 @@ module Dokkit
162
82
  @deps[format]
163
83
  end
164
84
 
165
- def current_format
85
+ def format
166
86
  @current_format || @default_format
167
87
  end
168
-
88
+
89
+ def render?
90
+ if @configuration.has_key?('render')
91
+ return false unless @configuration['render']
92
+ end
93
+ true
94
+ end
95
+
169
96
  # Render the document in the specified format.
170
97
  def render(args = { })
171
- @current_format = args[:format]
172
- args = { :format => @default_format }.merge args
173
- if args.has_key?(:document)
174
- document = @resource_factory.get(:document, args[:document])
175
- @cache.add_dependency(source_fn, args[:format], document.source_fn)
176
- document.render(:format => args[:format])
98
+ if args[:format].nil?
99
+ unless @current_format
100
+ args = { :format => @default_format }.merge args
101
+ @current_format = args[:format]
102
+ end
177
103
  else
178
- do_render!(@formatter, args[:format])
104
+ @current_format = args[:format]
179
105
  end
106
+ args.has_key?(:partial) ? render_partial(args[:partial], @current_format) : do_render!(@formatter, @current_format)
180
107
  end
181
108
 
182
109
  # Return the content of the source document file.
183
110
  def source
184
111
  @source ||= read_source
185
112
  end
186
-
113
+
187
114
  private
188
115
 
189
- def process_filter_key(key, format, default_filter_chain)
190
- @targets[format].has_key?(key) ? @targets[format][key] : default_filter_chain
116
+ def method_missing(meth)
117
+ if @configuration.has_key?(meth.to_s)
118
+ @configuration[meth.to_s]
119
+ else
120
+ @logger.warn("Configuration key '#{meth.to_s}' is not defined for #{source_fn}.")
121
+ @default_configuration_value
122
+ end
123
+ end
124
+
125
+ def init_default(configuration)
126
+ @configs = []
127
+ @targets = { }
128
+ @layouts = { }
129
+ @deps = { }
130
+
131
+ @default_config_ext = '.yaml'
132
+ @default_format = 'html'
133
+ @default_formatter = 'deplate'
134
+ @default_configuration_value = 'not defined'
135
+ @configuration = { 'layout' => relative_name }.merge configuration
136
+ @configuration['render'] = false if basename =~ /^_/
137
+ end
138
+
139
+ # Get basename stripping out path and extension from +source_fn+
140
+ def basename
141
+ File.basename(source_fn, File.extname(source_fn))
142
+ end
143
+
144
+ # Get the directory part of source_fn
145
+ def dirname
146
+ File.dirname(source_fn)
147
+ end
148
+
149
+ def name_noext
150
+ File.join(dirname, basename)
151
+ end
152
+
153
+ # Get name relative to configuration.document_dir
154
+ def relative_name
155
+ filename_helper(name_noext, @env_configuration[:document_dir], '')
156
+ end
157
+
158
+ def add_config(fn)
159
+ File.exists?(fn) ? merge_configuration_file(fn) : @logger.error("Configuration file '#{fn}' not found for '#{@source_fn}'!")
160
+ end
161
+
162
+ def add_layout(name, format = @default_format)
163
+ if File.exists?(get_layout_filename(name, format))
164
+ @layouts[format] << get_layout_filename(name, format)
165
+ else
166
+ @logger.debug("Layout file '#{get_layout_filename(name, format)}' does not exist for '#{source_fn}'.")
167
+ end
168
+ end
169
+
170
+ def default_filter_chain_for(formatter, format)
171
+ @env_configuration[:default_filter_chain][formatter][format]
172
+ end
173
+
174
+ def default_postfilter_chain_for(format)
175
+ @env_configuration[:default_postfilter_chain][format]
176
+ end
177
+
178
+ # @logger.error("Output format '#{format}' is not available for '#{formatter}' formatter.")
179
+ # @logger.error("Formatter '#{formatter}' is not available.")
180
+
181
+ def process_filter_key(key, format)
182
+ @targets.has_key?(format) ? @targets[format][key] : nil
191
183
  end
192
184
 
193
185
  # Read the content of the source document file from disk.
@@ -200,7 +192,7 @@ module Dokkit
200
192
  end
201
193
 
202
194
  def load_config_file(fn)
203
- config_fn = File.join(@configuration[:config_dir], fn)
195
+ config_fn = File.join(@env_configuration[:config_dir], fn)
204
196
  config_fn += @default_config_ext if File.extname(config_fn).empty?
205
197
  @configuration.delete('config')
206
198
  add_config(config_fn)
@@ -208,7 +200,7 @@ module Dokkit
208
200
 
209
201
  def merge_configuration_file(fn)
210
202
  fn == @source_fn ? @configuration.recursive_merge!(@header_configuration) : @configuration.recursive_merge!(YAML::load_file(fn))
211
- @config_fns << fn
203
+ @configs << fn
212
204
  process_config_configuration_key if @configuration.has_key?('config')
213
205
  end
214
206
 
@@ -223,24 +215,27 @@ module Dokkit
223
215
 
224
216
  # Render document in the given format.
225
217
  def do_render!(formatter, format)
226
- if @targets[format]
227
- render_source!(formatter, format)
228
- render_all_layouts!(format)
229
- else
230
- @logger.error("Don't know how to render '#{source_fn}': format '#{format}' is unknown.")
231
- end
218
+ render_source!(formatter, format)
219
+ render_all_layouts!(format)
232
220
  @content_for_layout
233
221
  end
234
222
 
235
223
  # Produce output from source.
236
224
  def render_source!(formatter, format)
237
- @content_for_layout = apply_filters(@source, filters_for(formatter, format), format) unless @source.nil?
225
+ @content_for_layout = apply_filters(@source, filters_for(format, formatter), format) unless @source.nil?
238
226
  end
239
227
 
240
228
  def render_layout!(layout_fn, format)
241
229
  @content_for_layout = apply_filters(File.read(layout_fn), post_filters_for(format), format) unless File.read(layout_fn).nil?
242
230
  end
243
231
 
232
+ def render_partial(source_fn, format)
233
+ basename, dirname = '_' + File.basename(source_fn), File.dirname(source_fn)
234
+ partial_fn = File.join(@env_configuration[:document_dir], File.join(dirname, basename))
235
+ @cache.add_dependency(@source_fn, format, partial_fn)
236
+ @resource_factory.get(:document, partial_fn).render(:format => format)
237
+ end
238
+
244
239
  # Injects rendered content from +source_fn+ in the layout chain.
245
240
  def render_all_layouts!(format)
246
241
  @layouts[format].each { |layout_fn| render_layout!(layout_fn, format) } unless !@layouts[format] || @layouts[format].empty?
@@ -260,10 +255,18 @@ module Dokkit
260
255
  # 3. configuration in COMMON.yaml file (or files) exist.
261
256
  # 4. configuration in doc/configs/+basename+.yaml if file exists.
262
257
  def configure # :doc:
258
+ setup_header_configuration
259
+ setup_targets(@default_format)
260
+
263
261
  add_config(config_fn_relative_to(:config_dir)) if File.exists?(config_fn_relative_to(:config_dir))
264
262
  add_common_config
265
263
  add_config(config_fn_relative_to(:document_dir)) if File.exists?(config_fn_relative_to(:document_dir))
266
264
  add_config(@source_fn) if @header_configuration
265
+
266
+ @formatter = @configuration['formatter'] || @default_formatter
267
+
268
+ collect_all
269
+ @configuration
267
270
  end
268
271
 
269
272
  # Collect the layout files traversing +targets+ hash.
@@ -284,7 +287,7 @@ module Dokkit
284
287
  end
285
288
 
286
289
  def get_layout_filename(name, format)
287
- File.join(@configuration[:layout_dir], name + ".#{format.to_s}")
290
+ File.join(@env_configuration[:layout_dir], name + ".#{format.to_s}")
288
291
  end
289
292
 
290
293
  # Process +format+ key in configuration hash.
@@ -300,14 +303,10 @@ module Dokkit
300
303
  def process_format_configuration_key(format)
301
304
  format_key = format.keys.first
302
305
  opts = format.values.first
303
- if opts
304
- ext = (opts['ext'] if opts.has_key?('ext')) || format_key
305
- filters = (opts['filter'] if opts.has_key?('filter')) || default_filter_chain_for(@formatter, 'html')
306
- post_filters = (opts['postfilter'] if opts.has_key?('postfilter')) || default_postfilter_chain_for('html')
307
- { :target_fn => target_fn(ext.to_sym), 'filter' => filters, 'postfilter' => post_filters }
308
- else
309
- @logger.error("You must define format '#{format}'!")
310
- end
306
+ ext = (opts['ext'] if opts.has_key?('ext')) || format_key
307
+ filters = (opts['filter'] if opts.has_key?('filter')) || default_filter_chain_for(@formatter, 'html')
308
+ post_filters = (opts['postfilter'] if opts.has_key?('postfilter')) || default_postfilter_chain_for('html')
309
+ { :target_fn => target_fn(ext.to_sym), 'filter' => filters, 'postfilter' => post_filters }
311
310
  end
312
311
 
313
312
  # Iterates through configuration +:targets+ key (if
@@ -321,7 +320,7 @@ module Dokkit
321
320
  @targets.each do |format, target|
322
321
  @deps[format] = []
323
322
  @deps[format] << @source_fn # the essential dependency from source file
324
- @deps[format].concat @config_fns # dependency from configuration files
323
+ @deps[format].concat @configs # dependency from configuration files
325
324
  @deps[format].concat @layouts[format] if @layouts.has_key?(format) # dependency from layout files
326
325
  @deps[format].concat @cache.deps[source_fn][format] if @cache.deps[source_fn] and @cache.deps[source_fn][format]
327
326
  @deps[format].uniq! # remove duplicates
@@ -340,7 +339,7 @@ module Dokkit
340
339
 
341
340
  # Configure from commons configuration files.
342
341
  def add_common_config
343
- resolve_common_configs(@dirname).reverse.each do |file|
342
+ resolve_common_configs(dirname).reverse.each do |file|
344
343
  add_config(file)
345
344
  end
346
345
  end
@@ -362,7 +361,7 @@ module Dokkit
362
361
  # config_fn #=> 'doc/configs/subdir/document.yaml'
363
362
  #
364
363
  def config_fn_relative_to(dir_config_key)
365
- filename_helper(@name_noext, @configuration[:document_dir], @configuration[dir_config_key], @default_config_ext)
364
+ filename_helper(name_noext, @env_configuration[:document_dir], @env_configuration[dir_config_key], @default_config_ext)
366
365
  end
367
366
 
368
367
  # Return target filename for a given format.
@@ -370,11 +369,11 @@ module Dokkit
370
369
  # Example:
371
370
  #
372
371
  # source_fn = 'doc/pages/document.ext'
373
- # format = :html
372
+ # format = 'html'
374
373
  # target_fn(format) #=> 'output/document.html'
375
374
  #
376
375
  def target_fn(format)
377
- filename_helper(@name_noext, @configuration[:document_dir], @configuration[:output_dir], ".#{format.to_s}")
376
+ filename_helper(name_noext, @env_configuration[:document_dir], @env_configuration[:output_dir], ".#{format.to_s}")
378
377
  end
379
378
 
380
379
  # Apply filters on text to produce the given format.