Class: IsoDoc::Generic::WordConvert

Inherits:
WordConvert
  • Object
show all
Includes:
BaseConvert, Init
Defined in:
lib/isodoc/generic/word_convert.rb

Overview

A Converter implementation that generates Word output, and a document schema encapsulation of the document for validation

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Init

#i18n_init, #metadata_init, #xref_init

Methods included from Utils

#baselocation, #configuration, #fileloc

Methods included from BaseConvert

#cleanup, #info, #make_body, #term_cleanup

Constructor Details

#initialize(options) ⇒ WordConvert

Returns a new instance of WordConvert.



11
12
13
14
# File 'lib/isodoc/generic/word_convert.rb', line 11

def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
end

Class Attribute Details

._fileObject

Returns the value of attribute _file.



17
18
19
# File 'lib/isodoc/generic/word_convert.rb', line 17

def _file
  @_file
end

Class Method Details

.inherited(k) ⇒ Object



20
21
22
# File 'lib/isodoc/generic/word_convert.rb', line 20

def self.inherited(k)
  k._file = caller_locations(1..1).first.absolute_path
end

Instance Method Details

#default_file_locations(_options) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/isodoc/generic/word_convert.rb', line 48

def default_file_locations(_options)
  {
    wordstylesheet: baselocation(configuration.wordstylesheet) ||
      html_doc_path("wordstyle.scss"),
    standardstylesheet: baselocation(configuration.standardstylesheet) ||
      html_doc_path("generic.scss"),
    header: baselocation(configuration.header) ||
      html_doc_path("header.html"),
    wordcoverpage: baselocation(configuration.wordcoverpage) ||
      html_doc_path("word_generic_titlepage.html"),
    wordintropage: baselocation(configuration.wordintropage) ||
      html_doc_path("word_generic_intro.html"),
    i18nyaml: (if configuration.i18nyaml.is_a?(String)
                 baselocation(configuration.i18nyaml)
               end),
    ulstyle: "l3",
    olstyle: "l2",
  }.transform_values { |v| v&.empty? ? nil : v }
end

#default_fonts(options) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/isodoc/generic/word_convert.rb', line 24

def default_fonts(options)
  {
    bodyfont: (
      if options[:script] == "Hans"
        '"Source Han Sans",serif'
      else
        configuration.word_bodyfont || '"Arial",sans-serif'
      end
    ),
    headerfont: (
      if options[:script] == "Hans"
        '"Source Han Sans",sans-serif'
      else
        configuration.word_headerfont || '"Arial",sans-serif'
      end
    ),
    monospacefont: configuration.word_monospacefont || '"Courier New",monospace',
    normalfontsize: configuration.word_normalfontsize,
    smallerfontsize: configuration.word_smallerfontsize,
    footnotefontsize: configuration.word_footnotefontsize,
    monospacefontsize: configuration.word_monospacefontsize,
  }.transform_values { |v| v&.empty? ? nil : v }
end