isodoc 1.7.5 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +8 -7
  3. data/lib/isodoc/class_utils.rb +25 -2
  4. data/lib/isodoc/convert.rb +2 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/to_word_html.rb +2 -1
  7. data/lib/isodoc/function/utils.rb +34 -14
  8. data/lib/isodoc/html_function/comments.rb +107 -111
  9. data/lib/isodoc/html_function/footnotes.rb +68 -67
  10. data/lib/isodoc/html_function/html.rb +113 -103
  11. data/lib/isodoc/presentation_function/block.rb +1 -69
  12. data/lib/isodoc/presentation_function/image.rb +112 -0
  13. data/lib/isodoc/presentation_function/inline.rb +16 -78
  14. data/lib/isodoc/presentation_function/terms.rb +179 -0
  15. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  16. data/lib/isodoc/version.rb +1 -1
  17. data/lib/isodoc/word_function/body.rb +176 -174
  18. data/lib/isodoc/word_function/comments.rb +117 -112
  19. data/lib/isodoc/word_function/footnotes.rb +88 -86
  20. data/lib/isodoc/word_function/inline.rb +42 -67
  21. data/lib/isodoc/word_function/postprocess.rb +184 -176
  22. data/lib/isodoc/word_function/postprocess_cover.rb +121 -110
  23. data/lib/isodoc/xref/xref_gen.rb +153 -150
  24. data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
  25. data/lib/isodoc/xslfo_convert.rb +11 -7
  26. data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
  27. data/lib/isodoc-yaml/i18n-de.yaml +20 -0
  28. data/lib/isodoc-yaml/i18n-en.yaml +20 -0
  29. data/lib/isodoc-yaml/i18n-es.yaml +20 -0
  30. data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
  31. data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
  32. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
  33. data/lib/metanorma/output/xslfo.rb +4 -11
  34. data/spec/assets/i18n.yaml +3 -1
  35. data/spec/assets/odf.svg +1 -4
  36. data/spec/isodoc/blocks_spec.rb +229 -157
  37. data/spec/isodoc/i18n_spec.rb +8 -8
  38. data/spec/isodoc/inline_spec.rb +285 -32
  39. data/spec/isodoc/postproc_spec.rb +38 -0
  40. data/spec/isodoc/presentation_xml_spec.rb +60 -0
  41. data/spec/isodoc/section_spec.rb +11 -10
  42. data/spec/isodoc/terms_spec.rb +354 -34
  43. data/spec/isodoc/xref_spec.rb +4 -4
  44. data/spec/isodoc/xslfo_convert_spec.rb +34 -9
  45. metadata +49 -33
@@ -0,0 +1,179 @@
1
+ module IsoDoc
2
+ class PresentationXMLConvert < ::IsoDoc::Convert
3
+ def concept(docxml)
4
+ docxml.xpath(ns("//concept")).each { |f| concept1(f) }
5
+ end
6
+
7
+ def concept1(node)
8
+ xref = node&.at(ns("./xref/@target"))&.text or
9
+ return concept_render(node, ital: node["ital"] || "true",
10
+ ref: node["ref"] || "true",
11
+ linkref: node["linkref"] || "true",
12
+ linkmention: node["linkmention"] || "false")
13
+ if node.at(ns("//definitions//dt[@id = '#{xref}']"))
14
+ concept_render(node, ital: node["ital"] || "false",
15
+ ref: node["ref"] || "false",
16
+ linkref: node["linkref"] || "true",
17
+ linkmention: node["linkmention"] || "false")
18
+ else concept_render(node, ital: node["ital"] || "true",
19
+ ref: node["ref"] || "true",
20
+ linkref: node["linkref"] || "true",
21
+ linkmention: node["linkmention"] || "false")
22
+ end
23
+ end
24
+
25
+ def concept_render(node, opts)
26
+ node&.at(ns("./refterm"))&.remove
27
+ r = node.at(ns("./renderterm"))
28
+ ref = node.at(ns("./xref | ./eref | ./termref"))
29
+ ref && opts[:ref] != "false" and r&.next = " "
30
+ opts[:ital] == "true" and r&.name = "em"
31
+ if opts[:linkmention] == "true" && !r.nil? && !ref.nil?
32
+ ref2 = ref.clone
33
+ r2 = r.clone
34
+ r.replace(ref2).children = r2
35
+ end
36
+ concept1_ref(node, ref, opts)
37
+ if opts[:ital] == "false"
38
+ r = node.at(ns(".//renderterm"))
39
+ r&.replace(r&.children)
40
+ end
41
+ node.replace(node.children)
42
+ end
43
+
44
+ def concept1_ref(_node, ref, opts)
45
+ ref.nil? and return
46
+ return ref.remove if opts[:ref] == "false"
47
+
48
+ r = concept1_ref_content(ref)
49
+ ref = r.at("./descendant-or-self::xmlns:xref | "\
50
+ "./descendant-or-self::xmlns:eref | "\
51
+ "./descendant-or-self::xmlns:termref")
52
+ %w(xref eref).include? ref&.name and get_linkend(ref)
53
+ if opts[:linkref] == "false" && %w(xref eref).include?(ref&.name)
54
+ ref.replace(ref.children)
55
+ end
56
+ end
57
+
58
+ def concept1_ref_content(ref)
59
+ if non_locality_elems(ref).select do |c|
60
+ !c.text? || /\S/.match(c)
61
+ end.empty?
62
+ ref.replace(@i18n.term_defined_in.sub(/%/,
63
+ ref.to_xml))
64
+ else ref.replace("[#{ref.to_xml}]")
65
+ end
66
+ end
67
+
68
+ def related(docxml)
69
+ docxml.xpath(ns("//related")).each { |f| related1(f) }
70
+ end
71
+
72
+ def related1(node)
73
+ p = node.at(ns("./preferred"))
74
+ ref = node.at(ns("./xref | ./eref | ./termref"))
75
+ label = @i18n.relatedterms[node["type"]].upcase
76
+ node.replace(l10n("<p><strong>#{label}:</strong> "\
77
+ "<em>#{p.to_xml}</em> (#{ref.to_xml})</p>"))
78
+ end
79
+
80
+ def designation(docxml)
81
+ docxml.xpath(ns("//preferred | //admitted | //deprecates")).each do |p|
82
+ designation1(p)
83
+ end
84
+ docxml.xpath(ns("//term")).each do |t|
85
+ merge_second_preferred(t)
86
+ end
87
+ end
88
+
89
+ def merge_second_preferred(term)
90
+ pref = nil
91
+ term.xpath(ns("./preferred")).each_with_index do |p, i|
92
+ if i.zero? then pref = p
93
+ else
94
+ pref << l10n("; #{p.children.to_xml}")
95
+ p.remove
96
+ end
97
+ end
98
+ end
99
+
100
+ def designation1(desgn)
101
+ s = desgn.at(ns("./termsource"))
102
+ name = desgn.at(ns("./expression/name | ./letter-symbol/name | "\
103
+ "./graphical-symbol")) or return
104
+
105
+ g = desgn.at(ns("./expression/grammar")) and
106
+ name << " #{designation_grammar(g).join(', ')}"
107
+ desgn.children = name.children
108
+ s and desgn.next = s
109
+ end
110
+
111
+ def designation_grammar(grammar)
112
+ ret = []
113
+ grammar.xpath(ns("./gender")).each do |x|
114
+ ret << @i18n.grammar_abbrevs[x.text]
115
+ end
116
+ %w(isPreposition isParticiple isAdjective isVerb isAdverb isNoun)
117
+ .each do |x|
118
+ grammar.at(ns("./#{x}[text() = 'true']")) and
119
+ ret << @i18n.grammar_abbrevs[x]
120
+ end
121
+ ret
122
+ end
123
+
124
+ def definition1(elem)
125
+ nodes = Nokogiri::XML::NodeSet.new(elem.document)
126
+ v = elem&.at(ns("./verbaldefinition"))&.children and nodes += v
127
+ n = elem&.at(ns("./nonverbalrepresentation"))&.children and nodes += n
128
+ elem.children = nodes
129
+ end
130
+
131
+ def termexample(docxml)
132
+ docxml.xpath(ns("//termexample")).each do |f|
133
+ example1(f)
134
+ end
135
+ end
136
+
137
+ def termnote(docxml)
138
+ docxml.xpath(ns("//termnote")).each do |f|
139
+ termnote1(f)
140
+ end
141
+ end
142
+
143
+ # introduce name element
144
+ def termnote1(elem)
145
+ lbl = l10n(@xrefs.anchor(elem["id"], :label) || "???")
146
+ prefix_name(elem, "", lower2cap(lbl), "name")
147
+ end
148
+
149
+ def termdefinition(docxml)
150
+ docxml.xpath(ns("//term[definition]")).each do |f|
151
+ termdefinition1(f)
152
+ end
153
+ end
154
+
155
+ def termdefinition1(elem)
156
+ unwrap_definition(elem)
157
+ multidef(elem) if elem.xpath(ns("./definition")).size > 1
158
+ end
159
+
160
+ def multidef(elem)
161
+ d = elem.at(ns("./definition"))
162
+ d = d.replace("<ol><li>#{d.children.to_xml}</li></ol>").first
163
+ elem.xpath(ns("./definition")).each do |f|
164
+ f = f.replace("<li>#{f.children.to_xml}</li>").first
165
+ d << f
166
+ end
167
+ d.wrap("<definition></definition>")
168
+ end
169
+
170
+ def unwrap_definition(elem)
171
+ elem.xpath(ns("./definition")).each do |d|
172
+ nodes = Nokogiri::XML::NodeSet.new(elem.document)
173
+ v = d&.at(ns("./verbaldefinition"))&.children and nodes += v
174
+ n = d&.at(ns("./nonverbalrepresentation"))&.children and nodes += n
175
+ d.children = nodes
176
+ end
177
+ end
178
+ end
179
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative "presentation_function/block"
2
+ require_relative "presentation_function/terms"
2
3
  require_relative "presentation_function/inline"
3
4
  require_relative "presentation_function/math"
4
5
  require_relative "presentation_function/section"
@@ -25,6 +26,7 @@ module IsoDoc
25
26
  @xrefs.parse docxml
26
27
  section docxml
27
28
  block docxml
29
+ terms docxml
28
30
  inline docxml
29
31
  end
30
32
 
@@ -46,17 +48,13 @@ module IsoDoc
46
48
  sourcecode docxml
47
49
  formula docxml
48
50
  example docxml
49
- termexample docxml
50
51
  note docxml
51
- termnote docxml
52
- termdefinition docxml
53
52
  permission docxml
54
53
  requirement docxml
55
54
  recommendation docxml
56
55
  end
57
56
 
58
57
  def inline(docxml)
59
- concept docxml
60
58
  xref docxml
61
59
  eref docxml
62
60
  origin docxml
@@ -65,6 +63,15 @@ module IsoDoc
65
63
  variant docxml
66
64
  end
67
65
 
66
+ def terms(docxml)
67
+ termexample docxml
68
+ termnote docxml
69
+ termdefinition docxml
70
+ designation docxml
71
+ concept docxml
72
+ related docxml
73
+ end
74
+
68
75
  def postprocess(result, filename, _dir)
69
76
  toXML(result, filename)
70
77
  @files_to_delete.each { |f| FileUtils.rm_rf f }
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.7.5".freeze
2
+ VERSION = "1.8.0".freeze
3
3
  end
@@ -1,231 +1,233 @@
1
1
  require_relative "./table"
2
2
  require_relative "./inline"
3
3
 
4
- module IsoDoc::WordFunction
5
- module Body
6
- def define_head(head, filename, _dir)
7
- head.style do |style|
8
- loc = File.join(File.dirname(__FILE__), "..", "base_style",
9
- "metanorma_word.scss")
10
- stylesheet = File.read(loc, encoding: "utf-8")
11
- style.comment "\n#{stylesheet}\n"
12
- end
13
- super
14
- end
15
-
16
- def body_attr
17
- { lang: "EN-US", link: "blue", vlink: "#954F72" }
18
- end
4
+ module IsoDoc
5
+ module WordFunction
6
+ module Body
7
+ def define_head(head, filename, _dir)
8
+ head.style do |style|
9
+ loc = File.join(File.dirname(__FILE__), "..", "base_style",
10
+ "metanorma_word.scss")
11
+ stylesheet = File.read(loc, encoding: "utf-8")
12
+ style.comment "\n#{stylesheet}\n"
13
+ end
14
+ super
15
+ end
19
16
 
20
- def make_body1(body, _docxml)
21
- body.div **{ class: "WordSection1" } do |div1|
22
- div1.p { |p| p << "&nbsp;" } # placeholder
17
+ def body_attr
18
+ { lang: "EN-US", link: "blue", vlink: "#954F72" }
23
19
  end
24
- section_break(body)
25
- end
26
20
 
27
- def make_body2(body, docxml)
28
- body.div **{ class: "WordSection2" } do |div2|
29
- boilerplate docxml, div2
30
- preface_block docxml, div2
31
- abstract docxml, div2
32
- foreword docxml, div2
33
- introduction docxml, div2
34
- preface docxml, div2
35
- acknowledgements docxml, div2
36
- div2.p { |p| p << "&nbsp;" } # placeholder
37
- end
38
- section_break(body)
39
- end
21
+ def make_body1(body, _docxml)
22
+ body.div **{ class: "WordSection1" } do |div1|
23
+ div1.p { |p| p << "&nbsp;" } # placeholder
24
+ end
25
+ section_break(body)
26
+ end
27
+
28
+ def make_body2(body, docxml)
29
+ body.div **{ class: "WordSection2" } do |div2|
30
+ boilerplate docxml, div2
31
+ preface_block docxml, div2
32
+ abstract docxml, div2
33
+ foreword docxml, div2
34
+ introduction docxml, div2
35
+ preface docxml, div2
36
+ acknowledgements docxml, div2
37
+ div2.p { |p| p << "&nbsp;" } # placeholder
38
+ end
39
+ section_break(body)
40
+ end
40
41
 
41
- def make_body3(body, docxml)
42
- body.div **{ class: "WordSection3" } do |div3|
43
- middle docxml, div3
44
- footnotes div3
45
- comments div3
42
+ def make_body3(body, docxml)
43
+ body.div **{ class: "WordSection3" } do |div3|
44
+ middle docxml, div3
45
+ footnotes div3
46
+ comments div3
47
+ end
46
48
  end
47
- end
48
49
 
49
- def insert_tab(out, count)
50
- out.span **attr_code(style: "mso-tab-count:#{count}") do |span|
51
- [1..count].each { span << "&#xA0; " }
50
+ def insert_tab(out, count)
51
+ out.span **attr_code(style: "mso-tab-count:#{count}") do |span|
52
+ [1..count].each { span << "&#xA0; " }
53
+ end
52
54
  end
53
- end
54
55
 
55
- def para_class(_node)
56
- classtype = nil
57
- classtype = "Note" if @note
58
- classtype = "MsoCommentText" if in_comment
59
- classtype = "Sourcecode" if @annotation
60
- classtype
61
- end
56
+ def para_class(_node)
57
+ classtype = nil
58
+ classtype = "Note" if @note
59
+ classtype = "MsoCommentText" if in_comment
60
+ classtype = "Sourcecode" if @annotation
61
+ classtype
62
+ end
62
63
 
63
- def para_parse(node, out)
64
- out.p **attr_code(para_attrs(node)) do |p|
65
- unless @termdomain.empty?
66
- p << "&lt;#{@termdomain}&gt; "
67
- @termdomain = ""
64
+ def para_parse(node, out)
65
+ out.p **attr_code(para_attrs(node)) do |p|
66
+ unless @termdomain.empty?
67
+ p << "&lt;#{@termdomain}&gt; "
68
+ @termdomain = ""
69
+ end
70
+ node.children.each { |n| parse(n, p) unless n.name == "note" }
68
71
  end
69
- node.children.each { |n| parse(n, p) unless n.name == "note" }
72
+ node.xpath(ns("./note")).each { |n| parse(n, out) }
70
73
  end
71
- node.xpath(ns("./note")).each { |n| parse(n, out) }
72
- end
73
74
 
74
- WORD_DT_ATTRS = { class: @note ? "Note" : nil, align: "left",
75
- style: "margin-left:0pt;text-align:left;" }.freeze
75
+ WORD_DT_ATTRS = { class: @note ? "Note" : nil, align: "left",
76
+ style: "margin-left:0pt;text-align:left;" }.freeze
76
77
 
77
- def dt_parse(dt, term)
78
- term.p **attr_code(WORD_DT_ATTRS) do |p|
79
- if dt.elements.empty?
80
- p << dt.text
81
- else
82
- dt.children.each { |n| parse(n, p) }
78
+ def dt_parse(dterm, term)
79
+ term.p **attr_code(WORD_DT_ATTRS) do |p|
80
+ if dterm.elements.empty?
81
+ p << dterm.text
82
+ else
83
+ dterm.children.each { |n| parse(n, p) }
84
+ end
83
85
  end
84
86
  end
85
- end
86
87
 
87
- def dl_parse(node, out)
88
- out.table **{ class: "dl" } do |v|
89
- node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
90
- v.tr do |tr|
91
- tr.td **{ valign: "top", align: "left" } do |term|
92
- dt_parse(dt, term)
93
- end
94
- tr.td **{ valign: "top" } do |listitem|
95
- dd.children.each { |n| parse(n, listitem) }
88
+ def dl_parse(node, out)
89
+ out.table **{ class: "dl" } do |v|
90
+ node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
91
+ v.tr do |tr|
92
+ tr.td **{ valign: "top", align: "left" } do |term|
93
+ dt_parse(dt, term)
94
+ end
95
+ tr.td **{ valign: "top" } do |listitem|
96
+ dd.children.each { |n| parse(n, listitem) }
97
+ end
96
98
  end
97
99
  end
100
+ dl_parse_notes(node, v)
98
101
  end
99
- dl_parse_notes(node, v)
100
102
  end
101
- end
102
103
 
103
- def dl_parse_notes(node, v)
104
- return if node.elements.reject { |n| dt_dd? n }.empty?
104
+ def dl_parse_notes(node, out)
105
+ return if node.elements.reject { |n| dt_dd? n }.empty?
105
106
 
106
- v.tr do |tr|
107
- tr.td **{ colspan: 2 } do |td|
108
- node.elements.reject { |n| dt_dd? n }.each { |n| parse(n, td) }
107
+ out.tr do |tr|
108
+ tr.td **{ colspan: 2 } do |td|
109
+ node.elements.reject { |n| dt_dd? n }.each { |n| parse(n, td) }
110
+ end
109
111
  end
110
112
  end
111
- end
112
113
 
113
- def figure_get_or_make_dl(node)
114
- dl = node.at(".//table[@class = 'dl']")
115
- if dl.nil?
116
- node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
114
+ def figure_get_or_make_dl(node)
117
115
  dl = node.at(".//table[@class = 'dl']")
116
+ if dl.nil?
117
+ node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
118
+ dl = node.at(".//table[@class = 'dl']")
119
+ end
120
+ dl
121
+ end
122
+
123
+ def figure_aside_process(fig, aside, key)
124
+ # get rid of footnote link, it is in diagram
125
+ fig&.at("./a[@class='TableFootnoteRef']")&.remove
126
+ fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
127
+ tr = key.add_child("<tr></tr>").first
128
+ dt = tr.add_child("<td valign='top' align='left'></td>").first
129
+ dd = tr.add_child("<td valign='top'></td>").first
130
+ fnref.parent = dt
131
+ aside.xpath(".//p").each do |a|
132
+ a.delete("class")
133
+ a.parent = dd
134
+ end
118
135
  end
119
- dl
120
- end
121
-
122
- def figure_aside_process(fig, aside, key)
123
- # get rid of footnote link, it is in diagram
124
- fig&.at("./a[@class='TableFootnoteRef']")&.remove
125
- fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
126
- tr = key.add_child("<tr></tr>").first
127
- dt = tr.add_child("<td valign='top' align='left'></td>").first
128
- dd = tr.add_child("<td valign='top'></td>").first
129
- fnref.parent = dt
130
- aside.xpath(".//p").each do |a|
131
- a.delete("class")
132
- a.parent = dd
133
- end
134
- end
135
136
 
136
- def note_p_parse(node, div)
137
- name = node&.at(ns("./name"))&.remove
138
- div.p **{ class: "Note" } do |p|
139
- p.span **{ class: "note_label" } do |s|
140
- name&.children&.each { |n| parse(n, s) }
137
+ def note_p_parse(node, div)
138
+ name = node&.at(ns("./name"))&.remove
139
+ div.p **{ class: "Note" } do |p|
140
+ p.span **{ class: "note_label" } do |s|
141
+ name&.children&.each { |n| parse(n, s) }
142
+ end
143
+ insert_tab(p, 1)
144
+ node.first_element_child.children.each { |n| parse(n, p) }
141
145
  end
142
- insert_tab(p, 1)
143
- node.first_element_child.children.each { |n| parse(n, p) }
146
+ node.element_children[1..-1].each { |n| parse(n, div) }
144
147
  end
145
- node.element_children[1..-1].each { |n| parse(n, div) }
146
- end
147
148
 
148
- def note_parse1(node, div)
149
- name = node&.at(ns("./name"))&.remove
150
- div.p **{ class: "Note" } do |p|
151
- p.span **{ class: "note_label" } do |s|
152
- name&.children&.each { |n| parse(n, s) }
149
+ def note_parse1(node, div)
150
+ name = node&.at(ns("./name"))&.remove
151
+ div.p **{ class: "Note" } do |p|
152
+ p.span **{ class: "note_label" } do |s|
153
+ name&.children&.each { |n| parse(n, s) }
154
+ end
155
+ insert_tab(p, 1)
153
156
  end
154
- insert_tab(p, 1)
157
+ node.children.each { |n| parse(n, div) }
155
158
  end
156
- node.children.each { |n| parse(n, div) }
157
- end
158
159
 
159
- def termnote_parse(node, out)
160
- name = node&.at(ns("./name"))&.remove
161
- out.div **note_attrs(node) do |div|
162
- div.p **{ class: "Note" } do |p|
163
- if name
164
- name.children.each { |n| parse(n, p) }
165
- p << l10n(": ")
160
+ def termnote_parse(node, out)
161
+ name = node&.at(ns("./name"))&.remove
162
+ out.div **note_attrs(node) do |div|
163
+ div.p **{ class: "Note" } do |p|
164
+ if name
165
+ name.children.each { |n| parse(n, p) }
166
+ p << l10n(": ")
167
+ end
168
+ para_then_remainder(node.first_element_child, node, p, div)
166
169
  end
167
- para_then_remainder(node.first_element_child, node, p, div)
168
170
  end
169
171
  end
170
- end
171
172
 
172
- def para_attrs(node)
173
- attrs = { class: para_class(node), id: node["id"], style: "" }
174
- unless node["align"].nil?
175
- attrs[:align] = node["align"] unless node["align"] == "justify"
176
- attrs[:style] += "text-align:#{node['align']};"
173
+ def para_attrs(node)
174
+ attrs = { class: para_class(node), id: node["id"], style: "" }
175
+ unless node["align"].nil?
176
+ attrs[:align] = node["align"] unless node["align"] == "justify"
177
+ attrs[:style] += "text-align:#{node['align']};"
178
+ end
179
+ attrs[:style] += keep_style(node).to_s
180
+ attrs[:style] = nil if attrs[:style].empty?
181
+ attrs
177
182
  end
178
- attrs[:style] += keep_style(node).to_s
179
- attrs[:style] = nil if attrs[:style].empty?
180
- attrs
181
- end
182
183
 
183
- def example_table_attr(node)
184
- super.merge({
185
- style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
186
- "mso-table-rspace:15.0cm;margin-right:423.0pt;"\
187
- "mso-table-anchor-horizontal:column;"\
188
- "mso-table-overlap:never;border-collapse:collapse;"\
189
- "#{keep_style(node)}",
190
- })
191
- end
184
+ def example_table_attr(node)
185
+ super.merge(
186
+ style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
187
+ "mso-table-rspace:15.0cm;margin-right:423.0pt;"\
188
+ "mso-table-anchor-horizontal:column;"\
189
+ "mso-table-overlap:never;border-collapse:collapse;"\
190
+ "#{keep_style(node)}",
191
+ )
192
+ end
192
193
 
193
- def formula_where(deflist, out)
194
- return unless deflist
194
+ def formula_where(deflist, out)
195
+ return unless deflist
195
196
 
196
- out.p { |p| p << @i18n.where }
197
- parse(deflist, out)
198
- out.parent.at("./table")["class"] = "formula_dl"
199
- end
197
+ out.p { |p| p << @i18n.where }
198
+ parse(deflist, out)
199
+ out.parent.at("./table")["class"] = "formula_dl"
200
+ end
200
201
 
201
- def formula_parse1(node, out)
202
- out.div **attr_code(class: "formula") do |div|
203
- div.p do |_p|
204
- parse(node.at(ns("./stem")), div)
205
- insert_tab(div, 1)
206
- if lbl = node&.at(ns("./name"))&.text
207
- div << "(#{lbl})"
202
+ def formula_parse1(node, out)
203
+ out.div **attr_code(class: "formula") do |div|
204
+ div.p do |_p|
205
+ parse(node.at(ns("./stem")), div)
206
+ insert_tab(div, 1)
207
+ if lbl = node&.at(ns("./name"))&.text
208
+ div << "(#{lbl})"
209
+ end
208
210
  end
209
211
  end
210
212
  end
211
- end
212
213
 
213
- def li_parse(node, out)
214
- out.li **attr_code(id: node["id"]) do |li|
215
- if node["uncheckedcheckbox"] == "true"
216
- li << '<span class="zzMoveToFollowing">&#x2610; </span>'
217
- elsif node["checkedcheckbox"] == "true"
218
- li << '<span class="zzMoveToFollowing">&#x2611; </span>'
214
+ def li_parse(node, out)
215
+ out.li **attr_code(id: node["id"]) do |li|
216
+ if node["uncheckedcheckbox"] == "true"
217
+ li << '<span class="zzMoveToFollowing">&#x2610; </span>'
218
+ elsif node["checkedcheckbox"] == "true"
219
+ li << '<span class="zzMoveToFollowing">&#x2611; </span>'
220
+ end
221
+ node.children.each { |n| parse(n, li) }
219
222
  end
220
- node.children.each { |n| parse(n, li) }
221
223
  end
222
- end
223
224
 
224
- def suffix_url(url)
225
- return url if %r{^https?://}.match?(url)
226
- return url unless File.extname(url).empty?
225
+ def suffix_url(url)
226
+ return url if %r{^https?://}.match?(url)
227
+ return url unless File.extname(url).empty?
227
228
 
228
- url.sub(/#{File.extname(url)}$/, ".doc")
229
+ url.sub(/#{File.extname(url)}$/, ".doc")
230
+ end
229
231
  end
230
232
  end
231
233
  end