Class: IsoDoc::Mpfd::WordConvert

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

Overview

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

Constant Summary

Constants included from BaseConvert

BaseConvert::FRONT_CLAUSE, BaseConvert::SECTIONS_XPATH, BaseConvert::TERM_CLAUSE

Instance Method Summary collapse

Methods included from BaseConvert

#annex_name, #annex_name_lbl, #annex_names, #annex_names1, #annex_naming, #clause, #clause_names, #clause_parse_title, #container_names, #convert1, #fileloc, #i18n_init, #initial_anchor_names, #metadata_init, #middle, #ol_depth, #preface, #sect_names, #termdef_parse, #terms_defs, #terms_defs_title

Constructor Details

#initialize(options) ⇒ WordConvert

Returns a new instance of WordConvert.



9
10
11
12
# File 'lib/isodoc/mpfd/word_convert.rb', line 9

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

Instance Method Details

#default_file_locations(options) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/isodoc/mpfd/word_convert.rb', line 24

def default_file_locations(options)
  {
    htmlstylesheet: html_doc_path("htmlstyle.scss"),
    htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
    htmlintropage: html_doc_path("html_rsd_intro.html"),
    scripts: html_doc_path("scripts.html"),
    wordstylesheet: html_doc_path("wordstyle.scss"),
    standardstylesheet: html_doc_path("rsd.scss"),
    header: html_doc_path("header.html"),
    wordcoverpage: html_doc_path("word_rsd_titlepage.html"),
    wordintropage: html_doc_path("word_rsd_intro.html"),
    ulstyle: "l3",
    olstyle: "l2",
  }
end

#default_fonts(options) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/isodoc/mpfd/word_convert.rb', line 16

def default_fonts(options)
  {
    bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
    headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
    monospacefont: '"Courier New",monospace'
  }
end

#make_body(xml, docxml) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/isodoc/mpfd/word_convert.rb', line 40

def make_body(xml, docxml)
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
  xml.body **body_attr do |body|
    make_body1(body, docxml)
    make_body2(body, docxml)
    make_body3(body, docxml)
  end
end

#make_body2(body, docxml) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/isodoc/mpfd/word_convert.rb', line 49

def make_body2(body, docxml)
  body.div **{ class: "WordSection2" } do |div2|
    info docxml, div2
    abstract docxml, div2
    foreword docxml, div2
    introduction docxml, div2
    terms_defs docxml, div2, 0
    div2.p { |p| p << "&nbsp;" } # placeholder
  end
  section_break(body)
end