lib/dokkit/environment/basic.rb in dokkit-0.4.1 vs lib/dokkit/environment/basic.rb in dokkit-0.4.2
- old
+ new
@@ -46,10 +46,22 @@
# Setup cache.
def cache
@cache ||= Cache.new
end
+ def default_filter_chain
+ {
+ 'deplate' => { 'html' => ['erb', 'deplate-html'], 'latex' => ['erb', 'deplate-latex'], 'text' => ['erb', 'deplate-text']},
+ 'maruku' => { 'html' => ['erb', 'maruku-html'], 'latex' => ['erb', 'maruku-latex'], 'text' => ['erb', 'maruku-text']},
+ 'haml' => { 'html' => ['haml'] },
+ }
+ end
+
+ def default_postfilter_chain
+ { 'html' => ['erb'], 'latex' => ['erb'], 'text' => ['erb'] }
+ end
+
# Return an OpenStruct object to setup documentation
# directories. Instantiate the object only once.
#
# configuration.document_dir :: set/get documents folder.
# configuration.config_dir :: set/get configs folder.
@@ -57,20 +69,21 @@
# configuration.data_dir :: set/get data folder.
# configuration.output_dir :: set/get output folder.
# configuration.cache_dir :: set/get cache folder.
#
def configuration
- @configuration ||= OpenStruct.new({
- :document_dir => 'doc/pages',
- :config_dir => 'doc/configs',
- :layout_dir => 'doc/layouts',
- :data_dir => 'doc/data',
- :output_dir => 'output',
- :cache_dir => '.cache'
- })
+ @configuration ||= OpenStruct.new({ :document_dir => 'doc/pages',
+ :config_dir => 'doc/configs',
+ :layout_dir => 'doc/layouts',
+ :data_dir => 'doc/data',
+ :output_dir => 'output',
+ :cache_dir => '.cache',
+ :default_filter_chain => default_filter_chain,
+ :default_postfilter_chain => default_postfilter_chain })
end
+
# Return a Dokkit::Environment::Helper::FileSelection object
# with the list of documents in configuration.document_dir
# folder and its subdir. The object is instantiated only
# once. By default all files in configuration.document_dir and
# subdirs are included.
@@ -95,15 +108,17 @@
end
# Construct a filter factory and register filters.
def filter_factory
@filter_factory ||= Dokkit::Factory.new do |factory|
+ factory.add('nil' => lambda { Dokkit::Filter::Nil.new } )
factory.add('erb' => lambda { |binding| Dokkit::Filter::ERB.new(binding) } )
factory.add('tidy' => lambda { Dokkit::Filter::Tidy.new } )
factory.add('maruku-html' => lambda { Dokkit::Filter::MarukuHTML.new } )
factory.add('deplate-latex' => lambda { Dokkit::Filter::DeplateLatex.new } )
factory.add('deplate-html' => lambda { Dokkit::Filter::DeplateHTML.new } )
factory.add('deplate-text' => lambda { Dokkit::Filter::DeplateText.new } )
+ factory.add('haml' => lambda { |document| Dokkit::Filter::Haml.new(document) } )
end
end
# Construct a resource factory to get resource instances
# (i.e. document and data). The object is instantiated only