Class: IsoDoc::Iso::WordConvert
- Inherits:
-
WordConvert
- Object
- WordConvert
- IsoDoc::Iso::WordConvert
show all
- Includes:
- BaseConvert
- Defined in:
- lib/isodoc/iso/word_convert.rb
Instance Method Summary
collapse
#annex_names, #annex_names1, #appendix_names, #clausedelim, #eref_localities1, #eref_localities1_zh, #error_parse, #example_p_parse, #example_parse, #example_parse1, #example_span_label, #foreword, #implicit_reference, #initial_anchor_names, #introduction, #introduction_names, #metadata_init, #node_begins_with_para, #prefix_container, #section_names1, #term_parse, #termexamples_before_termnotes
Constructor Details
#initialize(options) ⇒ WordConvert
Returns a new instance of WordConvert.
8
9
10
11
|
# File 'lib/isodoc/iso/word_convert.rb', line 8
def initialize(options)
@libdir = File.dirname(__FILE__)
super
end
|
Instance Method Details
#colophon(body, docxml) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/isodoc/iso/word_convert.rb', line 47
def colophon(body, docxml)
stage = @meta.get[:stage_int]
return if !stage.nil? && stage < 60
body.br **{ clear: "all", style: "page-break-before:left;mso-break-type:section-break" }
body.div **{ class: "colophon" } do |div|
end
end
|
#default_file_locations(options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/isodoc/iso/word_convert.rb', line 21
def default_file_locations(options)
{
htmlstylesheet: options[:alt] ? html_doc_path("style-human.scss") : html_doc_path("style-iso.scss"),
htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
htmlintropage: html_doc_path("html_iso_intro.html"),
scripts: html_doc_path("scripts.html"),
wordstylesheet: html_doc_path("wordstyle.scss"),
standardstylesheet: html_doc_path("isodoc.scss"),
header: html_doc_path("header.html"),
wordcoverpage: html_doc_path("word_iso_titlepage.html"),
wordintropage: html_doc_path("word_iso_intro.html"),
ulstyle: "l3",
olstyle: "l2",
}
end
|
#default_fonts(options) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/isodoc/iso/word_convert.rb', line 13
def default_fonts(options)
{
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Cambria",serif'),
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Cambria",serif'),
monospacefont: '"Courier New",monospace',
}
end
|
55
56
57
58
59
60
61
62
|
# File 'lib/isodoc/iso/word_convert.rb', line 55
def figure_cleanup(docxml)
super
docxml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
t["class"] = "figdl"
d = t.add_previous_sibling("<div class='figdl'/>")
t.parent = d.first
end
end
|
#make_body(xml, docxml) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/isodoc/iso/word_convert.rb', line 37
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)
colophon(body, docxml)
end
end
|
#word_annex_cleanup(docxml) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/isodoc/iso/word_convert.rb', line 72
def word_annex_cleanup(docxml)
word_annex_cleanup1(docxml, 2)
word_annex_cleanup1(docxml, 3)
word_annex_cleanup1(docxml, 4)
word_annex_cleanup1(docxml, 5)
word_annex_cleanup1(docxml, 6)
end
|
#word_annex_cleanup1(docxml, i) ⇒ Object
force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
65
66
67
68
69
70
|
# File 'lib/isodoc/iso/word_convert.rb', line 65
def word_annex_cleanup1(docxml, i)
docxml.xpath("//h#{i}[ancestor::*[@class = 'Section3']]").each do |h2|
h2.name = "p"
h2["class"] = "h#{i}Annex"
end
end
|