isodoc 1.1.4 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc-yaml/i18n-en.yaml +4 -1
  3. data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
  4. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
  5. data/lib/isodoc.rb +1 -0
  6. data/lib/isodoc/base_style/metanorma_word.css +6 -0
  7. data/lib/isodoc/base_style/metanorma_word.scss +6 -0
  8. data/lib/isodoc/common.rb +0 -2
  9. data/lib/isodoc/convert.rb +34 -28
  10. data/lib/isodoc/function/blocks.rb +11 -22
  11. data/lib/isodoc/function/blocks_example_note.rb +14 -15
  12. data/lib/isodoc/function/cleanup.rb +5 -4
  13. data/lib/isodoc/function/inline.rb +6 -76
  14. data/lib/isodoc/function/references.rb +13 -10
  15. data/lib/isodoc/function/reqt.rb +12 -11
  16. data/lib/isodoc/function/section.rb +51 -54
  17. data/lib/isodoc/function/table.rb +2 -6
  18. data/lib/isodoc/function/terms.rb +13 -6
  19. data/lib/isodoc/function/to_word_html.rb +3 -0
  20. data/lib/isodoc/function/utils.rb +6 -5
  21. data/lib/isodoc/html_function/html.rb +1 -1
  22. data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -37
  23. data/lib/isodoc/metadata.rb +4 -3
  24. data/lib/isodoc/metadata_date.rb +1 -1
  25. data/lib/isodoc/presentation_function/block.rb +152 -0
  26. data/lib/isodoc/presentation_function/inline.rb +131 -0
  27. data/lib/isodoc/presentation_function/section.rb +46 -0
  28. data/lib/isodoc/presentation_xml_convert.rb +39 -5
  29. data/lib/isodoc/version.rb +1 -1
  30. data/lib/isodoc/word_function/body.rb +13 -8
  31. data/lib/isodoc/word_function/inline.rb +3 -1
  32. data/lib/isodoc/word_function/postprocess.rb +1 -1
  33. data/lib/isodoc/word_function/table.rb +3 -2
  34. data/lib/isodoc/xref.rb +6 -3
  35. data/lib/isodoc/xref/xref_counter.rb +21 -7
  36. data/lib/isodoc/xref/xref_gen.rb +27 -4
  37. data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
  38. data/spec/assets/i18n.yaml +12 -1
  39. data/spec/isodoc/blocks_spec.rb +1338 -147
  40. data/spec/isodoc/cleanup_spec.rb +5 -3
  41. data/spec/isodoc/footnotes_spec.rb +2 -2
  42. data/spec/isodoc/i18n_spec.rb +679 -110
  43. data/spec/isodoc/inline_spec.rb +323 -142
  44. data/spec/isodoc/lists_spec.rb +2 -2
  45. data/spec/isodoc/postproc_spec.rb +1347 -1333
  46. data/spec/isodoc/ref_spec.rb +181 -3
  47. data/spec/isodoc/section_spec.rb +633 -681
  48. data/spec/isodoc/table_spec.rb +386 -136
  49. data/spec/isodoc/terms_spec.rb +111 -79
  50. data/spec/isodoc/xref_spec.rb +1597 -1186
  51. metadata +6 -3
@@ -5,7 +5,7 @@ module IsoDoc::Function
5
5
  # references anyway; keeping here instead of in IsoDoc::Iso for now
6
6
  def docid_l10n(x)
7
7
  return x if x.nil?
8
- x.gsub(/All Parts/i, @all_parts_lbl.downcase) if @all_parts_lbl
8
+ x.gsub(/All Parts/i, @i18n.all_parts.downcase) if @i18n.all_parts
9
9
  x
10
10
  end
11
11
 
@@ -54,7 +54,8 @@ module IsoDoc::Function
54
54
  def bibitem_ref_code(b)
55
55
  id = b.at(ns("./docidentifier[@type = 'metanorma']"))
56
56
  id1 = pref_ref_code(b)
57
- id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN']"))
57
+ id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or "\
58
+ "@type = 'ISBN']"))
58
59
  return [id, id1, id2] if id || id1 || id2
59
60
  id = Nokogiri::XML::Node.new("docidentifier", b.document)
60
61
  id << "(NO ID)"
@@ -155,14 +156,14 @@ module IsoDoc::Function
155
156
 
156
157
  def norm_ref_xpath
157
158
  "//bibliography/references[@normative = 'true'] | "\
158
- "//bibliography/clause[.//references[@normative = 'true']]"
159
+ "//bibliography/clause[.//references[@normative = 'true']]"
159
160
  end
160
161
 
161
162
  def norm_ref(isoxml, out, num)
162
163
  f = isoxml.at(ns(norm_ref_xpath)) or return num
163
164
  out.div do |div|
164
165
  num = num + 1
165
- clause_name(num, @normref_lbl, div, nil)
166
+ clause_name(num, f.at(ns("./title")), div, nil)
166
167
  if f.name == "clause"
167
168
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
168
169
  else
@@ -174,15 +175,18 @@ module IsoDoc::Function
174
175
 
175
176
  def bibliography_xpath
176
177
  "//bibliography/clause[.//references]"\
177
- "[not(.//references[@normative = 'true'])] | "\
178
- "//bibliography/references[@normative = 'false']"
178
+ "[not(.//references[@normative = 'true'])] | "\
179
+ "//bibliography/references[@normative = 'false']"
179
180
  end
180
181
 
181
182
  def bibliography(isoxml, out)
182
183
  f = isoxml.at(ns(bibliography_xpath)) || return
183
184
  page_break(out)
184
185
  out.div do |div|
185
- div.h1 @bibliography_lbl, **{ class: "Section3" }
186
+ #div.h1 @bibliography_lbl, **{ class: "Section3" }
187
+ div.h1 **{class: "Section3"} do |h1|
188
+ f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
189
+ end
186
190
  biblio_list(f, div, true)
187
191
  end
188
192
  end
@@ -190,9 +194,8 @@ module IsoDoc::Function
190
194
  def bibliography_parse(node, out)
191
195
  title = node&.at(ns("./title"))&.text || ""
192
196
  out.div do |div|
193
- @xrefs.anchor(node['id'], :label, false) and
194
- clause_parse_title(node, div, node.at(ns("./title")), out) or
195
- div.h2 title, **{ class: "Section3" }
197
+ clause_parse_title(node, div, node.at(ns("./title")), out,
198
+ { class: "Section3" })
196
199
  biblio_list(node, div, true)
197
200
  end
198
201
  end
@@ -1,14 +1,14 @@
1
1
  module IsoDoc::Function
2
2
  module Blocks
3
3
  def recommendation_labels(node)
4
- [node.at(ns("./label")), node.at(ns("./title")),
5
- @xrefs.anchor(node['id'], :label, false)]
4
+ [node.at(ns("./label")), node.at(ns("./title")), node.at(ns("./name"))]
6
5
  end
7
6
 
8
- def recommendation_name(node, out, type)
7
+ def recommendation_name(node, out, _type)
9
8
  label, title, lbl = recommendation_labels(node)
10
9
  out.p **{ class: "RecommendationTitle" } do |b|
11
- b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
10
+ lbl and lbl.children.each { |n| parse(n, b) }
11
+ b << l10n(":")
12
12
  if label || title
13
13
  b.br
14
14
  label and label.children.each { |n| parse(n,b) }
@@ -21,11 +21,11 @@ module IsoDoc::Function
21
21
  def recommendation_attributes1(node)
22
22
  out = []
23
23
  oblig = node["obligation"] and
24
- out << l10n("#{@labels['obligation']}: #{oblig}")
24
+ out << l10n("#{@i18n.obligation}: #{oblig}")
25
25
  subj = node&.at(ns("./subject"))&.text and
26
- out << l10n("#{@labels['subject']}: #{subj}")
26
+ out << l10n("#{@i18n.subject}: #{subj}")
27
27
  node.xpath(ns("./inherit")).each do |i|
28
- out << recommendation_attr_parse(i, @labels["inherits"])
28
+ out << recommendation_attr_parse(i, @i18n.inherits)
29
29
  end
30
30
  node.xpath(ns("./classification")).each do |c|
31
31
  line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
@@ -57,7 +57,8 @@ module IsoDoc::Function
57
57
  end
58
58
 
59
59
  def reqt_metadata_node(n)
60
- %w(label title subject classification tag value inherit).include? n.name
60
+ %w(label title subject classification tag value
61
+ inherit name).include? n.name
61
62
  end
62
63
 
63
64
  def reqt_attrs(node, klass)
@@ -66,7 +67,7 @@ module IsoDoc::Function
66
67
 
67
68
  def recommendation_parse(node, out)
68
69
  out.div **reqt_attrs(node, "recommend") do |t|
69
- recommendation_name(node, t, @recommendation_lbl)
70
+ recommendation_name(node, t, @i18n.recommendation)
70
71
  recommendation_attributes(node, out)
71
72
  node.children.each do |n|
72
73
  parse(n, t) unless reqt_metadata_node(n)
@@ -76,7 +77,7 @@ module IsoDoc::Function
76
77
 
77
78
  def requirement_parse(node, out)
78
79
  out.div **reqt_attrs(node, "require") do |t|
79
- recommendation_name(node, t, @requirement_lbl)
80
+ recommendation_name(node, t, @i18n.requirement)
80
81
  recommendation_attributes(node, out)
81
82
  node.children.each do |n|
82
83
  parse(n, t) unless reqt_metadata_node(n)
@@ -86,7 +87,7 @@ module IsoDoc::Function
86
87
 
87
88
  def permission_parse(node, out)
88
89
  out.div **reqt_attrs(node, "permission") do |t|
89
- recommendation_name(node, t, @permission_lbl)
90
+ recommendation_name(node, t, @i18n.permission)
90
91
  recommendation_attributes(node, out)
91
92
  node.children.each do |n|
92
93
  parse(n, t) unless reqt_metadata_node(n)
@@ -8,36 +8,37 @@ module IsoDoc::Function
8
8
  insert_tab(out, 1)
9
9
  end
10
10
 
11
- def inline_header_title(out, node, c1)
11
+ def inline_header_title(out, node, title)
12
12
  out.span **{ class: "zzMoveToFollowing" } do |s|
13
13
  s.b do |b|
14
- if @xrefs.anchor(node['id'], :label, false) && !@suppressheadingnumbers
15
- b << "#{@xrefs.anchor(node['id'], :label)}#{clausedelim}"
16
- clausedelimspace(out)
17
- end
18
- c1&.children&.each { |c2| parse(c2, b) }
19
- clausedelimspace(out) if /\S/.match(c1&.text)
14
+ title&.children&.each { |c2| parse(c2, b) }
15
+ clausedelimspace(out) if /\S/.match(title&.text)
20
16
  end
21
17
  end
22
18
  end
23
19
 
24
20
  # used for subclauses
25
- def clause_parse_title(node, div, c1, out)
21
+ def clause_parse_title(node, div, title, out, header_class = {})
22
+ return if title.nil?
26
23
  if node["inline-header"] == "true"
27
- inline_header_title(out, node, c1)
24
+ inline_header_title(out, node, title)
28
25
  else
29
- div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
30
- lbl = @xrefs.anchor(node['id'], :label, false)
31
- h << "#{lbl}#{clausedelim}" if lbl && !@suppressheadingnumbers
32
- clausedelimspace(out) if lbl && !@suppressheadingnumbers
33
- c1&.children&.each { |c2| parse(c2, h) }
26
+ depth = (title && title["depth"]) ? title["depth"] :
27
+ node.ancestors("clause, annex, terms, references, definitions, "\
28
+ "acknowledgements, introduction, foreword").size + 1
29
+ div.send "h#{depth}", **attr_code(header_class) do |h|
30
+ title&.children&.each { |c2| parse(c2, h) }
34
31
  end
35
32
  end
36
33
  end
37
34
 
35
+ def clause_attrs(node)
36
+ { id: node["id"] }
37
+ end
38
+
38
39
  # used for subclauses
39
40
  def clause_parse(node, out)
40
- out.div **attr_code(id: node["id"]) do |div|
41
+ out.div **attr_code(clause_attrs(node)) do |div|
41
42
  clause_parse_title(node, div, node.at(ns("./title")), out)
42
43
  node.children.reject { |c1| c1.name == "title" }.each do |c1|
43
44
  parse(c1, div)
@@ -45,13 +46,9 @@ module IsoDoc::Function
45
46
  end
46
47
  end
47
48
 
48
- def clause_name(num, title, div, header_class)
49
+ def clause_name(_num, title, div, header_class)
49
50
  header_class = {} if header_class.nil?
50
51
  div.h1 **attr_code(header_class) do |h1|
51
- if num && !@suppressheadingnumbers
52
- h1 << "#{num}#{clausedelim}"
53
- clausedelimspace(h1)
54
- end
55
52
  title.is_a?(String) ? h1 << title :
56
53
  title&.children&.each { |c2| parse(c2, h1) }
57
54
  end
@@ -60,9 +57,8 @@ module IsoDoc::Function
60
57
 
61
58
  def clause(isoxml, out)
62
59
  isoxml.xpath(ns(middle_clause)).each do |c|
63
- out.div **attr_code(id: c["id"]) do |s|
64
- clause_name(@xrefs.anchor(c['id'], :label),
65
- c&.at(ns("./title")), s, nil)
60
+ out.div **attr_code(clause_attrs(c)) do |s|
61
+ clause_name(nil, c&.at(ns("./title")), s, nil)
66
62
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
67
63
  parse(c1, s)
68
64
  end
@@ -71,19 +67,20 @@ module IsoDoc::Function
71
67
  end
72
68
 
73
69
  def annex_name(annex, name, div)
70
+ return if name.nil?
74
71
  div.h1 **{ class: "Annex" } do |t|
75
- t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
76
- t.b do |b|
77
- name&.children&.each { |c2| parse(c2, b) }
78
- end
72
+ name.children.each { |c2| parse(c2, t) }
79
73
  end
80
74
  end
81
75
 
76
+ def annex_attrs(node)
77
+ { id: node["id"], class: "Section3" }
78
+ end
79
+
82
80
  def annex(isoxml, out)
83
81
  isoxml.xpath(ns("//annex")).each do |c|
84
82
  page_break(out)
85
- out.div **attr_code(id: c["id"], class: "Section3") do |s|
86
- annex_name(c, nil, s) unless c.at(ns("./title"))
83
+ out.div **attr_code(annex_attrs(c)) do |s|
87
84
  c.elements.each do |c1|
88
85
  if c1.name == "title" then annex_name(c, c1, s)
89
86
  else
@@ -95,10 +92,10 @@ module IsoDoc::Function
95
92
  end
96
93
 
97
94
  def scope(isoxml, out, num)
98
- f = isoxml.at(ns("//clause[title = 'Scope']")) or return num
95
+ f = isoxml.at(ns("//clause[@type = 'scope']")) or return num
99
96
  out.div **attr_code(id: f["id"]) do |div|
100
97
  num = num + 1
101
- clause_name(num, @scope_lbl, div, nil)
98
+ clause_name(num, f&.at(ns("./title")), div, nil)
102
99
  f.elements.each do |e|
103
100
  parse(e, div) unless e.name == "title"
104
101
  end
@@ -109,26 +106,11 @@ module IsoDoc::Function
109
106
  TERM_CLAUSE = "//sections/terms | "\
110
107
  "//sections/clause[descendant::terms]".freeze
111
108
 
112
- def term_def_title(title)
113
- case title&.text
114
- when "Terms, definitions, symbols and abbreviated terms"
115
- @labels["termsdefsymbolsabbrev"]
116
- when "Terms, definitions and symbols"
117
- @labels["termsdefsymbols"]
118
- when "Terms, definitions and abbreviated terms"
119
- @labels["termsdefabbrev"]
120
- when "Terms and definitions"
121
- @labels["termsdef"]
122
- else
123
- title
124
- end
125
- end
126
-
127
109
  def terms_defs(isoxml, out, num)
128
110
  f = isoxml.at(ns(TERM_CLAUSE)) or return num
129
111
  out.div **attr_code(id: f["id"]) do |div|
130
112
  num = num + 1
131
- clause_name(num, term_def_title(f&.at(ns("./title"))), div, nil)
113
+ clause_name(num, f&.at(ns("./title")), div, nil)
132
114
  f.elements.each do |e|
133
115
  parse(e, div) unless %w{title source}.include? e.name
134
116
  end
@@ -145,7 +127,7 @@ module IsoDoc::Function
145
127
  f = isoxml.at(ns("//sections/definitions")) or return num
146
128
  out.div **attr_code(id: f["id"], class: "Symbols") do |div|
147
129
  num = num + 1
148
- clause_name(num, f&.at(ns("./title")) || @symbols_lbl, div, nil)
130
+ clause_name(num, f&.at(ns("./title")) || @i18n.symbols, div, nil)
149
131
  f.elements.each do |e|
150
132
  parse(e, div) unless e.name == "title"
151
133
  end
@@ -156,7 +138,7 @@ module IsoDoc::Function
156
138
  # subclause
157
139
  def symbols_parse(isoxml, out)
158
140
  isoxml.at(ns("./title")) or
159
- isoxml.children.first.previous = "<title>#{@symbols_lbl}</title>"
141
+ isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
160
142
  clause_parse(isoxml, out)
161
143
  end
162
144
 
@@ -165,7 +147,7 @@ module IsoDoc::Function
165
147
  title_attr = { class: "IntroTitle" }
166
148
  page_break(out)
167
149
  out.div **{ class: "Section3", id: f["id"] } do |div|
168
- clause_name(nil, @introduction_lbl, div, title_attr)
150
+ clause_name(nil, f.at(ns("./title")), div, { class: "IntroTitle" })
169
151
  f.elements.each do |e|
170
152
  parse(e, div) unless e.name == "title"
171
153
  end
@@ -176,7 +158,9 @@ module IsoDoc::Function
176
158
  f = isoxml.at(ns("//foreword")) || return
177
159
  page_break(out)
178
160
  out.div **attr_code(id: f["id"]) do |s|
179
- s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl }
161
+ clause_name(nil, f.at(ns("./title")) || @i18n.foreword, s,
162
+ { class: "ForewordTitle" })
163
+ #s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
180
164
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
181
165
  end
182
166
  end
@@ -197,15 +181,15 @@ module IsoDoc::Function
197
181
  f = isoxml.at(ns("//preface/abstract")) || return
198
182
  page_break(out)
199
183
  out.div **attr_code(id: f["id"]) do |s|
200
- s.h1(**{ class: "AbstractTitle" }) { |h1| h1 << @abstract_lbl }
184
+ clause_name(nil, f.at(ns("./title")), s, { class: "AbstractTitle" })
201
185
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
202
186
  end
203
187
  end
204
188
 
205
189
  def preface(isoxml, out)
206
190
  title_attr = { class: "IntroTitle" }
207
- isoxml.xpath(ns("//preface/clause | //preface/terms | //preface/definitions | "\
208
- "//preface/references")).each do |f|
191
+ isoxml.xpath(ns("//preface/clause | //preface/references | "\
192
+ "//preface/definitions | //preface/terms")).each do |f|
209
193
  page_break(out)
210
194
  out.div **{ class: "Section3", id: f["id"] } do |div|
211
195
  clause_name(nil, f&.at(ns("./title")), div, title_attr)
@@ -216,6 +200,19 @@ module IsoDoc::Function
216
200
  end
217
201
  end
218
202
 
203
+ def is_clause?(name)
204
+ %w(clause references definitions terms foreword introduction abstract
205
+ acknowledgements).include? name
206
+ end
207
+
208
+ def preface_block(isoxml, out)
209
+ p = isoxml.at(ns("//preface")) or return
210
+ p.elements.each do |e|
211
+ next if is_clause?(e.name)
212
+ parse(e, out)
213
+ end
214
+ end
215
+
219
216
  def copyright_parse(node, out)
220
217
  out.div **{class: "boilerplate-copyright"} do |div|
221
218
  node.children.each { |n| parse(n, div) }
@@ -2,13 +2,8 @@ module IsoDoc::Function
2
2
  module Table
3
3
 
4
4
  def table_title_parse(node, out)
5
- name = node.at(ns("./name"))
6
- lbl = @xrefs.anchor(node['id'], :label, false)
7
- lbl = nil if labelled_ancestor(node)
8
- return if name.nil? && lbl.nil?
5
+ name = node.at(ns("./name")) or return
9
6
  out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
10
- lbl.nil? or p << l10n("#{@table_lbl} #{lbl}")
11
- name and !lbl.nil? and p << l10n("&nbsp;&mdash; ")
12
7
  name and name.children.each { |n| parse(n, p) }
13
8
  end
14
9
  end
@@ -87,6 +82,7 @@ module IsoDoc::Function
87
82
  def make_tr_attr(td, row, totalrows, header)
88
83
  style = td.name == "th" ? "font-weight:bold;" : ""
89
84
  td["align"] and style += "text-align:#{td['align']};"
85
+ td["valign"] and style += "vertical-align:#{td['valign']};"
90
86
  rowmax = td["rowspan"] ? row + td["rowspan"].to_i - 1 : row
91
87
  style += <<~STYLE
92
88
  border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
@@ -1,6 +1,5 @@
1
1
  module IsoDoc::Function
2
2
  module Terms
3
-
4
3
  def definition_parse(node, out)
5
4
  node.children.each { |n| parse(n, out) }
6
5
  end
@@ -13,7 +12,7 @@ module IsoDoc::Function
13
12
 
14
13
  def deprecated_term_parse(node, out)
15
14
  out.p **{ class: "DeprecatedTerms", style:"text-align:left;" } do |p|
16
- p << l10n("#{@deprecated_lbl}: ")
15
+ p << l10n("#{@i18n.deprecated}: ")
17
16
  node.children.each { |c| parse(c, p) }
18
17
  end
19
18
  end
@@ -39,12 +38,19 @@ module IsoDoc::Function
39
38
  end
40
39
  end
41
40
 
41
+ def termnote_delim
42
+ l10n(": ")
43
+ end
44
+
42
45
  def termnote_parse(node, out)
46
+ name = node&.at(ns("./name"))&.remove
43
47
  out.div **note_attrs(node) do |div|
44
- first = node.first_element_child
45
48
  div.p do |p|
46
- p << "#{@xrefs.anchor(node['id'], :label) || '???'}: "
47
- para_then_remainder(first, node, p, div)
49
+ if name
50
+ name.children.each { |n| parse(n, p) }
51
+ p << termnote_delim
52
+ end
53
+ para_then_remainder(node.first_element_child, node, p, div)
48
54
  end
49
55
  end
50
56
  end
@@ -58,8 +64,9 @@ module IsoDoc::Function
58
64
  end
59
65
 
60
66
  def termdef_parse(node, out)
67
+ name = node&.at(ns("./name"))&.remove
61
68
  out.p **{ class: "TermNum", id: node["id"] } do |p|
62
- p << "#{@xrefs.get[node["id"]][:label]}#{clausedelim}"
69
+ name&.children&.each { |n| parse(n, p) }
63
70
  end
64
71
  set_termdomain("")
65
72
  node.children.each { |n| parse(n, out) }
@@ -80,6 +80,7 @@ module IsoDoc::Function
80
80
  def make_body3(body, docxml)
81
81
  body.div **{ class: "main-section" } do |div3|
82
82
  boilerplate docxml, div3
83
+ preface_block docxml, div3
83
84
  abstract docxml, div3
84
85
  foreword docxml, div3
85
86
  introduction docxml, div3
@@ -220,6 +221,8 @@ module IsoDoc::Function
220
221
  when "feedback-statement" then feedback_parse(node, out)
221
222
  when "passthrough" then passthrough_parse(node, out)
222
223
  when "variant" then variant_parse(node, out)
224
+ when "amend" then amend_parse(node, out)
225
+ when "tab" then clausedelimspace(out) # in Presentation XML only
223
226
  else
224
227
  error_parse(node, out)
225
228
  end
@@ -11,7 +11,8 @@ module IsoDoc::Function
11
11
  end
12
12
 
13
13
  def insert_tab(out, n)
14
- [1..n].each { out << '&nbsp; ' }
14
+ tab = %w(Hans Hant).include?(@script) ? "&#x3000;" : "&nbsp; "
15
+ [1..n].each { out << tab }
15
16
  end
16
17
 
17
18
  # add namespaces for Word fragments
@@ -99,8 +100,8 @@ module IsoDoc::Function
99
100
  return '' if array.nil? || array.empty?
100
101
  if array.length == 1 then array[0]
101
102
  else
102
- IsoDoc::Function::I18n::l10n("#{array[0..-2].join(', ')} "\
103
- "#{@and_lbl} #{array.last}",
103
+ @i18n.l10n("#{array[0..-2].join(', ')} "\
104
+ "#{@i18n.and} #{array.last}",
104
105
  @lang, @script)
105
106
  end
106
107
  end
@@ -153,7 +154,7 @@ module IsoDoc::Function
153
154
  .get
154
155
  .merge(@labels || {})
155
156
  .merge(@meta.labels || {})
156
- .merge(@meta.fonts_options || {})
157
+ .merge(fonts_options || {})
157
158
  template = liquid(docxml)
158
159
  template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h)
159
160
  .gsub('&lt;', '&#x3c;').gsub('&gt;', '&#x3e;').gsub('&amp;', '&#x26;')
@@ -183,7 +184,7 @@ module IsoDoc::Function
183
184
 
184
185
  def labelled_ancestor(node)
185
186
  !node.ancestors('example, requirement, recommendation, permission, '\
186
- 'table, figure, sourcecode').empty?
187
+ 'note, table, figure, sourcecode').empty?
187
188
  end
188
189
  end
189
190
  end