Class: Bookwatch::DitaCommandCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/bookwatch/dita_command_creator.rb

Constant Summary collapse

MissingDitaOTFlagValue =
Class.new(RuntimeError)

Instance Method Summary collapse

Constructor Details

#initialize(path_to_dita_ot_library) ⇒ DitaCommandCreator

Returns a new instance of DitaCommandCreator.



5
6
7
# File 'lib/bookwatch/dita_command_creator.rb', line 5

def initialize(path_to_dita_ot_library)
  @path_to_dita_ot_library = path_to_dita_ot_library
end

Instance Method Details

#convert_to_html_command(dita_section, dita_flags: nil, write_to: nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bookwatch/dita_command_creator.rb', line 21

def convert_to_html_command(dita_section, dita_flags: nil, write_to: nil)
  "export CLASSPATH=#{classpath}; " +
  "ant -f #{path_to_dita_ot_library} " +
    unduplicated_flags(
      write_to: write_to,
      dita_flags: dita_flags,
      ditamap_path: dita_section.path_to_preprocessor_attribute('ditamap_location'),
      ditaval_path: dita_section.path_to_preprocessor_attribute('ditaval_location'),
      default_transtype: 'tocjs'
  )
end

#convert_to_pdf_command(dita_section, dita_flags: nil, write_to: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bookwatch/dita_command_creator.rb', line 9

def convert_to_pdf_command(dita_section, dita_flags: nil, write_to: nil)
  "export CLASSPATH=#{classpath}; " +
  "ant -f #{path_to_dita_ot_library} " +
  unduplicated_flags(
    write_to: write_to,
    dita_flags: dita_flags,
    ditamap_path: dita_section.path_to_preprocessor_attribute('ditamap_location'),
    ditaval_path: dita_section.path_to_preprocessor_attribute('ditaval_location'),
    default_transtype: 'pdf2'
  )
end