metanorma-gb 1.4.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61424361f137760e81ac2be44d0612606ff8d5e7073e6d7f06d3036d15030798
4
- data.tar.gz: 5b16f50829090ae682162ed84713fc21290dd864440fe54cc07e9c55e42e7738
3
+ metadata.gz: 5540fe9a62689a748f36deb94aa697067fadeec8f48e3daa4723fe31934d6f6f
4
+ data.tar.gz: f7a3059328b3d3103309ea0e4b2765b0e7d9bbb0e4b06f2d0586b3ddb1608fcf
5
5
  SHA512:
6
- metadata.gz: d0ce63e59a9f544d136615b857e326d0a3ac2985f66eef19eb194e727033c205dc1f4c7e7cfb7a076576666088c537c5ca164bf560a4ba0b1c6e638e4bbc594b
7
- data.tar.gz: d6e5ab147c8b47a65fd7c47a6f1a107837e001bd2801e9a81b50ab40865c189ad9d768000f65e881612feda144eb72090acb81f09800632699ac9fdab9db2bcf
6
+ metadata.gz: 6814a66bca93e4824acb2b3bb542337d65f528d2933ac81745ca626ccbfe7f2aaa510d7ebc9354810db4ca973e0ac79c26f78ccf1e86d049e804c3fb42c8b8b4
7
+ data.tar.gz: eeb2906af56383d32509ce13e58d61d33eaa6481dc18fc9cd53af66612709ed00d7afee06604ebb7056e18baa5b809a67709fa291639407d7eccbc4ddebec5e6
@@ -0,0 +1,130 @@
1
+ module Asciidoctor
2
+ module Gb
3
+ class Converter < ISO::Converter
4
+ def termdef_cleanup(xmldoc)
5
+ super
6
+ # TODO this should become variant tag
7
+ localisedstr(xmldoc)
8
+ end
9
+
10
+ ROMAN_TEXT = /\s*[a-z\u00c0-\u00d6\u00d8-\u00f0\u0100-\u0240]/i
11
+ HAN_TEXT = /\s*[\u4e00-\u9fff]+/
12
+
13
+ LOCALISED_ELEMS = "//admitted | //deprecates | //preferred | //prefix | "\
14
+ "//initial | //addition | //surname | //forename | //name | "\
15
+ "//abbreviation | //role/description | //affiliation/description | "\
16
+ "//bibdata/item | //bibitem/title | //bibdata/formattedref | "\
17
+ "//bibitem/formattedref | //bibdata/note | //bibitem/note | "\
18
+ "//bibdata/abstract | //bibitem/note ".freeze
19
+
20
+ MUST_LOCALISE_ELEMS = %w{admitted deprecates preferred}.freeze
21
+
22
+ def localisedstr(xmldoc)
23
+ xmldoc.xpath(LOCALISED_ELEMS).each do |zh|
24
+ if zh.at("./string")
25
+ extract_localisedstrings(zh)
26
+ elsif MUST_LOCALISE_ELEMS.include? zh.name
27
+ duplicate_localisedstrings(zh)
28
+ end
29
+ end
30
+ end
31
+
32
+ # element consists solely of localised strings, with no attributes
33
+ def extract_localisedstrings(elem)
34
+ elem.xpath("./string").each do |s|
35
+ s.name = elem.name
36
+ end
37
+ elem.replace(elem.children)
38
+ end
39
+
40
+ def text_clean(text)
41
+ text.gsub(/^\s*/, "").gsub(/</, "&lt;").gsub(/>/, "&gt;")
42
+ end
43
+
44
+ def duplicate_localisedstrings(zh)
45
+ en = zh.dup.remove
46
+ zh.after(en).after(" ")
47
+ zh["language"] = "zh"
48
+ en["language"] = "en"
49
+ en.traverse do |c|
50
+ c.text? && c.content = text_clean(c.text.gsub(HAN_TEXT, ""))
51
+ end
52
+ zh.traverse do |c|
53
+ c.text? && c.content = text_clean(c.text.gsub(ROMAN_TEXT, ""))
54
+ end
55
+ end
56
+
57
+ def termdef_boilerplate_cleanup(xmldoc)
58
+ return if @keepboilerplate
59
+ super
60
+ end
61
+
62
+ def cleanup(xmldoc)
63
+ lang = xmldoc.at("//language")&.text
64
+ @agencyclass = GbAgencies::Agencies.new(lang, {}, "")
65
+ super
66
+ contributor_cleanup(xmldoc)
67
+ xmldoc
68
+ end
69
+
70
+ def docidentifier_cleanup(xmldoc)
71
+ id = xmldoc.at("//bibdata/docidentifier[@type = 'gb']") or return
72
+ scope = xmldoc.at("//gbscope")&.text
73
+ prefix = xmldoc.at("//gbprefix")&.text
74
+ mand = xmldoc.at("//gbmandate")&.text || "mandatory"
75
+ idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
76
+ id.content = idtext&.gsub(/\&#x2002;/, " ")
77
+ id = xmldoc.at("//bibdata/ext/structuredidentifier/"\
78
+ "project-number") or return
79
+ idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
80
+ id.content = idtext&.gsub(/\&#x2002;/, " ")
81
+ end
82
+
83
+ def committee_cleanup(xmldoc)
84
+ xmldoc.xpath("//gbcommittee").each do |c|
85
+ xmldoc.at("//bibdata/contributor").next =
86
+ "<contributor><role type='technical-committee'/><organization>"\
87
+ "<name>#{c.text}</name></organization></contributor>"
88
+ end
89
+ end
90
+
91
+ def agency_value(issuer, scope, prefix, mandate)
92
+ agency = issuer.content
93
+ agency == "GB" and
94
+ agency = @agencyclass.standard_agency1(scope, prefix, mandate)
95
+ agency = "GB" if agency.nil? || agency.empty?
96
+ agency
97
+ end
98
+
99
+ def contributor_cleanup(xmldoc)
100
+ issuer = xmldoc.at("//bibdata/contributor[role/@type = 'issuer']/"\
101
+ "organization/name")
102
+ scope = xmldoc.at("//gbscope")&.text
103
+ prefix = xmldoc.at("//gbprefix")&.text
104
+ mandate = xmldoc.at("//gbmandate")&.text || "mandatory"
105
+ agency = agency_value(issuer, scope, prefix, mandate)
106
+ owner = xmldoc.at("//copyright/owner/organization/name")
107
+ owner.content = agency
108
+ issuer.content = agency
109
+ committee_cleanup(xmldoc)
110
+ end
111
+
112
+ def omit_docid_prefix(prefix)
113
+ IsoDoc::Gb::HtmlConvert.new({}).omit_docid_prefix(prefix)
114
+ end
115
+
116
+ def boilerplate_cleanup(xmldoc)
117
+ isodoc = boilerplate_isodoc(xmldoc)
118
+ initial_boilerplate(xmldoc, isodoc)
119
+ return if @keepboilerplate
120
+ xmldoc.xpath(self.class::TERM_CLAUSE).each do |f|
121
+ term_defs_boilerplate(f.at("./title"),
122
+ xmldoc.xpath(".//termdocsource"),
123
+ f.at(".//term"), f.at(".//p"), isodoc)
124
+ end
125
+ f = xmldoc.at(self.class::NORM_REF) and
126
+ norm_ref_preface(f)
127
+ end
128
+ end
129
+ end
130
+ end
@@ -1,6 +1,5 @@
1
1
  require "asciidoctor"
2
2
  require "asciidoctor/iso/converter"
3
- require "metanorma/gb/version"
4
3
  require "isodoc/gb/common"
5
4
  require "isodoc/gb/word_convert"
6
5
  require "isodoc/gb/pdf_convert"
@@ -9,6 +8,7 @@ require "gb_agencies"
9
8
  require_relative "./section_input.rb"
10
9
  require_relative "./front.rb"
11
10
  require_relative "./validate.rb"
11
+ require_relative "cleanup.rb"
12
12
  require "fileutils"
13
13
 
14
14
  module Asciidoctor
@@ -74,62 +74,15 @@ module Asciidoctor
74
74
  def outputs(node, ret)
75
75
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
76
76
  presentation_xml_converter(node).convert(@filename + ".xml")
77
- html_compliant_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}_compliant.html")
78
- html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
79
- doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
80
- pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
81
- end
82
-
83
- def termdef_cleanup(xmldoc)
84
- super
85
- localisedstr(xmldoc)
86
- end
87
-
88
- ROMAN_TEXT = /\s*[a-z\u00c0-\u00d6\u00d8-\u00f0\u0100-\u0240]/i
89
- HAN_TEXT = /\s*[\u4e00-\u9fff]+/
90
-
91
- LOCALISED_ELEMS = "//admitted | //deprecates | //preferred | //prefix | "\
92
- "//initial | //addition | //surname | //forename | //name | "\
93
- "//abbreviation | //role/description | //affiliation/description | "\
94
- "//bibdata/item | //bibitem/title | //bibdata/formattedref | "\
95
- "//bibitem/formattedref | //bibdata/note | //bibitem/note | "\
96
- "//bibdata/abstract | //bibitem/note ".freeze
97
-
98
- MUST_LOCALISE_ELEMS = %w{admitted deprecates preferred}.freeze
99
-
100
- def localisedstr(xmldoc)
101
- xmldoc.xpath(LOCALISED_ELEMS).each do |zh|
102
- if zh.at("./string")
103
- extract_localisedstrings(zh)
104
- elsif MUST_LOCALISE_ELEMS.include? zh.name
105
- duplicate_localisedstrings(zh)
106
- end
107
- end
108
- end
109
-
110
- # element consists solely of localised strings, with no attributes
111
- def extract_localisedstrings(elem)
112
- elem.xpath("./string").each do |s|
113
- s.name = elem.name
114
- end
115
- elem.replace(elem.children)
116
- end
117
-
118
- def text_clean(text)
119
- text.gsub(/^\s*/, "").gsub(/</, "&lt;").gsub(/>/, "&gt;")
120
- end
121
-
122
- def duplicate_localisedstrings(zh)
123
- en = zh.dup.remove
124
- zh.after(en).after(" ")
125
- zh["language"] = "zh"
126
- en["language"] = "en"
127
- en.traverse do |c|
128
- c.text? && c.content = text_clean(c.text.gsub(HAN_TEXT, ""))
129
- end
130
- zh.traverse do |c|
131
- c.text? && c.content = text_clean(c.text.gsub(ROMAN_TEXT, ""))
132
- end
77
+ html_compliant_converter(node).
78
+ convert(@filename + ".presentation.xml",
79
+ nil, false, "#{@filename}_compliant.html")
80
+ html_converter(node).convert(@filename + ".presentation.xml",
81
+ nil, false, "#{@filename}.html")
82
+ doc_converter(node).convert(@filename + ".presentation.xml",
83
+ nil, false, "#{@filename}.doc")
84
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
85
+ nil, false, "#{@filename}.pdf")
133
86
  end
134
87
 
135
88
  def inline_quoted(node)
@@ -149,11 +102,6 @@ module Asciidoctor
149
102
  super
150
103
  end
151
104
 
152
- def termdef_boilerplate_cleanup(xmldoc)
153
- return if @keepboilerplate
154
- super
155
- end
156
-
157
105
  GBCODE = "((AQ|BB|CB|CH|CJ|CY|DA|DB|DL|DZ|EJ|FZ|GA|GH|GM|GY|HB|HG|"\
158
106
  "HJ|HS|HY|JB|JC|JG|JR|JT|JY|LB|LD|LS|LY|MH|MT|MZ|NY|QB|QC|QJ|"\
159
107
  "QZ|SB|SC|SH|SJ|SN|SY|TB|TD|TJ|TY|WB|WH|WJ|WM|WS|WW|XB|YB|YC|"\
@@ -186,71 +134,12 @@ module Asciidoctor
186
134
  super
187
135
  end
188
136
 
189
- def cleanup(xmldoc)
190
- lang = xmldoc.at("//language")&.text
191
- @agencyclass = GbAgencies::Agencies.new(lang, {}, "")
137
+ def init(node)
138
+ node.attr("language") or node.set_attr("language", "zh")
139
+ node.attr("script") or
140
+ node.set_attr("script", node.attr("language") == "zh" ?
141
+ "Hans" : "Latn")
192
142
  super
193
- contributor_cleanup(xmldoc)
194
- xmldoc
195
- end
196
-
197
- def docidentifier_cleanup(xmldoc)
198
- id = xmldoc.at("//bibdata/docidentifier[@type = 'gb']") or return
199
- scope = xmldoc.at("//gbscope")&.text
200
- prefix = xmldoc.at("//gbprefix")&.text
201
- mand = xmldoc.at("//gbmandate")&.text || "mandatory"
202
- idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
203
- id.content = idtext&.gsub(/\&#x2002;/, " ")
204
- id = xmldoc.at("//bibdata/ext/structuredidentifier/"\
205
- "project-number") or return
206
- idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
207
- id.content = idtext&.gsub(/\&#x2002;/, " ")
208
- end
209
-
210
- def committee_cleanup(xmldoc)
211
- xmldoc.xpath("//gbcommittee").each do |c|
212
- xmldoc.at("//bibdata/contributor").next =
213
- "<contributor><role type='technical-committee'/><organization>"\
214
- "<name>#{c.text}</name></organization></contributor>"
215
- end
216
- end
217
-
218
- def agency_value(issuer, scope, prefix, mandate)
219
- agency = issuer.content
220
- agency == "GB" and
221
- agency = @agencyclass.standard_agency1(scope, prefix, mandate)
222
- agency = "GB" if agency.nil? || agency.empty?
223
- agency
224
- end
225
-
226
- def contributor_cleanup(xmldoc)
227
- issuer = xmldoc.at("//bibdata/contributor[role/@type = 'issuer']/"\
228
- "organization/name")
229
- scope = xmldoc.at("//gbscope")&.text
230
- prefix = xmldoc.at("//gbprefix")&.text
231
- mandate = xmldoc.at("//gbmandate")&.text || "mandatory"
232
- agency = agency_value(issuer, scope, prefix, mandate)
233
- owner = xmldoc.at("//copyright/owner/organization/name")
234
- owner.content = agency
235
- issuer.content = agency
236
- committee_cleanup(xmldoc)
237
- end
238
-
239
- def omit_docid_prefix(prefix)
240
- IsoDoc::Gb::HtmlConvert.new({}).omit_docid_prefix(prefix)
241
- end
242
-
243
- def boilerplate_cleanup(xmldoc)
244
- isodoc = boilerplate_isodoc(xmldoc)
245
- initial_boilerplate(xmldoc, isodoc)
246
- return if @keepboilerplate
247
- xmldoc.xpath(self.class::TERM_CLAUSE).each do |f|
248
- term_defs_boilerplate(f.at("./title"),
249
- xmldoc.xpath(".//termdocsource"),
250
- f.at(".//term"), f.at(".//p"), isodoc)
251
- end
252
- f = xmldoc.at(self.class::NORM_REF) and
253
- norm_ref_preface(f)
254
143
  end
255
144
  end
256
145
  end
@@ -1,7 +1,7 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
3
  class Converter < ISO::Converter
4
- STAGE_ABBRS_CN = {
4
+ STAGE_ABBRS_CN = {
5
5
  "00": "新工作项目建议",
6
6
  "10": "新工作项目",
7
7
  "20": "标准草案工作组讨论稿",
@@ -43,9 +43,9 @@ module Asciidoctor
43
43
 
44
44
  def id_stage_prefix(dn, node)
45
45
  if node.attr("docstage") && node.attr("docstage").to_i < 60
46
- abbr = IsoDoc::Gb::Metadata.new("en", "Latn", {}).
46
+ abbr = IsoDoc::Gb::Metadata.new("en", "Latn", @i18n).
47
47
  status_abbrev(node.attr("docstage"), nil, node.attr("iteration"),
48
- node.attr("draft"), node.attr("doctype"))
48
+ node.attr("draft"), doctype(node))
49
49
  dn = "/#{abbr} #{dn}" # prefixes added in cleanup
50
50
  else
51
51
  dn += "-#{node.attr("copyright-year")}" if node.attr("copyright-year")
@@ -42,8 +42,11 @@
42
42
  </define>
43
43
  <define name="xref">
44
44
  <element name="xref">
45
+ <!-- attribute target { xsd:IDREF }, -->
45
46
  <attribute name="target">
46
- <data type="IDREF"/>
47
+ <data type="string">
48
+ <param name="pattern">\i\c*|\c+#\c+</param>
49
+ </data>
47
50
  </attribute>
48
51
  <optional>
49
52
  <attribute name="type">
@@ -922,6 +925,9 @@
922
925
  <optional>
923
926
  <attribute name="script"/>
924
927
  </optional>
928
+ <optional>
929
+ <attribute name="type"/>
930
+ </optional>
925
931
  <optional>
926
932
  <attribute name="obligation">
927
933
  <choice>
@@ -961,9 +967,6 @@
961
967
  </define>
962
968
  <define name="content-subsection">
963
969
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
970
  <ref name="Content-Section"/>
968
971
  </element>
969
972
  </define>
@@ -992,6 +995,9 @@
992
995
  </choice>
993
996
  </attribute>
994
997
  </optional>
998
+ <optional>
999
+ <attribute name="type"/>
1000
+ </optional>
995
1001
  <optional>
996
1002
  <ref name="section-title"/>
997
1003
  </optional>
@@ -1011,9 +1017,6 @@
1011
1017
  </define>
1012
1018
  <define name="clause">
1013
1019
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1020
  <ref name="Clause-Section"/>
1018
1021
  </element>
1019
1022
  </define>
@@ -1042,6 +1045,9 @@
1042
1045
  </choice>
1043
1046
  </attribute>
1044
1047
  </optional>
1048
+ <optional>
1049
+ <attribute name="type"/>
1050
+ </optional>
1045
1051
  <optional>
1046
1052
  <ref name="section-title"/>
1047
1053
  </optional>
@@ -1180,6 +1186,9 @@
1180
1186
  <optional>
1181
1187
  <attribute name="script"/>
1182
1188
  </optional>
1189
+ <optional>
1190
+ <attribute name="type"/>
1191
+ </optional>
1183
1192
  <optional>
1184
1193
  <attribute name="obligation">
1185
1194
  <choice>
@@ -8,6 +8,8 @@ module Asciidoctor
8
8
  class Converter < ISO::Converter
9
9
  def sectiontype_streamline(ret)
10
10
  case ret
11
+ when "前言" then "foreword"
12
+ when "致謝" then "acknowledgements"
11
13
  when "引言" then "introduction"
12
14
  when "范围" then "scope"
13
15
  when "规范性引用文件" then "normative references"
@@ -21,6 +23,15 @@ module Asciidoctor
21
23
  end
22
24
  end
23
25
 
26
+ def symbols_attrs(node, a)
27
+ case sectiontype1(node)
28
+ when "符号" then a.merge(type: "symbols")
29
+ when "代号和缩略语" then a.merge(type: "abbreviated_terms")
30
+ else
31
+ super
32
+ end
33
+ end
34
+
24
35
  def appendix_parse(attrs, xml, node)
25
36
  # UNSAFE, there is no unset_option() in asciidoctor
26
37
  node.remove_attr("appendix-option")
@@ -1,7 +1,6 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
3
  class Converter < ISO::Converter
4
-
5
4
  def validate(doc)
6
5
  content_validate(doc)
7
6
  schema_validate(formattedstr_strip(doc.dup),
@@ -1,7 +1,6 @@
1
1
  require_relative "common"
2
2
  require "gb_agencies"
3
3
  require_relative "cleanup"
4
- require_relative "metadata"
5
4
  require "fileutils"
6
5
 
7
6
  module IsoDoc
@@ -16,18 +15,9 @@ module IsoDoc
16
15
  "$titlefont: #{t};\n"
17
16
  end
18
17
 
19
- def metadata_init(lang, script, labels)
20
- unless ["en", "zh"].include? lang
21
- lang = "zh"
22
- script = "Hans"
23
- end
24
- @meta = Metadata.new(lang, script, labels)
25
- @meta.set(:standardclassimg, @standardclassimg)
26
- @common.meta = @meta
27
- end
28
-
29
18
  def cleanup(docxml)
30
- @cleanup = Cleanup.new(@script, @deprecated_lbl)
19
+ @i18n ||= i18n_init(@lang, @script)
20
+ @cleanup = Cleanup.new(@script, @i18n.deprecated)
31
21
  super
32
22
  @cleanup.cleanup(docxml)
33
23
  docxml
@@ -38,43 +28,26 @@ module IsoDoc
38
28
  @cleanup.example_cleanup(docxml)
39
29
  end
40
30
 
41
- def i18n_init(lang, script)
42
- super
43
- y = if lang == "en"
44
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
45
- elsif lang == "zh" && script == "Hans"
46
- YAML.load_file(File.join(File.dirname(__FILE__),
47
- "i18n-zh-Hans.yaml"))
48
- else
49
- YAML.load_file(File.join(File.dirname(__FILE__),
50
- "i18n-zh-Hans.yaml"))
51
- end
52
- @labels = @labels.merge(y)
53
- end
54
-
55
31
  def omit_docid_prefix(prefix)
56
32
  super || prefix == "Chinese Standard"
57
33
  end
58
34
 
59
- def formula_parse(node, out)
60
- out.div **formula_attrs(node) do |div1|
61
- div1.div **attr_code(class: "formula") do |div|
35
+ def formula_parse1(node, out)
36
+ out.div **attr_code(class: "formula") do |div|
62
37
  insert_tab(div, 1)
63
38
  parse(node.at(ns("./stem")), div)
64
- lbl = @xrefs.anchor(node['id'], :label, false)
39
+ lbl = node&.at(ns("./name"))&.text
65
40
  unless lbl.nil?
66
41
  insert_tab(div, 1)
67
42
  div << "(#{lbl})"
68
43
  end
69
44
  end
70
- formula_where(node.at(ns("./dl")), div1)
71
- end
72
45
  end
73
46
 
74
47
  def formula_where(dl, out)
75
48
  return unless dl
76
49
  out.p **{ style: "page-break-after:avoid;"} do |p|
77
- p << @where_lbl
50
+ p << @i18n.where
78
51
  end
79
52
  formula_dl_parse(dl, out)
80
53
  end
@@ -99,32 +72,37 @@ module IsoDoc
99
72
  { class: "example_label",
100
73
  style: "padding:2pt 2pt 2pt 2pt;vertical-align:top;" }.freeze
101
74
 
102
- def example_label(node)
103
- l10n(super + ":")
75
+ def note_delim
76
+ l10n(": ")
104
77
  end
105
78
 
106
79
  def note_parse(node, out)
107
- note_parse_table(node, out, note_label(node) + ":")
80
+ note_parse_table(node, out)
108
81
  end
109
82
 
110
- def note_parse_table(node, out, label)
83
+ def note_parse_table(node, out)
111
84
  @note = true
85
+ name = node&.at(ns("./name"))&.remove
86
+ note_parse_table1(node, out, name)
87
+ @note = false
88
+ end
89
+
90
+ def note_parse_table1(node, out, name)
112
91
  out.table **note_attrs(node) do |t|
113
92
  t.tr do |tr|
114
- @libdir = File.dirname(__FILE__)
115
93
  tr.td **EXAMPLE_TBL_ATTR do |td|
116
- td << l10n(label)
94
+ name and name.children.each { |n| parse(n, td) }
95
+ td << note_delim
117
96
  end
118
97
  tr.td **{ style: "vertical-align:top;", class: "Note" } do |td|
119
98
  node.children.each { |n| parse(n, td) }
120
99
  end
121
100
  end
122
101
  end
123
- @note = false
124
102
  end
125
103
 
126
104
  def termnote_parse(node, out)
127
- note_parse_table(node, out, "#{@xrefs.anchor(node['id'], :label)}:")
105
+ note_parse_table(node, out)
128
106
  end
129
107
 
130
108
  def middle(isoxml, out)
@@ -157,19 +135,19 @@ module IsoDoc
157
135
 
158
136
  def deprecated_term_parse(node, out)
159
137
  out.p **{ class: "DeprecatedTerms" } do |p|
160
- p << l10n("#{@deprecated_lbl}: ")
138
+ p << l10n("#{@i18n.deprecated}: ")
161
139
  node.children.each { |c| parse(c, p) }
162
140
  end
163
141
  end
164
142
 
165
143
  def termref_render(x)
166
- x.sub!(%r{\s*\[MODIFICATION\]\s*$}m, l10n(", #{@modified_lbl}"))
144
+ x.sub!(%r{\s*\[MODIFICATION\]\s*$}m, l10n(", #{@i18n.modified}"))
167
145
  parts = x.split(%r{(\s*\[MODIFICATION\]|,)}m)
168
- parts[1] = l10n(", #{@source_lbl}") if parts.size > 1 &&
169
- parts[1] == "," && !/^\s*#{@modified_lbl}/.match(parts[2])
146
+ parts[1] = l10n(", #{@i18n.source}") if parts.size > 1 &&
147
+ parts[1] == "," && !/^\s*#{@i18n.modified}/.match(parts[2])
170
148
  parts.map do |p|
171
149
  /\s*\[MODIFICATION\]/.match(p) ?
172
- l10n(", #{@modified_lbl} &mdash; ") : p
150
+ l10n(", #{@i18n.modified} &mdash; ") : p
173
151
  end.join.sub(/\A\s*/m, l10n("[")).sub(/\s*\z/m, l10n("]"))
174
152
  end
175
153
 
@@ -181,42 +159,12 @@ module IsoDoc
181
159
  end.join
182
160
  end
183
161
 
184
- def foreword(isoxml, out)
185
- f = isoxml.at(ns("//foreword")) || return
186
- page_break(out)
187
- out.div do |s|
188
- s.h1 **{ class: "ForewordTitle" } do |h1|
189
- h1 << "#{@foreword_lbl}&nbsp;"
190
- # insert_tab(h1, 1)
191
- end
192
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
193
- end
194
- end
195
-
196
162
  def clausedelimspace(out)
197
163
  out << "&#x3000;"
198
164
  end
199
165
 
200
- def clause_name(num, title, div, header_class)
201
- header_class = {} if header_class.nil?
202
- div.h1 **attr_code(header_class) do |h1|
203
- if num && !@suppressheadingnumbers
204
- h1 << "#{num}."
205
- h1 << "&#x3000;"
206
- end
207
- title.is_a?(String) ? h1 << title :
208
- title&.children&.each { |c2| parse(c2, h1) }
209
- end
210
- div.parent.at(".//h1")
211
- end
212
-
213
166
  def example_span_label(node, div, name)
214
- n = @xrefs.get[node["id"]]
215
167
  div.span **{ class: "example_label" } do |p|
216
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
217
- l10n("#{@example_lbl} #{n[:label]}")
218
- p << l10n(lbl + ":")
219
- name and !lbl.nil? and p << "&nbsp;&mdash; "
220
168
  name and name.children.each { |n| parse(n, div) }
221
169
  end
222
170
  end