metanorma-standoc 1.6.4 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +17 -0
  3. data/lib/asciidoctor/standoc/base.rb +8 -16
  4. data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
  5. data/lib/asciidoctor/standoc/cleanup.rb +1 -1
  6. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -8
  7. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +33 -20
  8. data/lib/asciidoctor/standoc/cleanup_inline.rb +3 -1
  9. data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
  10. data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
  11. data/lib/asciidoctor/standoc/converter.rb +4 -49
  12. data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
  13. data/lib/asciidoctor/standoc/inline.rb +7 -5
  14. data/lib/asciidoctor/standoc/isodoc.rng +48 -3
  15. data/lib/asciidoctor/standoc/macros.rb +30 -61
  16. data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
  17. data/lib/asciidoctor/standoc/ref.rb +12 -21
  18. data/lib/asciidoctor/standoc/section.rb +22 -20
  19. data/lib/asciidoctor/standoc/table.rb +12 -0
  20. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
  21. data/lib/asciidoctor/standoc/utils.rb +2 -0
  22. data/lib/metanorma/standoc/version.rb +1 -1
  23. data/metanorma-standoc.gemspec +1 -2
  24. data/spec/asciidoctor-standoc/base_spec.rb +14 -8
  25. data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
  26. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +18 -13
  27. data/spec/asciidoctor-standoc/cleanup_spec.rb +75 -11
  28. data/spec/asciidoctor-standoc/inline_spec.rb +4 -5
  29. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +1 -1
  30. data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
  31. data/spec/asciidoctor-standoc/macros_spec.rb +258 -277
  32. data/spec/asciidoctor-standoc/refs_dl_spec.rb +4 -4
  33. data/spec/asciidoctor-standoc/section_spec.rb +155 -12
  34. data/spec/asciidoctor-standoc/table_spec.rb +146 -0
  35. data/spec/fixtures/diagram_definitions.lutaml +4 -4
  36. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -49
  37. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  38. data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
  39. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
  40. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
  41. data/spec/vcr_cassettes/isobib_get_124.yml +14 -14
  42. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  43. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +71 -75
  44. metadata +7 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e30bd97d527914e60d6dfcd537620ba7d2d5ae82d9d9c07e24d5a535dd9ec8ee
4
- data.tar.gz: b8774965fcb7e698288f1793460fd67b982085e8d0951b35cfa6c4f102157e9a
3
+ metadata.gz: cf94c8165f552d893fafcd889f4a87497cf9d3cacf47aa9b1ea840da7d95b1c6
4
+ data.tar.gz: 0a7aa11f804bf0cb450252c9183353f11571dddf9f3ca15d279aca27483510ac
5
5
  SHA512:
6
- metadata.gz: 74e250a48b25dd82c3174b78b515e57fe11bc3f4f8767d6942048bb3ef01ddf6937a6c2ff24ddb5e17d8f747eeb582b77248b28bdf50bc120a3fcfafd6f78221
7
- data.tar.gz: a0fe35b39a730d18afe1cc7463b166377adb2137c4cfd9c650844e3a593e1a2312fa8242a8991a1508aaed44b7b7525a54cad7f747a177ea2848b27720cf644d
6
+ metadata.gz: 89c736fe574b64de2b97a244435f3a851d667d99e952ec6d5ba5e0d4f0c40986cb87958e1ed99d68e6d6bdd6ae89dccdba104855cd12738e0801b8657e3b3adf
7
+ data.tar.gz: fb9b3000f186215a782eb1d65114c86108e48742336337ae365320344cc6f0c23e5bbd2a20ab7cfa0534ff55140baa23a21870a0af14e40b3dd8589f02db32d5
@@ -36,6 +36,9 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
39
42
  - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
@@ -64,3 +67,17 @@ jobs:
64
67
  run: cinst -y plantuml
65
68
 
66
69
  - run: bundle exec rake
70
+
71
+ tests-passed:
72
+ needs: rake
73
+ runs-on: ubuntu-latest
74
+ continue-on-error: true
75
+ steps:
76
+ - name: Trigger tests passed event
77
+ uses: Sibz/github-status-action@v1
78
+ with:
79
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
80
+ context: 'tests-passed-successfully'
81
+ description: 'Tests passed successfully'
82
+ state: 'success'
83
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -94,12 +94,10 @@ module Asciidoctor
94
94
  @draft = node.attributes.has_key?("draft")
95
95
  @novalid = node.attr("novalid")
96
96
  @smartquotes = node.attr("smartquotes") != "false"
97
- @keepasciimath = node.attr("mn-keep-asciimath") &&
98
- node.attr("mn-keep-asciimath") != "false"
97
+ @keepasciimath = node.attr("mn-keep-asciimath") && node.attr("mn-keep-asciimath") != "false"
99
98
  @fontheader = default_fonts(node)
100
99
  @files_to_delete = []
101
- @filename = node.attr("docfile") ?
102
- File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
100
+ @filename = node.attr("docfile") ? File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
103
101
  @localdir = Utils::localdir(node)
104
102
  @output_dir = outputdir node
105
103
  @no_isobib_cache = node.attr("no-isobib-cache")
@@ -119,11 +117,9 @@ module Asciidoctor
119
117
 
120
118
  def default_fonts(node)
121
119
  b = node.attr("body-font") ||
122
- (node.attr("script") == "Hans" ? '"SimSun",serif' :
123
- '"Cambria",serif')
120
+ (node.attr("script") == "Hans" ? '"SimSun",serif' : '"Cambria",serif')
124
121
  h = node.attr("header-font") ||
125
- (node.attr("script") == "Hans" ? '"SimHei",sans-serif' :
126
- '"Cambria",serif')
122
+ (node.attr("script") == "Hans" ? '"SimHei",sans-serif' : '"Cambria",serif')
127
123
  m = node.attr("monospace-font") || '"Courier New",monospace'
128
124
  "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
129
125
  end
@@ -154,8 +150,7 @@ module Asciidoctor
154
150
  end
155
151
 
156
152
  def makexml1(node)
157
- result = ["<?xml version='1.0' encoding='UTF-8'?>",
158
- "<#{xml_root_tag} type='semantic' version='#{version}'>"]
153
+ result = ["<?xml version='1.0' encoding='UTF-8'?>", "<#{xml_root_tag} type='semantic' version='#{version}'>"]
159
154
  result << noko { |ixml| front node, ixml }
160
155
  result << noko { |ixml| middle node, ixml }
161
156
  result << "</#{xml_root_tag}>"
@@ -192,16 +187,14 @@ module Asciidoctor
192
187
 
193
188
  def term_source_attrs(seen_xref)
194
189
  { bibitemid: seen_xref.children[0]["target"],
195
- format: seen_xref.children[0]["format"],
196
- type: "inline" }
190
+ format: seen_xref.children[0]["format"], type: "inline" }
197
191
  end
198
192
 
199
193
  def add_term_source(xml_t, seen_xref, m)
200
194
  if seen_xref.children[0].name == "concept"
201
195
  xml_t.origin { |o| o << seen_xref.children[0].to_xml }
202
196
  else
203
- xml_t.origin seen_xref.children[0].content,
204
- **attr_code(term_source_attrs(seen_xref))
197
+ xml_t.origin seen_xref.children[0].content, **attr_code(term_source_attrs(seen_xref))
205
198
  end
206
199
  m[:text] && xml_t.modification do |mod|
207
200
  mod.p { |p| p << m[:text].sub(/^\s+/, "") }
@@ -219,8 +212,7 @@ module Asciidoctor
219
212
 
220
213
  def extract_termsource_refs(text, node)
221
214
  matched = TERM_REFERENCE_RE.match text
222
- matched.nil? and
223
- @log.add("AsciiDoc Input", node, "term reference not in expected format: #{text}")
215
+ matched.nil? and @log.add("AsciiDoc Input", node, "term reference not in expected format: #{text}")
224
216
  matched
225
217
  end
226
218
 
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,15 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
+ <attribute name="to">
733
+ <data type="IDREF"/>
734
+ </attribute>
735
+ <element name="primary">
736
+ <oneOrMore>
737
+ <ref name="PureTextElement"/>
738
+ </oneOrMore>
739
+ </element>
732
740
  <optional>
733
- <attribute name="secondary"/>
741
+ <element name="secondary">
742
+ <oneOrMore>
743
+ <ref name="PureTextElement"/>
744
+ </oneOrMore>
745
+ </element>
734
746
  </optional>
735
747
  <optional>
736
- <attribute name="tertiary"/>
748
+ <element name="tertiary">
749
+ <oneOrMore>
750
+ <ref name="PureTextElement"/>
751
+ </oneOrMore>
752
+ </element>
737
753
  </optional>
738
754
  </element>
739
755
  </define>
756
+ <define name="index-xref">
757
+ <element name="index-xref">
758
+ <attribute name="also">
759
+ <data type="boolean"/>
760
+ </attribute>
761
+ <element name="primary">
762
+ <oneOrMore>
763
+ <ref name="PureTextElement"/>
764
+ </oneOrMore>
765
+ </element>
766
+ <optional>
767
+ <element name="secondary">
768
+ <oneOrMore>
769
+ <ref name="PureTextElement"/>
770
+ </oneOrMore>
771
+ </element>
772
+ </optional>
773
+ <optional>
774
+ <element name="tertiary">
775
+ <oneOrMore>
776
+ <ref name="PureTextElement"/>
777
+ </oneOrMore>
778
+ </element>
779
+ </optional>
780
+ <element name="target">
781
+ <oneOrMore>
782
+ <ref name="PureTextElement"/>
783
+ </oneOrMore>
784
+ </element>
785
+ </element>
786
+ </define>
740
787
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
788
  <define name="bookmark">
742
789
  <element name="bookmark">
@@ -176,7 +176,7 @@ module Asciidoctor
176
176
 
177
177
  # presuppose multichar mi upright, singlechar mi MathML default italic
178
178
  def mathml_italicise(x)
179
- x.xpath(".//m:mi", "m" => MATHML_NS).each do |i|
179
+ x.xpath(".//m:mi[not(ancestor::*[@mathvariant])]", "m" => MATHML_NS).each do |i|
180
180
  char = HTMLEntities.new.decode(i.text)
181
181
  i["mathvariant"] = "normal" if mi_italicise?(char)
182
182
  end
@@ -133,14 +133,6 @@ module Asciidoctor
133
133
  end
134
134
 
135
135
  # examples containing only figures become subfigures of figures
136
- def subfigure_cleanup(xmldoc)
137
- nodes = xmldoc.xpath("//example/figure")
138
- while !nodes.empty?
139
- nodes[0].parent.name = "figure"
140
- nodes = xmldoc.xpath("//example/figure")
141
- end
142
- end
143
-
144
136
  def subfigure_cleanup(xmldoc)
145
137
  xmldoc.xpath("//example[figure]").each do |e|
146
138
  next unless e.elements.map { |m| m.name }.
@@ -3,14 +3,12 @@ module Asciidoctor
3
3
  module Cleanup
4
4
  def external_terms_boilerplate(sources)
5
5
  @i18n.l10n(
6
- @i18n.external_terms_boilerplate.gsub(/%/, sources || "???"),
7
- @lang, @script)
6
+ @i18n.external_terms_boilerplate.gsub(/%/, sources || "???"), @lang, @script)
8
7
  end
9
8
 
10
9
  def internal_external_terms_boilerplate(sources)
11
10
  @i18n.l10n(
12
- @i18n.internal_external_terms_boilerplate.gsub(/%/, sources || "??"),
13
- @lang, @script)
11
+ @i18n.internal_external_terms_boilerplate.gsub(/%/, sources || "??"), @lang, @script)
14
12
  end
15
13
 
16
14
  def term_defs_boilerplate(div, source, term, preface, isodoc)
@@ -19,11 +17,9 @@ module Asciidoctor
19
17
  @anchors[s["bibitemid"]] or
20
18
  @log.add("Crossreferences", nil, "term source #{s['bibitemid']} not referenced")
21
19
  end
22
- if source.empty? && term.nil?
23
- div.next = @i18n.no_terms_boilerplate
24
- else
25
- div.next = term_defs_boilerplate_cont(source, term, isodoc)
26
- end
20
+ a = (source.empty? && term.nil?) ? @i18n.no_terms_boilerplate :
21
+ term_defs_boilerplate_cont(source, term, isodoc)
22
+ a and div.next = a
27
23
  end
28
24
 
29
25
  def term_defs_boilerplate_cont(src, term, isodoc)
@@ -38,15 +34,14 @@ module Asciidoctor
38
34
  end
39
35
 
40
36
  def norm_ref_preface(f)
41
- refs = f.elements.select do |e|
42
- ["reference", "bibitem"].include? e.name
37
+ refs = f.elements.select do |e|
38
+ ["reference", "bibitem"].include? e.name
39
+ end
40
+ f.at("./title").next =
41
+ "<p>#{(refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref)}</p>"
43
42
  end
44
- f.at("./title").next =
45
- "<p>#{(refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref)}</p>"
46
- end
47
43
 
48
- TERM_CLAUSE = "//sections/terms | "\
49
- "//sections/clause[descendant::terms]".freeze
44
+ TERM_CLAUSE = "//sections/terms | //sections/clause[descendant::terms]".freeze
50
45
 
51
46
  NORM_REF = "//bibliography/references[@normative = 'true']".freeze
52
47
 
@@ -59,15 +54,33 @@ module Asciidoctor
59
54
  @isodoc
60
55
  end
61
56
 
57
+ def termdef_boilerplate_cleanup(xmldoc)
58
+ #termdef_remove_initial_paras(xmldoc)
59
+ end
60
+
61
+ def termdef_remove_initial_paras(xmldoc)
62
+ xmldoc.xpath("//terms/p | //terms/ul").each(&:remove)
63
+ end
64
+
65
+ def termdef_unwrap_boilerplate_clauses(xmldoc)
66
+ xmldoc.xpath(self.class::TERM_CLAUSE).each do |f|
67
+ f.xpath(".//clause[@type = 'boilerplate']").each do |c|
68
+ c&.at("./title")&.remove
69
+ c.replace(c.children)
70
+ end
71
+ end
72
+ end
73
+
62
74
  def boilerplate_cleanup(xmldoc)
63
75
  isodoc = boilerplate_isodoc(xmldoc)
76
+ termdef_boilerplate_cleanup(xmldoc)
64
77
  xmldoc.xpath(self.class::TERM_CLAUSE).each do |f|
65
- term_defs_boilerplate(f.at("./title"),
66
- xmldoc.xpath(".//termdocsource"),
78
+ next if f.at("./clause[@type = 'boilerplate']")
79
+ term_defs_boilerplate(f.at("./title"), xmldoc.xpath(".//termdocsource"),
67
80
  f.at(".//term"), f.at(".//p"), isodoc)
68
81
  end
69
- f = xmldoc.at(self.class::NORM_REF) and
70
- norm_ref_preface(f)
82
+ termdef_unwrap_boilerplate_clauses(xmldoc)
83
+ f = xmldoc.at(self.class::NORM_REF) and norm_ref_preface(f)
71
84
  initial_boilerplate(xmldoc, isodoc)
72
85
  end
73
86
 
@@ -125,7 +125,7 @@ module Asciidoctor
125
125
  def concept_termbase_cleanup(x)
126
126
  text = x&.children&.first&.remove&.text
127
127
  termbase, key = x["key"].split(/:/, 2)
128
- x.add_child(%(<termref base="#{termbase}" target="#{key}">) +
128
+ x.add_child(%(<termref base="#{termbase}" target="#{key}">) +
129
129
  "#{text}</termref>")
130
130
  end
131
131
 
@@ -155,6 +155,8 @@ module Asciidoctor
155
155
  ret
156
156
  end
157
157
 
158
+ module_function :to_ncname
159
+
158
160
  def to_xreftarget(s)
159
161
  return to_ncname(s) unless /^[^#]+#.+$/.match(s)
160
162
  /^(?<pref>[^#]+)#(?<suff>.+)$/ =~ s
@@ -16,8 +16,7 @@ module Asciidoctor
16
16
  insert = refs&.at("./bibitem")&.previous_element
17
17
  refs.xpath("./bibitem").each { |b| b.remove }
18
18
  bib.reverse.each do |b|
19
- insert and insert.next = b.to_xml or
20
- refs.children.first.add_previous_sibling b.to_xml
19
+ insert and insert.next = b.to_xml or refs.children.first.add_previous_sibling b.to_xml
21
20
  end
22
21
  extract_notes_from_biblio(refs)
23
22
  refs.xpath("./references").each { |r| biblio_reorder1(r) }
@@ -49,12 +48,14 @@ module Asciidoctor
49
48
  # consecutively, but that standards codes are preserved as is:
50
49
  # only numeric references are renumbered
51
50
  def biblio_renumber(xmldoc)
52
- r = xmldoc.at("//references | //clause[.//references] | "\
53
- "//annex[.//references]") or return
54
- r.xpath(".//bibitem[not(ancestor::bibitem)]").each_with_index do |b, i|
55
- next unless docid = b.at("./docidentifier[@type = 'metanorma']")
56
- next unless /^\[\d+\]$/.match(docid.text)
57
- docid.children = "[#{i + 1}]"
51
+ i = 0
52
+ xmldoc.xpath("//bibliography//references | //clause//references | //annex//references").each do |r|
53
+ r.xpath("./bibitem").each do |b|
54
+ i += 1
55
+ next unless docid = b.at("./docidentifier[@type = 'metanorma']")
56
+ next unless /^\[\d+\]$/.match(docid.text)
57
+ docid.children = "[#{i}]"
58
+ end
58
59
  end
59
60
  end
60
61
 
@@ -123,8 +124,7 @@ module Asciidoctor
123
124
  xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
124
125
  bib = dl_bib_extract(c) or next
125
126
  validate_ref_dl(bib, c)
126
- bibitemxml = RelatonBib::BibliographicItem.new(
127
- RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
127
+ bibitemxml = RelatonBib::BibliographicItem.new(RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
128
128
  bibitem = Nokogiri::XML(bibitemxml)
129
129
  bibitem.root["id"] = c["id"] if c["id"] && !/^_/.match(c["id"])
130
130
  c.replace(bibitem.root)
@@ -135,14 +135,11 @@ module Asciidoctor
135
135
  id = bib["id"]
136
136
  id ||= c["id"] unless /^_/.match(c["id"]) # do not accept implicit id
137
137
  unless id
138
- @log.add("Anchors", c, "The following reference is missing "\
139
- "an anchor:\n" + c.to_xml)
138
+ @log.add("Anchors", c, "The following reference is missing an anchor:\n" + c.to_xml)
140
139
  return
141
140
  end
142
- bib["title"] or @log.add("Bibliography", c, "Reference #{id} "\
143
- "is missing a title")
144
- bib["docid"] or @log.add("Bibliography", c, "Reference #{id} "\
145
- "is missing a document identifier (docid)")
141
+ bib["title"] or @log.add("Bibliography", c, "Reference #{id} is missing a title")
142
+ bib["docid"] or @log.add("Bibliography", c, "Reference #{id} is missing a document identifier (docid)")
146
143
  end
147
144
 
148
145
  def extract_from_p(tag, bib, key)
@@ -173,8 +170,7 @@ module Asciidoctor
173
170
  return nil if dtd.children.empty?
174
171
  dtd.at("./dl") and return dl_bib_extract(dtd)
175
172
  elems = dtd.remove.elements
176
- return p_unwrap(dtd) unless elems.size == 1 &&
177
- %w(ol ul).include?(elems[0].name)
173
+ return p_unwrap(dtd) unless elems.size == 1 && %w(ol ul).include?(elems[0].name)
178
174
  ret = []
179
175
  elems[0].xpath("./li").each do |li|
180
176
  ret << p_unwrap(li)
@@ -192,8 +188,7 @@ module Asciidoctor
192
188
  bib = {}
193
189
  key = ""
194
190
  dl.xpath("./dt | ./dd").each do |dtd|
195
- dtd.name == "dt" and key = dtd.text.sub(/:+$/, "") or
196
- add_to_hash(bib, key, dd_bib_extract(dtd))
191
+ dtd.name == "dt" and key = dtd.text.sub(/:+$/, "") or add_to_hash(bib, key, dd_bib_extract(dtd))
197
192
  end
198
193
  c.xpath("./clause").each do |c1|
199
194
  key = c1&.at("./title")&.text&.downcase&.strip
@@ -221,8 +216,7 @@ module Asciidoctor
221
216
  File.file?(file) or return nil
222
217
  xml = Nokogiri::XML(File.read(file, encoding: "utf-8"))
223
218
  ret = xml.at("//*[local-name() = 'bibdata']") or return nil
224
- ret = Nokogiri::XML(ret.to_xml.sub(
225
- %r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
219
+ ret = Nokogiri::XML(ret.to_xml.sub(%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
226
220
  ret.name = "bibitem"
227
221
  ins = ret.at("./*[local-name() = 'docidentifier']") or return nil
228
222
  ins.previous = %{<uri type="citation">#{uri}</uri>}
@@ -232,8 +226,7 @@ module Asciidoctor
232
226
 
233
227
  # if citation uri points to local file, get bibitem from it
234
228
  def fetch_local_bibitem(xmldoc)
235
- xmldoc.xpath("//bibitem[formattedref]"\
236
- "[uri[@type = 'citation']]").each do |b|
229
+ xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]").each do |b|
237
230
  uri = b&.at("./uri[@type = 'citation']")&.text
238
231
  bibitem = read_local_bibitem(uri) or next
239
232
  bibitem["id"] = b["id"]
@@ -1,3 +1,5 @@
1
+ require_relative "term_lookup_cleanup"
2
+
1
3
  module Asciidoctor
2
4
  module Standoc
3
5
  module Cleanup
@@ -45,10 +47,6 @@ module Asciidoctor
45
47
  end
46
48
  end
47
49
 
48
- def termdef_boilerplate_cleanup(xmldoc)
49
- xmldoc.xpath("//terms/p | //terms/ul").each(&:remove)
50
- end
51
-
52
50
  def termdef_subclause_cleanup(xmldoc)
53
51
  xmldoc.xpath("//terms[terms]").each { |t| t.name = "clause" }
54
52
  end
@@ -81,11 +79,12 @@ module Asciidoctor
81
79
  x.name = "note"
82
80
  end
83
81
  xmldoc.xpath("//termexample[not(ancestor::term)]").each do |x|
84
- x.name = "note"
82
+ x.name = "example"
85
83
  end
86
84
  end
87
85
 
88
86
  def termdef_cleanup(xmldoc)
87
+ Asciidoctor::Standoc::TermLookupCleanup.new(xmldoc, @log).call
89
88
  termdef_from_termbase(xmldoc)
90
89
  termdef_unnest_cleanup(xmldoc)
91
90
  termdef_stem_cleanup(xmldoc)
@@ -93,7 +92,6 @@ module Asciidoctor
93
92
  termdefinition_cleanup(xmldoc)
94
93
  termdomain1_cleanup(xmldoc)
95
94
  termnote_example_cleanup(xmldoc)
96
- termdef_boilerplate_cleanup(xmldoc)
97
95
  termdef_subclause_cleanup(xmldoc)
98
96
  term_children_cleanup(xmldoc)
99
97
  termdocsource_cleanup(xmldoc)