Class: IsoDoc::MPFA::WordConvert

Inherits:
WordConvert
  • Object
show all
Includes:
BaseConvert, Init
Defined in:
lib/isodoc/mpfa/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 Init

#fileloc, #i18n_init, #metadata_init, #xref_init

Methods included from BaseConvert

#clause, #clause_parse_title, #middle, #middle_clause, #ol_depth, #preface, #termdef_parse, #terms_defs

Constructor Details

#initialize(options) ⇒ WordConvert

Returns a new instance of WordConvert.



10
11
12
13
# File 'lib/isodoc/mpfa/word_convert.rb', line 10

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

Instance Method Details

#default_file_locations(options) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/isodoc/mpfa/word_convert.rb', line 29

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"),
    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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/isodoc/mpfa/word_convert.rb', line 17

def default_fonts(options)
  {
    bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : '"Arial",sans-serif'),
    headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Arial",sans-serif'),
    monospacefont: '"Courier New",monospace',
    normalfontsize: "10.5pt",
    monospacefontsize: "10.0pt",
    footnotefontsize: "10.0pt",
    smallerfontsize: "10.0pt",
  }
end

#make_body(xml, docxml) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/isodoc/mpfa/word_convert.rb', line 44

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



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/isodoc/mpfa/word_convert.rb', line 53

def make_body2(body, docxml)
  body.div **{ class: "WordSection2" } do |div2|
    info docxml, div2
    #preface_block 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