metanorma-standoc 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,17 +38,19 @@ module Asciidoctor
38
38
  end
39
39
  end
40
40
 
41
- def norm_ref_preface(f)
42
- refs = f.elements.select do |e|
43
- ["reference", "bibitem"].include? e.name
41
+ def norm_ref_preface(ref)
42
+ refs = ref.elements.select do |e|
43
+ %w(references bibitem).include? e.name
44
44
  end
45
- f.at("./title").next =
46
- "<p>#{(refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref)}</p>"
45
+ pref = refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref
46
+ ref.at("./title").next = "<p>#{pref}</p>"
47
47
  end
48
48
 
49
- TERM_CLAUSE = "//sections/terms | //sections/clause[descendant::terms]".freeze
49
+ TERM_CLAUSE = "//sections/terms | "\
50
+ "//sections/clause[descendant::terms]".freeze
50
51
 
51
- NORM_REF = "//bibliography/references[@normative = 'true']".freeze
52
+ NORM_REF = "//bibliography/references[@normative = 'true'] | "\
53
+ "//bibliography/clause[.//references[@normative = 'true']]".freeze
52
54
 
53
55
  def boilerplate_isodoc(xmldoc)
54
56
  x = xmldoc.dup
@@ -20,6 +20,7 @@ module Asciidoctor
20
20
  nomatches = true
21
21
  xmldoc.xpath(q).each do |s|
22
22
  next if s.children.map { |c| c.text? && /[[:alpha:]]/.match(c.text) }.any?
23
+
23
24
  s.previous_element << s.first_element_child.remove
24
25
  s.remove
25
26
  nomatches = false
@@ -0,0 +1,71 @@
1
+ module Asciidoctor
2
+ module Standoc
3
+ module Cleanup
4
+ def svgmap_cleanup(xmldoc)
5
+ svgmap_moveattrs(xmldoc)
6
+ svgmap_populate(xmldoc)
7
+ Metanorma::Utils::svgmap_rewrite(xmldoc, @localdir)
8
+ end
9
+
10
+ def guid?(str)
11
+ /^_[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
12
+ .match(str)
13
+ end
14
+
15
+ def svgmap_moveattrs(xmldoc)
16
+ xmldoc.xpath("//svgmap").each do |s|
17
+ f = s.at(".//figure") or next
18
+ if (t = s.at("./name")) && !f.at("./name")
19
+ f.children.first.previous = t.remove
20
+ end
21
+ if s["id"] && guid?(f["id"])
22
+ f["id"] = s["id"]
23
+ s.delete("id")
24
+ end
25
+ svgmap_moveattrs1(s, f)
26
+ end
27
+ end
28
+
29
+ def svgmap_moveattrs1(s, f)
30
+ %w(unnumbered number subsequence keep-with-next
31
+ keep-lines-together).each do |a|
32
+ next if f[a] || !s[a]
33
+
34
+ f[a] = s[a]
35
+ s.delete(a)
36
+ end
37
+ end
38
+
39
+ def svgmap_populate(xmldoc)
40
+ xmldoc.xpath("//svgmap").each do |s|
41
+ s1 = s.dup
42
+ s.children.remove
43
+ f = s1.at(".//figure") and s << f
44
+ s1.xpath(".//li").each do |li|
45
+ t = li&.at(".//eref | .//link | .//xref") or next
46
+ href = t.xpath("./following-sibling::node()")
47
+ href.empty? or
48
+ s << %[<target href="#{svgmap_target(href)}">#{t.to_xml}</target>]
49
+ end
50
+ end
51
+ end
52
+
53
+ def svgmap_target(nodeset)
54
+ nodeset.each do |n|
55
+ next unless n.name == "link"
56
+
57
+ n.children = n["target"]
58
+ end
59
+ nodeset.text.sub(/^[,; ]/, "").strip
60
+ end
61
+
62
+ def img_cleanup(xmldoc)
63
+ return xmldoc unless @datauriimage
64
+
65
+ xmldoc.xpath("//image").each do |i|
66
+ i["src"] = Metanorma::Utils::datauri(i["src"], @localdir)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -3,36 +3,39 @@ require "pathname"
3
3
  require "open-uri"
4
4
  require "html2doc"
5
5
  require "asciimath2unitsml"
6
- require_relative "./cleanup_block.rb"
7
- require_relative "./cleanup_footnotes.rb"
8
- require_relative "./cleanup_ref.rb"
9
- require_relative "./cleanup_ref_dl.rb"
10
- require_relative "./cleanup_boilerplate.rb"
11
- require_relative "./cleanup_section.rb"
12
- require_relative "./cleanup_terms.rb"
13
- require_relative "./cleanup_inline.rb"
14
- require_relative "./cleanup_amend.rb"
6
+ require_relative "./cleanup_block"
7
+ require_relative "./cleanup_footnotes"
8
+ require_relative "./cleanup_ref"
9
+ require_relative "./cleanup_ref_dl"
10
+ require_relative "./cleanup_boilerplate"
11
+ require_relative "./cleanup_section"
12
+ require_relative "./cleanup_terms"
13
+ require_relative "./cleanup_inline"
14
+ require_relative "./cleanup_amend"
15
15
  require "relaton_iev"
16
16
 
17
17
  module Asciidoctor
18
18
  module Standoc
19
19
  module Cleanup
20
20
  def asciimath2mathml(text)
21
- text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>}m) do |m|
22
- "<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
23
- end
24
- text = Html2Doc.asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"])
25
- x = Nokogiri::XML(text)
26
- x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
27
- y.wrap("<stem type='MathML'></stem>")
28
- end
29
- x.to_xml
21
+ text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>}m) do
22
+ "<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
23
+ end
24
+ text = Html2Doc.asciimath_to_mathml(text,
25
+ ["<amathstem>", "</amathstem>"])
26
+ x = Nokogiri::XML(text)
27
+ x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
28
+ y.wrap("<stem type='MathML'></stem>")
29
+ end
30
+ x.to_xml
30
31
  end
31
32
 
32
33
  def xml_unescape_mathml(x)
33
34
  return if x.children.any? { |y| y.element? }
34
- math = x.text.gsub(/&lt;/, "<").gsub(/&gt;/, ">").gsub(/&quot;/, '"').gsub(/&apos;/, "'").gsub(/&amp;/, "&").
35
- gsub(/<[^: \r\n\t\/]+:/, "<").gsub(/<\/[^ \r\n\t:]+:/, "</")
35
+
36
+ math = x.text.gsub(/&lt;/, "<").gsub(/&gt;/, ">")
37
+ .gsub(/&quot;/, '"').gsub(/&apos;/, "'").gsub(/&amp;/, "&")
38
+ .gsub(/<[^: \r\n\t\/]+:/, "<").gsub(/<\/[^ \r\n\t:]+:/, "</")
36
39
  x.children = math
37
40
  end
38
41
 
@@ -40,12 +43,13 @@ module Asciidoctor
40
43
 
41
44
  def mathml_preserve_space(m)
42
45
  m.xpath(".//m:mtext", "m" => MATHML_NS).each do |x|
43
- x.children = x.children.to_xml.gsub(/^\s/, "&#xA0;").gsub(/\s$/, "&#xA0;")
46
+ x.children = x.children.to_xml
47
+ .gsub(/^\s/, "&#xA0;").gsub(/\s$/, "&#xA0;")
44
48
  end
45
49
  end
46
50
 
47
51
  def mathml_namespace(stem)
48
- stem.xpath("./math", ).each { |x| x.default_namespace = MATHML_NS }
52
+ stem.xpath("./math").each { |x| x.default_namespace = MATHML_NS }
49
53
  end
50
54
 
51
55
  def mathml_mi_italics
@@ -55,7 +59,8 @@ module Asciidoctor
55
59
 
56
60
  # presuppose multichar mi upright, singlechar mi MathML default italic
57
61
  def mathml_italicise(x)
58
- x.xpath(".//m:mi[not(ancestor::*[@mathvariant])]", "m" => MATHML_NS).each do |i|
62
+ x.xpath(".//m:mi[not(ancestor::*[@mathvariant])]",
63
+ "m" => MATHML_NS).each do |i|
59
64
  char = HTMLEntities.new.decode(i.text)
60
65
  i["mathvariant"] = "normal" if mi_italicise?(char)
61
66
  end
@@ -63,10 +68,11 @@ module Asciidoctor
63
68
 
64
69
  def mi_italicise?(c)
65
70
  return false if c.length > 1
66
- if /\p{Greek}/.match(c)
71
+
72
+ if /\p{Greek}/.match?(c)
67
73
  /\p{Lower}/.match(c) && !mathml_mi_italics[:lowergreek] ||
68
74
  /\p{Upper}/.match(c) && !mathml_mi_italics[:uppergreek]
69
- elsif /\p{Latin}/.match(c)
75
+ elsif /\p{Latin}/.match?(c)
70
76
  /\p{Lower}/.match(c) && !mathml_mi_italics[:lowerroman] ||
71
77
  /\p{Upper}/.match(c) && !mathml_mi_italics[:upperroman]
72
78
  else
@@ -87,6 +93,7 @@ module Asciidoctor
87
93
 
88
94
  def mathml_unitsML(xmldoc)
89
95
  return unless xmldoc.at(".//m:*", "m" => UNITSML_NS)
96
+
90
97
  misc = add_misc_container(xmldoc)
91
98
  unitsml = misc.add_child("<UnitsML xmlns='#{UNITSML_NS}'/>").first
92
99
  %w(Unit CountedItem Quantity Dimension Prefix).each do |t|
@@ -95,12 +102,14 @@ module Asciidoctor
95
102
  end
96
103
 
97
104
  def gather_unitsml(unitsml, xmldoc, t)
98
- tags = xmldoc.xpath(".//m:#{t}", "m" => UNITSML_NS).each_with_object({}) do |x, m|
105
+ tags = xmldoc.xpath(".//m:#{t}", "m" => UNITSML_NS)
106
+ .each_with_object({}) do |x, m|
99
107
  m[x["id"]] = x.remove
100
108
  end
101
109
  return if tags.empty?
110
+
102
111
  set = unitsml.add_child("<#{t}Set/>").first
103
- tags.values.each { |v| set << v }
112
+ tags.each_value { |v| set << v }
104
113
  end
105
114
 
106
115
  def asciimath2unitsml_options
@@ -14,9 +14,10 @@ module Asciidoctor
14
14
  fold_notes_into_biblio(refs)
15
15
  bib = sort_biblio(refs.xpath("./bibitem"))
16
16
  insert = refs&.at("./bibitem")&.previous_element
17
- refs.xpath("./bibitem").each { |b| b.remove }
17
+ refs.xpath("./bibitem").each(&:remove)
18
18
  bib.reverse.each do |b|
19
- insert and insert.next = b.to_xml or refs.children.first.add_previous_sibling b.to_xml
19
+ insert and insert.next = b.to_xml or
20
+ refs.children.first.add_previous_sibling b.to_xml
20
21
  end
21
22
  extract_notes_from_biblio(refs)
22
23
  refs.xpath("./references").each { |r| biblio_reorder1(r) }
@@ -24,7 +25,7 @@ module Asciidoctor
24
25
 
25
26
  def fold_notes_into_biblio(refs)
26
27
  refs.xpath("./bibitem").each do |r|
27
- while r&.next_element&.name == "note" do
28
+ while r&.next_element&.name == "note"
28
29
  r.next_element["appended"] = true
29
30
  r << r.next_element.remove
30
31
  end
@@ -49,12 +50,15 @@ module Asciidoctor
49
50
  # only numeric references are renumbered
50
51
  def biblio_renumber(xmldoc)
51
52
  i = 0
52
- xmldoc.xpath("//bibliography//references | //clause//references | //annex//references").each do |r|
53
+ xmldoc.xpath("//bibliography//references | //clause//references | "\
54
+ "//annex//references").each do |r|
53
55
  next if r["normative"] == "true"
56
+
54
57
  r.xpath("./bibitem").each do |b|
55
58
  i += 1
56
59
  next unless docid = b.at("./docidentifier[@type = 'metanorma']")
57
- next unless /^\[\d+\]$/.match(docid.text)
60
+ next unless /^\[\d+\]$/.match?(docid.text)
61
+
58
62
  docid.children = "[#{i}]"
59
63
  end
60
64
  end
@@ -72,7 +76,7 @@ module Asciidoctor
72
76
  r = xmldoc.at(self.class::NORM_REF) || return
73
77
  preface = r.xpath("./title/following-sibling::*") & # intersection
74
78
  r.xpath("./bibitem[1]/preceding-sibling::*")
75
- preface.each { |n| n.remove }
79
+ preface.each(&:remove)
76
80
  end
77
81
 
78
82
  def biblio_cleanup(xmldoc)
@@ -92,6 +96,7 @@ module Asciidoctor
92
96
  def format_ref(ref, type)
93
97
  return @isodoc.docid_prefix(type, ref) if type != "metanorma"
94
98
  return "[#{ref}]" if /^\d+$/.match(ref) && !/^\[.*\]$/.match(ref)
99
+
95
100
  ref
96
101
  end
97
102
 
@@ -103,7 +108,7 @@ module Asciidoctor
103
108
 
104
109
  def reference_names(xmldoc)
105
110
  xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
106
- isopub = ref.at(ISO_PUBLISHER_XPATH)
111
+ # isopub = ref.at(ISO_PUBLISHER_XPATH)
107
112
  docid = ref.at("./docidentifier[@type = 'metanorma']") ||
108
113
  ref.at("./docidentifier[not(@type = 'DOI')]") or next
109
114
  reference = format_ref(docid.text, docid["type"])
@@ -111,18 +116,20 @@ module Asciidoctor
111
116
  end
112
117
  end
113
118
 
114
- def fetch_termbase(termbase, id)
119
+ def fetch_termbase(_termbase, _id)
115
120
  ""
116
121
  end
117
122
 
118
123
  def read_local_bibitem(uri)
119
- return nil if %r{^http[s]?://}.match(uri)
120
- file = @localdir + uri + ".rxl"
121
- File.file?(file) or file = @localdir + uri + ".xml"
124
+ return nil if %r{^https?://}.match?(uri)
125
+
126
+ file = "#{@localdir}#{uri}.rxl"
127
+ File.file?(file) or file = "#{@localdir}#{uri}.xml"
122
128
  File.file?(file) or return nil
123
129
  xml = Nokogiri::XML(File.read(file, encoding: "utf-8"))
124
130
  ret = xml.at("//*[local-name() = 'bibdata']") or return nil
125
- ret = Nokogiri::XML(ret.to_xml.sub(%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
131
+ ret = Nokogiri::XML(ret.to_xml
132
+ .sub(%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
126
133
  ret.name = "bibitem"
127
134
  ins = ret.at("./*[local-name() = 'docidentifier']") or return nil
128
135
  ins.previous = %{<uri type="citation">#{uri}</uri>}
@@ -132,7 +139,8 @@ module Asciidoctor
132
139
 
133
140
  # if citation uri points to local file, get bibitem from it
134
141
  def fetch_local_bibitem(xmldoc)
135
- xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]").each do |b|
142
+ xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]")
143
+ .each do |b|
136
144
  uri = b&.at("./uri[@type = 'citation']")&.text
137
145
  bibitem = read_local_bibitem(uri) or next
138
146
  bibitem["id"] = b["id"]
@@ -8,7 +8,7 @@ module Asciidoctor
8
8
  xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
9
9
  bib = dl_bib_extract(c) or next
10
10
  validate_ref_dl(bib, c)
11
- bibitemxml = RelatonBib::BibliographicItem.new(RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
11
+ bibitemxml = RelatonBib::BibliographicItem.from_hash(bib).to_xml or next
12
12
  bibitem = Nokogiri::XML(bibitemxml)
13
13
  bibitem.root["id"] = c["id"] if c["id"] && !/^_/.match(c["id"])
14
14
  c.replace(bibitem.root)
@@ -0,0 +1,47 @@
1
+ module Asciidoctor
2
+ module Standoc
3
+ module Cleanup
4
+ def requirement_cleanup(reqt)
5
+ requirement_descriptions(reqt)
6
+ requirement_inherit(reqt)
7
+ end
8
+
9
+ def requirement_inherit(reqt)
10
+ reqt.xpath("//requirement | //recommendation | //permission")
11
+ .each do |r|
12
+ ins = r.at("./classification") ||
13
+ r.at("./description | ./measurementtarget | ./specification | "\
14
+ "./verification | ./import | ./description | ./requirement | "\
15
+ "./recommendation | ./permission")
16
+ r.xpath("./*//inherit").each { |i| ins.previous = i }
17
+ end
18
+ end
19
+
20
+ def requirement_descriptions(reqt)
21
+ reqt.xpath("//requirement | //recommendation | //permission")
22
+ .each do |r|
23
+ r.children.each do |e|
24
+ unless e.element? && (reqt_subpart(e.name) ||
25
+ %w(requirement recommendation permission).include?(e.name))
26
+ t = Nokogiri::XML::Element.new("description", reqt)
27
+ e.before(t)
28
+ t.children = e.remove
29
+ end
30
+ end
31
+ requirement_cleanup1(r)
32
+ end
33
+ end
34
+
35
+ def requirement_cleanup1(reqt)
36
+ while d = reqt.at("./description[following-sibling::*[1]"\
37
+ "[self::description]]")
38
+ n = d.next.remove
39
+ d << n.children
40
+ end
41
+ reqt.xpath("./description[normalize-space(.)='']").each do |r|
42
+ r.replace("\n")
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -78,6 +78,7 @@ module Asciidoctor
78
78
  x.xpath("//*[@annex]").each do |y|
79
79
  y.delete("annex")
80
80
  next if y.name == "annex" || !y.ancestors("annex").empty?
81
+
81
82
  y.wrap("<annex/>")
82
83
  y.parent["id"] = "_#{UUIDTools::UUID.random_create}"
83
84
  y.parent["obligation"] = y["obligation"]
@@ -97,6 +98,7 @@ module Asciidoctor
97
98
  def sections_level_cleanup(x)
98
99
  m = maxlevel(x)
99
100
  return if m < 6
101
+
100
102
  m.downto(6).each do |l|
101
103
  x.xpath("//clause[@level = '#{l}']").each do |c|
102
104
  c.delete("level")
@@ -150,6 +152,7 @@ module Asciidoctor
150
152
 
151
153
  def preface_clausebefore_cleanup(xmldoc)
152
154
  return unless xmldoc.at("//preface")
155
+
153
156
  unless ins = xmldoc.at("//preface").children.first
154
157
  xmldoc.at("//preface") << " "
155
158
  ins = xmldoc.at("//preface").children.first
@@ -162,6 +165,7 @@ module Asciidoctor
162
165
 
163
166
  def sections_clausebefore_cleanup(xmldoc)
164
167
  return unless xmldoc.at("//sections")
168
+
165
169
  unless ins = xmldoc.at("//sections").children.first
166
170
  xmldoc.at("//sections") << " "
167
171
  ins = xmldoc.at("//sections").children.first
@@ -188,6 +192,7 @@ module Asciidoctor
188
192
 
189
193
  doc.xpath(xpath).each_with_index do |node, i|
190
194
  next if first && !i.zero?
195
+
191
196
  title = get_or_make_title(node)
192
197
  fn = title.xpath("./fn")
193
198
  fn.each { |n| n.remove }
@@ -3,7 +3,7 @@ require "nokogiri"
3
3
  require "htmlentities"
4
4
  require "pathname"
5
5
  require "open-uri"
6
- require_relative "./front_contributor.rb"
6
+ require_relative "./front_contributor"
7
7
 
8
8
  module Asciidoctor
9
9
  module Standoc
@@ -40,6 +40,7 @@ module Asciidoctor
40
40
 
41
41
  def metadata_committee(node, xml)
42
42
  return unless node.attr("technical-committee")
43
+
43
44
  xml.editorialgroup do |a|
44
45
  committee_component("technical-committee", node, a)
45
46
  end
@@ -47,8 +48,8 @@ module Asciidoctor
47
48
 
48
49
  def metadata_ics(node, xml)
49
50
  ics = node.attr("library-ics")
50
- ics && ics.split(/,\s*/).each do |i|
51
- xml.ics { |ics| ics.code i }
51
+ ics&.split(/,\s*/)&.each do |i|
52
+ xml.ics { |elem| elem.code i }
52
53
  end
53
54
  end
54
55
 
@@ -71,15 +72,15 @@ module Asciidoctor
71
72
 
72
73
  def datetypes
73
74
  %w{ published accessed created implemented obsoleted
74
- confirmed updated issued circulated unchanged received
75
- vote-started vote-ended
76
- }
75
+ confirmed updated issued circulated unchanged received
76
+ vote-started vote-ended }
77
77
  end
78
78
 
79
79
  def metadata_date(node, xml)
80
80
  datetypes.each { |t| metadata_date1(node, xml, t) }
81
- node.attributes.keys.each do |a|
81
+ node.attributes.each_key do |a|
82
82
  next unless a == "date" || /^date_\d+$/.match(a)
83
+
83
84
  type, date = node.attr(a).split(/ /, 2)
84
85
  type or next
85
86
  xml.date **{ type: type } do |d|
@@ -93,7 +94,8 @@ module Asciidoctor
93
94
  end
94
95
 
95
96
  def metadata_script(node, xml)
96
- xml.script (node.attr("script") || default_script(node.attr("language")))
97
+ xml.script (node.attr("script") ||
98
+ default_script(node.attr("language")))
97
99
  end
98
100
 
99
101
  def relaton_relations
@@ -114,8 +116,8 @@ module Asciidoctor
114
116
  end
115
117
 
116
118
  def relation_normalise(type)
117
- type.sub(/-by$/, "By").sub(/-of$/, "Of").sub(/-from$/, "From").
118
- sub(/-in$/, "In")
119
+ type.sub(/-by$/, "By").sub(/-of$/, "Of").sub(/-from$/, "From")
120
+ .sub(/-in$/, "In")
119
121
  end
120
122
 
121
123
  def metadata_getrelation(node, xml, type, desc = nil)
@@ -124,8 +126,8 @@ module Asciidoctor
124
126
  id = d.split(/,\s*/)
125
127
  xml.relation **{ type: relation_normalise(type) } do |r|
126
128
  desc.nil? or r.description relation_normalise(desc)
127
- fetch_ref(r, d, nil, {}) or r.bibitem do |b|
128
- b.title id[1] ? id[1] : "--"
129
+ fetch_ref(r, d, nil, **{}) or r.bibitem do |b|
130
+ b.title id[1] || "--"
129
131
  b.docidentifier id[0]
130
132
  end
131
133
  end
@@ -134,11 +136,20 @@ module Asciidoctor
134
136
 
135
137
  def metadata_keywords(node, xml)
136
138
  return unless node.attr("keywords")
137
- node.attr("keywords").split(/,[ ]*/).each do |kw|
139
+
140
+ node.attr("keywords").split(/,\s*/).each do |kw|
138
141
  xml.keyword kw
139
142
  end
140
143
  end
141
144
 
145
+ def metadata_classifications(node, xml)
146
+ csv_split(node.attr("classification"), ",")&.each do |c|
147
+ vals = c.split(/:/, 2)
148
+ vals.size == 1 and vals = ["default", vals[0]]
149
+ xml.classification vals[1], type: vals[0]
150
+ end
151
+ end
152
+
142
153
  def metadata(node, xml)
143
154
  title node, xml
144
155
  metadata_source(node, xml)
@@ -155,14 +166,16 @@ module Asciidoctor
155
166
  metadata_copyright(node, xml)
156
167
  metadata_relations(node, xml)
157
168
  metadata_series(node, xml)
169
+ metadata_classifications(node, xml)
158
170
  metadata_keywords(node, xml)
159
- xml.ext do |ext|
171
+ xml.ext do
160
172
  metadata_ext(node, xml)
161
173
  end
162
174
  end
163
175
 
164
176
  def metadata_ext(node, ext)
165
177
  metadata_doctype(node, ext)
178
+ metadata_subdoctype(node, ext)
166
179
  metadata_committee(node, ext)
167
180
  metadata_ics(node, ext)
168
181
  end
@@ -171,11 +184,13 @@ module Asciidoctor
171
184
  xml.doctype doctype(node)
172
185
  end
173
186
 
174
- def metadata_note(node, xml)
187
+ def metadata_subdoctype(node, xml)
188
+ s = node.attr("docsubtype") and xml.subdoctype s
175
189
  end
176
190
 
177
- def metadata_series(node, xml)
178
- end
191
+ def metadata_note(node, xml); end
192
+
193
+ def metadata_series(node, xml); end
179
194
 
180
195
  def title(node, xml)
181
196
  title_english(node, xml)
@@ -187,7 +202,8 @@ module Asciidoctor
187
202
  at = { language: lang, format: "text/plain" }
188
203
  xml.title **attr_code(at) do |t|
189
204
  t << (Metanorma::Utils::asciidoc_sub(node.attr("title") ||
190
- node.attr("title-en")) || node.title)
205
+ node.attr("title-en")) ||
206
+ node.title)
191
207
  end
192
208
  end
193
209
  end
@@ -196,6 +212,7 @@ module Asciidoctor
196
212
  node.attributes.each do |k, v|
197
213
  next unless /^title-(?<titlelang>.+)$/ =~ k
198
214
  next if titlelang == "en"
215
+
199
216
  xml.title v, { language: titlelang, format: "text/plain" }
200
217
  end
201
218
  end