metanorma-itu 1.1.3 → 1.2.0

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: b7125f1d6d17254c0460f7398d24a43683b2099bc07f0cd7c483ce2725ab847b
4
- data.tar.gz: bb3b19af63382c527698bdb6402cc314f6e0fd0dfd3e90e6fae6d64d6afe5918
3
+ metadata.gz: c4a8298c94b775bf0894357ab7885d198d4aad3da9893b45f610ff27cde287bc
4
+ data.tar.gz: 10411a7522e3bf6a4b4a523125b037fc75470d2bfa7918215742c81cae2d6a6b
5
5
  SHA512:
6
- metadata.gz: 8637b27bbb50cc729c8be856154330a9cd6ba7fdd60dcc3eb5f3605609fd62384e266e92370178fc603585330522e38fdde42fed426eeab9c5237f2072945c5b
7
- data.tar.gz: 8ae3568058d7a603c2f875eaaea6f507874249b4ed6bfafca084a220a416cf8186f0c48f6f12fe23b4545f3eddd7055fc7e5385892c250f21c5f38e114f2eea9
6
+ metadata.gz: 6c497e515e567f5b92710c254570562db5d9c99d5f1b7299e818f1d27d66e51dd676e9b37deb0cb82376db08a8a249dd711418addc17b5052d78c3bba69cd479
7
+ data.tar.gz: 0d691088240f6ff1fa63ecb92a8137e35d10d32d5e4d823695e3937c8caedc4e1837523ec4015de48088a439131391e69bddb4db18ffef7f0865765483f715bf
@@ -4,6 +4,7 @@ module Asciidoctor
4
4
  def sections_cleanup(x)
5
5
  super
6
6
  insert_missing_sections(x) unless @no_insert_missing_sections
7
+ insert_empty_clauses(x)
7
8
  end
8
9
 
9
10
  def table_cleanup(xmldoc)
@@ -22,15 +23,20 @@ module Asciidoctor
22
23
  insert_conventions(x)
23
24
  end
24
25
 
26
+ def add_id
27
+ %(id="_#{UUIDTools::UUID.random_create}")
28
+ end
29
+
25
30
  def insert_scope(x)
26
31
  x.at("./*/sections") or
27
32
  x.at("./*/preface | ./*/boilerplate | ./*/bibdata").next =
28
33
  "<sections><sentinel/></sections>"
29
34
  x.at("./*/sections/*") or x.at("./*/sections") << "<sentinel/>"
30
35
  ins = x.at("//sections").elements.first
31
- unless x.at("//sections/clause/title[text() = 'Scope']")
32
- ins.previous = "<clause><title>Scope</title><p>"\
33
- "#{@labels['clause_empty']}</p></clause>"
36
+ unless x.at("//sections/clause[@type = 'scope']")
37
+ ins.previous =
38
+ "<clause type='scope' #{add_id}><title>#{@i18n.scope}</title><p>"\
39
+ "#{@i18n.clause_empty}</p></clause>"
34
40
  end
35
41
  x&.at("//sentinel")&.remove
36
42
  end
@@ -41,19 +47,16 @@ module Asciidoctor
41
47
  "<bibliography><sentinel/></bibliography>"
42
48
  ins = x.at("//bibliography").elements.first
43
49
  unless x.at("//bibliography/references[@normative = 'true']")
44
- #ins.previous = "<references normative='true'><title>References</title><p>"\
45
- # "#{@labels['clause_empty']}</p></references>"
46
- ins.previous = "<references normative='true'><title>References</title>"\
47
- "</references>"
50
+ ins.previous = "<references #{add_id} normative='true'>"\
51
+ "<title>#{@i18n.normref}</title></references>"
48
52
  end
49
53
  x&.at("//sentinel")&.remove
50
54
  end
51
55
 
52
56
  def insert_terms(x)
53
- ins = x.at("//sections/clause/title[text() = 'Scope']/..")
57
+ ins = x.at("//sections/clause[@type = 'scope']")
54
58
  unless x.at("//sections//terms")
55
- ins.next = "<terms><title>Definitions</title><p>"\
56
- "#{@labels['clause_empty']}</p></terms>"
59
+ ins.next = "<terms #{add_id}><title>#{@i18n.termsdef}</title></terms>"
57
60
  end
58
61
  end
59
62
 
@@ -61,19 +64,34 @@ module Asciidoctor
61
64
  ins = x.at("//sections/terms") ||
62
65
  x.at("//sections/clause[descendant::terms]")
63
66
  unless x.at("//sections//definitions")
64
- ins.next = "<definitions><title>Abbreviations and acronyms</title><p>"\
65
- "#{@labels['clause_empty']}</p></definitions>"
67
+ ins.next = "<definitions #{add_id}>"\
68
+ "<title>#{@i18n.symbolsabbrev}</title></definitions>"
66
69
  end
67
70
  end
68
71
 
69
72
  def insert_conventions(x)
70
73
  ins = x.at("//sections//definitions") ||
71
74
  x.at("//sections/clause[descendant::definitions]")
72
- unless x.at("//sections/clause/title[text() = 'Conventions']")
73
- ins.next = "<clause id='_#{UUIDTools::UUID.random_create}'>"\
74
- "<title>Conventions</title><p>"\
75
- "#{@labels['clause_empty']}</p></clause>"
75
+ unless x.at("//sections/clause[@type = 'conventions']")
76
+ ins.next = "<clause #{add_id} type='conventions'>"\
77
+ "<title>#{@i18n.conventions}</title><p>"\
78
+ "#{@i18n.clause_empty}</p></clause>"
79
+ end
80
+ end
81
+
82
+ def insert_empty_clauses(x)
83
+ x.xpath("//terms[not(./term)][not(.//terms)]").each do |c|
84
+ insert_empty_clauses1(c, @i18n.clause_empty)
76
85
  end
86
+ x.xpath("//definitions[not(./dl)]").each do |c|
87
+ insert_empty_clauses1(c, @i18n.clause_empty)
88
+ end
89
+ end
90
+
91
+ def insert_empty_clauses1(c, text)
92
+ c.at("./p") and return
93
+ ins = c.at("./title") or return
94
+ ins.next = "<p>#{text}</p>"
77
95
  end
78
96
 
79
97
  def cleanup(xmldoc)
@@ -94,24 +112,46 @@ module Asciidoctor
94
112
  xmldoc
95
113
  end
96
114
 
97
- def termdef_cleanup(xmldoc)
98
- xmldoc.xpath("//term/preferred").each do |p|
99
- if ["terms defined elsewhere",
100
- "terms defined in this recommendation"].include? p.text.downcase
101
- p.name = "title"
102
- p.parent.name = "terms"
103
- end
104
- end
105
- super
115
+ def termdef_boilerplate_cleanup(xmldoc)
106
116
  end
107
117
 
108
- def termdef_boilerplate_cleanup(xmldoc)
118
+ def terms_extract(div)
119
+ internal = div.at("./terms[@type = 'internal']/title")
120
+ external = div.at("./terms[@type = 'external']/title")
121
+ [internal, external]
122
+ end
123
+
124
+ def term_defs_boilerplate(div, source, term, preface, isodoc)
125
+ internal, external = terms_extract(div.parent)
126
+ internal&.next_element&.name == "term" and
127
+ internal.next = "<p>#{@i18n.internal_terms_boilerplate}</p>"
128
+ internal and internal&.next_element == nil and
129
+ internal.next = "<p>#{@i18n.no_terms_boilerplate}</p>"
130
+ external&.next_element&.name == "term" and
131
+ external.next = "<p>#{@i18n.external_terms_boilerplate}</p>"
132
+ external and external&.next_element == nil and
133
+ external.next = "<p>#{@i18n.no_terms_boilerplate}</p>"
134
+ !internal and !external and
135
+ %w(term terms).include? div&.next_element&.name and
136
+ div.next = "<p>#{@i18n.term_def_boilerplate}</p>"
137
+ end
138
+
139
+ def section_names_terms_cleanup(x)
140
+ super
141
+ replace_title(
142
+ x, "//terms[@type = 'internal'] | "\
143
+ "//clause[./terms[@type = 'internal']][not(./terms[@type = 'external'])]",
144
+ @i18n&.internal_termsdef)
145
+ replace_title(
146
+ x, "//terms[@type = 'external'] | "\
147
+ "//clause[./terms[@type = 'external']][not(./terms[@type = 'internal'])]",
148
+ @i18n&.external_termsdef)
109
149
  end
110
150
 
111
151
  def symbols_cleanup(xmldoc)
112
152
  sym = xmldoc.at("//definitions/title")
113
153
  sym and sym&.next_element&.name == "dl" and
114
- sym.next = "<p>#{@symbols_boilerplate}</p>"
154
+ sym.next = "<p>#{@i18n.symbols_boilerplate}</p>"
115
155
  end
116
156
 
117
157
  PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
@@ -160,13 +200,6 @@ module Asciidoctor
160
200
  biblio_reorder1(r)
161
201
  end
162
202
  end
163
-
164
- def normref_cleanup(xmldoc)
165
- super
166
- r = xmldoc.at(NORM_REF) || return
167
- title = r.at("./title") and
168
- title.content = "References"
169
- end
170
203
  end
171
204
  end
172
205
  end
@@ -56,9 +56,12 @@ module Asciidoctor
56
56
  def outputs(node, ret)
57
57
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
58
58
  presentation_xml_converter(node).convert(@filename + ".xml")
59
- html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
60
- doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
61
- pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
59
+ html_converter(node).convert(@filename + ".presentation.xml",
60
+ nil, false, "#{@filename}.html")
61
+ doc_converter(node).convert(@filename + ".presentation.xml",
62
+ nil, false, "#{@filename}.doc")
63
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
64
+ nil, false, "#{@filename}.pdf")
62
65
  end
63
66
 
64
67
  def validate(doc)
@@ -76,56 +79,22 @@ module Asciidoctor
76
79
  when "definitions" then "terms and definitions"
77
80
  when "abbreviations and acronyms" then "symbols and abbreviated terms"
78
81
  when "references" then "normative references"
82
+ when "terms defined elsewhere" then "terms and definitions"
83
+ when "terms defined in this recommendation" then "terms and definitions"
79
84
  else
80
85
  super
81
86
  end
82
87
  end
83
88
 
84
- def term_def_title(toplevel, node)
85
- return node.title unless toplevel
86
- "Definitions"
87
- end
88
-
89
- def terms_extract(div)
90
- internal = nil
91
- external = nil
92
- div.parent.xpath("./terms/title").each do |t|
93
- case t&.text&.downcase
94
- when "terms defined elsewhere" then external = t
95
- when "terms defined in this recommendation" then internal = t
96
- end
89
+ def term_def_subclause_parse(attrs, xml, node)
90
+ case clausetype = sectiontype1(node)
91
+ when "terms defined in this recommendation"
92
+ term_def_parse(attrs.merge(type: "internal"), xml, node, false)
93
+ when "terms defined elsewhere"
94
+ term_def_parse(attrs.merge(type: "external"), xml, node, false)
95
+ else
96
+ super
97
97
  end
98
- [internal, external]
99
- end
100
-
101
- def term_defs_boilerplate(div, source, term, preface, isodoc)
102
- internal, external = terms_extract(div)
103
- internal&.next_element&.name == "term" and
104
- internal.next = "<p>#{@internal_terms_boilerplate}</p>"
105
- internal and internal&.next_element == nil and
106
- internal.next = "<p>#{@no_terms_boilerplate}</p>"
107
- external&.next_element&.name == "term" and
108
- external.next = "<p>#{@external_terms_boilerplate}</p>"
109
- external and external&.next_element == nil and
110
- external.next = "<p>#{@no_terms_boilerplate}</p>"
111
- !internal and !external and
112
- %w(term terms).include? div&.next_element&.name and
113
- div.next = "<p>#{@term_def_boilerplate}</p>"
114
- end
115
-
116
- def load_yaml(lang, script)
117
- y = if @i18nyaml then YAML.load_file(@i18nyaml)
118
- elsif lang == "en"
119
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
120
- else
121
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
122
- end
123
- @symbols_boilerplate = y["symbols_boilerplate"] || ""
124
- super.merge(y)
125
- end
126
-
127
- def i18n_init(lang, script)
128
- super
129
98
  end
130
99
 
131
100
  def metadata_keywords(node, xml)
@@ -135,6 +104,17 @@ module Asciidoctor
135
104
  end
136
105
  end
137
106
 
107
+ def clause_parse(attrs, xml, node)
108
+ case clausetype = sectiontype1(node)
109
+ when "conventions" then attrs = attrs.merge(type: "conventions")
110
+ when "history"
111
+ attrs[:preface] and attrs = attrs.merge(type: "history")
112
+ when "source"
113
+ attrs[:preface] and attrs = attrs.merge(type: "source")
114
+ end
115
+ super
116
+ end
117
+
138
118
  def html_extract_attributes(node)
139
119
  super.merge(hierarchical_assets: node.attr("hierarchical-object-numbering"))
140
120
  end
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -12,13 +12,16 @@ module Asciidoctor
12
12
  recommendation-corrigendum recommendation-errata recommendation-annex
13
13
  focus-group implementers-guide technical-paper technical-report
14
14
  joint-itu-iso-iec).include? doctype or
15
- @log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
15
+ @log.add("Document Attributes", nil,
16
+ "#{doctype} is not a recognised document type")
16
17
  end
17
18
 
18
19
  def stage_validate(xmldoc)
19
20
  stage = xmldoc&.at("//bibdata/status/stage")&.text
20
- %w(in-force superseded in-force-prepublished withdrawn draft).include? stage or
21
- @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
21
+ %w(in-force superseded in-force-prepublished withdrawn
22
+ draft).include? stage or
23
+ @log.add("Document Attributes", nil,
24
+ "#{stage} is not a recognised status")
22
25
  end
23
26
 
24
27
  def content_validate(doc)
@@ -38,7 +41,8 @@ module Asciidoctor
38
41
  xmldoc.xpath("//bibdata/series/title").each do |s|
39
42
  series = s.text.sub(/^[A-Z]: /, "")
40
43
  t.downcase.include?(series.downcase) and
41
- @log.add("Document Attributes", nil, "Title includes series name #{series}")
44
+ @log.add("Document Attributes", nil,
45
+ "Title includes series name #{series}")
42
46
  end
43
47
  end
44
48
 
@@ -56,7 +60,8 @@ module Asciidoctor
56
60
  xmldoc.xpath("//preface/*").each do |c|
57
61
  extract_text(c).split(/\.\s+/).each do |t|
58
62
  /\b(shall|must)\b/i.match(t) and
59
- @log.add("Style", c, "Requirement possibly in preface: #{t.strip}")
63
+ @log.add("Style", c,
64
+ "Requirement possibly in preface: #{t.strip}")
60
65
  end
61
66
  end
62
67
  end
@@ -86,20 +91,24 @@ module Asciidoctor
86
91
  end
87
92
 
88
93
  def approval_validate(xmldoc)
89
- s = xmldoc.at("//bibdata/ext/recommendationstatus/approvalstage") || return
94
+ s = xmldoc.at("//bibdata/ext/recommendationstatus/approvalstage") or
95
+ return
90
96
  process = s["process"]
91
97
  if process == "aap" and %w(determined in-force).include? s.text
92
- @log.add("Document Attributes", nil, "Recommendation Status #{s.text} inconsistent with AAP")
98
+ @log.add("Document Attributes", nil,
99
+ "Recommendation Status #{s.text} inconsistent with AAP")
93
100
  end
94
101
  if process == "tap" and !%w(determined in-force).include? s.text
95
- @log.add("Document Attributes", nil, "Recommendation Status #{s.text} inconsistent with TAP")
102
+ @log.add("Document Attributes", nil,
103
+ "Recommendation Status #{s.text} inconsistent with TAP")
96
104
  end
97
105
  end
98
106
 
99
107
  def itu_identifier_validate(xmldoc)
100
108
  s = xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x|
101
109
  /^ITU-[RTF] [AD-VX-Z]\.[0-9]+$/.match(x.text) or
102
- @log.add("Style", nil, "#{x.text} does not match ITU document identifier conventions")
110
+ @log.add("Style", nil, "#{x.text} does not match ITU document "\
111
+ "identifier conventions")
103
112
  end
104
113
  end
105
114
 
@@ -121,8 +130,10 @@ module Asciidoctor
121
130
  para = t.at("./definition") || return
122
131
  term = t.at("./preferred").text
123
132
  termdef_warn(term, /^[A-Z][a-z]+/, t, term, "term is not lowercase")
124
- termdef_warn(para.text, /^[a-z]/, t, term, "term definition does not start with capital")
125
- termdef_warn(para.text, /[^.]$/, t, term, "term definition does not end with period")
133
+ termdef_warn(para.text, /^[a-z]/, t, term,
134
+ "term definition does not start with capital")
135
+ termdef_warn(para.text, /[^.]$/, t, term,
136
+ "term definition does not end with period")
126
137
  end
127
138
  end
128
139
 
@@ -1,5 +1,4 @@
1
1
  require "isodoc"
2
- require_relative "metadata"
3
2
  require "fileutils"
4
3
  require_relative "./ref.rb"
5
4
  require_relative "./xref.rb"
@@ -8,32 +7,13 @@ require_relative "./terms.rb"
8
7
  module IsoDoc
9
8
  module ITU
10
9
  module BaseConvert
11
- def load_yaml(lang, script)
12
- y = if @i18nyaml then YAML.load_file(@i18nyaml)
13
- elsif lang == "en"
14
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
15
- else
16
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
17
- end
18
- super.merge(y)
19
- end
20
-
21
- def metadata_init(lang, script, labels)
22
- @meta = Metadata.new(lang, script, labels)
23
- end
24
-
25
- def xref_init(lang, script, klass, labels, options)
26
- @xrefs = Xref.new(lang, script, klass, labels,
27
- options.merge(hierarchical_assets: @hierarchical_assets))
28
- end
29
-
30
10
  FRONT_CLAUSE = "//*[parent::preface]"\
31
11
  "[not(local-name() = 'abstract')]".freeze
32
12
 
33
13
  def preface(isoxml, out)
34
14
  isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
35
15
  title = c&.at(ns("./title"))
36
- out.div **attr_code(id: c["id"]) do |s|
16
+ out.div **attr_code(clause_attrs(c)) do |s|
37
17
  clause_name(nil, title, s, class: "IntroTitle")
38
18
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
39
19
  parse(c1, s)
@@ -52,15 +32,8 @@ module IsoDoc
52
32
  ""
53
33
  end
54
34
 
55
- def note_label(node)
56
- n = @xrefs.get[node["id"]]
57
- (n.nil? || n[:label].nil? || n[:label].empty?) and
58
- return "#{@note_lbl} &ndash; "
59
- l10n("#{@note_lbl} #{n[:label]} &ndash; ")
60
- end
61
-
62
- def prefix_container(container, linkend, _target)
63
- l10n("#{linkend} #{@labels["in"]} #{@xrefs.anchor(container, :xref)}")
35
+ def note_delim
36
+ " &ndash; "
64
37
  end
65
38
 
66
39
  def ol_depth(node)
@@ -78,12 +51,7 @@ module IsoDoc
78
51
  def annex_name(annex, name, div)
79
52
  r_a = @meta.get[:doctype_original] == "recommendation-annex"
80
53
  div.h1 **{ class: r_a ? "RecommendationAnnex" : "Annex" } do |t|
81
- t << "#{@xrefs.anchor(annex['id'], :label)} "
82
- t.br
83
- t.br
84
- t.b do |b|
85
- name&.children&.each { |c2| parse(c2, b) }
86
- end
54
+ name&.children&.each { |c2| parse(c2, t) }
87
55
  end
88
56
  annex_obligation_subtitle(annex, div)
89
57
  end
@@ -91,34 +59,26 @@ module IsoDoc
91
59
  def annex_obligation_subtitle(annex, div)
92
60
  info = annex["obligation"] == "informative"
93
61
  div.p **{class: "annex_obligation" } do |p|
94
- p << (info ? @inform_annex_lbl : @norm_annex_lbl).
62
+ p << (info ? @i18n.inform_annex : @i18n.norm_annex).
95
63
  sub(/%/, @meta.get[:doctype] || "")
96
64
  end
97
65
  end
98
66
 
99
67
  def annex(isoxml, out)
100
- isoxml.xpath(ns("//annex")).each do |c|
101
- @meta.get[:doctype_original] == "recommendation-annex" or
102
- page_break(out)
103
- out.div **attr_code(id: c["id"], class: "Section3") do |s|
104
- annex_name(c, nil, s) unless c.at(ns("./title"))
105
- c.elements.each do |c1|
106
- if c1.name == "title" then annex_name(c, c1, s)
107
- else
108
- parse(c1, s)
68
+ isoxml.xpath(ns("//annex")).each do |c|
69
+ @meta.get[:doctype_original] == "recommendation-annex" or
70
+ page_break(out)
71
+ out.div **attr_code(id: c["id"], class: "Section3") do |s|
72
+ annex_name(c, nil, s) unless c.at(ns("./title"))
73
+ c.elements.each do |c1|
74
+ if c1.name == "title" then annex_name(c, c1, s)
75
+ else
76
+ parse(c1, s)
77
+ end
109
78
  end
110
79
  end
111
80
  end
112
81
  end
113
- end
114
-
115
- def i18n_init(lang, script)
116
- super
117
- end
118
-
119
- def fileloc(loc)
120
- File.join(File.dirname(__FILE__), loc)
121
- end
122
82
 
123
83
  def cleanup(docxml)
124
84
  super
@@ -136,18 +96,26 @@ module IsoDoc
136
96
  end
137
97
 
138
98
  def term_cleanup(docxml)
99
+ term_cleanup1(docxml)
100
+ term_cleanup2(docxml)
101
+ docxml
102
+ end
103
+
104
+ def term_cleanup1(docxml)
139
105
  docxml.xpath("//p[@class = 'Terms']").each do |d|
140
106
  h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
141
107
  d.children.first.previous = "<b>#{h2.children.to_xml}</b>&nbsp;"
142
108
  d["id"] = h2["id"]
143
109
  h2.remove
144
110
  end
111
+ end
112
+
113
+ def term_cleanup2(docxml)
145
114
  docxml.xpath("//p[@class = 'TermNum']").each do |d|
146
115
  d1 = d.next_element and d1.name == "p" or next
147
116
  d1.children.each { |e| e.parent = d }
148
117
  d1.remove
149
118
  end
150
- docxml
151
119
  end
152
120
 
153
121
  def refs_cleanup(docxml)
@@ -167,29 +135,6 @@ module IsoDoc
167
135
  super
168
136
  end
169
137
 
170
- def get_eref_linkend(node)
171
- l = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
172
- l && !/^\[.*\]$/.match(l) and l = "[#{l}]"
173
- l += eref_localities(node.xpath(ns("./locality | ./localityStack")), l)
174
- contents = node.children.select do |c|
175
- !%w{locality localityStack}.include? c.name
176
- end
177
- return l if contents.nil? || contents.empty?
178
- Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
179
- end
180
-
181
- def eref_parse(node, out)
182
- linkend = get_eref_linkend(node)
183
- href = eref_target(node)
184
- if node["type"] == "footnote"
185
- out.sup do |s|
186
- s.a(**{ "href": href }) { |l| l << linkend }
187
- end
188
- else
189
- out.a(**{ "href": href }) { |l| l << linkend }
190
- end
191
- end
192
-
193
138
  def middle_title(out)
194
139
  out.p(**{ class: "zzSTDTitle1" }) do |p|
195
140
  id = @meta.get[:docnumber] and p << "#{@meta.get[:doctype]} #{id}"
@@ -221,9 +166,11 @@ module IsoDoc
221
166
  end
222
167
 
223
168
  def note_p_parse(node, div)
169
+ name = node&.at(ns("./name"))&.remove
224
170
  div.p do |p|
225
- p.span **{ class: "note_label" } do |s|
226
- s << note_label(node)
171
+ name and p.span **{ class: "note_label" } do |s|
172
+ name.children.each { |n| parse(n, s) }
173
+ s << note_delim
227
174
  end
228
175
  node.first_element_child.children.each { |n| parse(n, p) }
229
176
  end
@@ -231,9 +178,11 @@ module IsoDoc
231
178
  end
232
179
 
233
180
  def note_parse1(node, div)
181
+ name = node&.at(ns("./name"))&.remove
234
182
  div.p do |p|
235
- p.span **{ class: "note_label" } do |s|
236
- s << note_label(node)
183
+ name and p.span **{ class: "note_label" } do |s|
184
+ name.children.each { |n| parse(n, s) }
185
+ #s << note_delim
237
186
  end
238
187
  end
239
188
  node.children.each { |n| parse(n, div) }