Class: Bookwatch::Config::DitaConfigGenerator
- Inherits:
-
Object
- Object
- Bookwatch::Config::DitaConfigGenerator
- Defined in:
- lib/bookwatch/config/dita_config_generator.rb
Instance Method Summary collapse
- #ditamap_location ⇒ Object
-
#initialize(section_hash) ⇒ DitaConfigGenerator
constructor
A new instance of DitaConfigGenerator.
- #pdf_output_filename ⇒ Object
- #preprocessor_config ⇒ Object
- #subnav_template ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(section_hash) ⇒ DitaConfigGenerator
Returns a new instance of DitaConfigGenerator.
7 8 9 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 7 def initialize(section_hash) @section_hash = section_hash end |
Instance Method Details
#ditamap_location ⇒ Object
17 18 19 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 17 def ditamap_location section_hash['ditamap_location'] if section_hash['ditamap_location'] && !section_hash['ditamap_location'].empty? end |
#pdf_output_filename ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 21 def pdf_output_filename if present?(section_hash['output_filename']) filename = section_hash['output_filename'] elsif ditamap_location filename = ditamap_location.gsub(/\.ditamap/, '') else return end filename + '.pdf' end |
#preprocessor_config ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 33 def preprocessor_config { 'preprocessor_config' => { 'ditamap_location' => ditamap_location, 'ditaval_location' => section_hash['ditaval_location'] } } end |
#subnav_template ⇒ Object
11 12 13 14 15 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 11 def dest_dir = Ingest::DestinationDirectory.new(section_hash.fetch('repository', {})['name'], section_hash['directory']) "dita_subnav_#{dest_dir}" end |
#to_hash ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/bookwatch/config/dita_config_generator.rb', line 42 def to_hash section_hash.tap do |hash| hash.merge!(preprocessor_config) .merge!('subnav_template' => , 'output_filename' => pdf_output_filename) hash.delete('ditaval_location') hash.delete('ditamap_location') end end |