Class: Bookwatch::Preprocessing::DitaHTMLPreprocessor
- Inherits:
-
Object
- Object
- Bookwatch::Preprocessing::DitaHTMLPreprocessor
- Defined in:
- lib/bookwatch/preprocessing/dita_html_preprocessor.rb
Constant Summary collapse
- DitaToHtmlLibraryFailure =
Class.new(RuntimeError)
- ACCEPTED_IMAGE_FORMATS =
%w(png jpeg jpg svg gif bmp tif tiff eps)
Instance Method Summary collapse
- #applicable_to?(section) ⇒ Boolean
-
#initialize(fs, subnav_gen_factory, dita_formatter, command_creator, sheller) ⇒ DitaHTMLPreprocessor
constructor
A new instance of DitaHTMLPreprocessor.
- #preprocess(sections, output_locations, options: {}, output_streams: nil, **_) ⇒ Object
Constructor Details
#initialize(fs, subnav_gen_factory, dita_formatter, command_creator, sheller) ⇒ DitaHTMLPreprocessor
Returns a new instance of DitaHTMLPreprocessor.
11 12 13 14 15 16 17 |
# File 'lib/bookwatch/preprocessing/dita_html_preprocessor.rb', line 11 def initialize(fs, , dita_formatter, command_creator, sheller) @fs = fs @subnav_gen_factory = @dita_formatter = dita_formatter @command_creator = command_creator @sheller = sheller end |
Instance Method Details
#applicable_to?(section) ⇒ Boolean
19 20 21 |
# File 'lib/bookwatch/preprocessing/dita_html_preprocessor.rb', line 19 def applicable_to?(section) section..include?('dita_subnav') if section. end |
#preprocess(sections, output_locations, options: {}, output_streams: nil, **_) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bookwatch/preprocessing/dita_html_preprocessor.rb', line 23 def preprocess(sections, output_locations, options: {}, output_streams: nil, **_) @output_locations = output_locations sections.each do |section| if section.path_to_preprocessor_attribute('ditamap_location') convert_dita_files(section, command_creator, [:dita_flags], section_html_dir(section), sheller, output_streams) .generate(section) end dita_formatter.format_html(section_html_dir(section), formatted_dir(section)) copy_images(section.path_to_repo_dir, formatted_dir(section)) fs.copy_contents(formatted_dir(section), source_for_site_gen_dir(section)) end end |