metanorma-standoc 1.3.24 → 1.3.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +10 -1
  3. data/.github/workflows/ubuntu.yml +13 -3
  4. data/.github/workflows/windows.yml +8 -1
  5. data/lib/asciidoctor/standoc/base.rb +29 -11
  6. data/lib/asciidoctor/standoc/biblio.rng +75 -28
  7. data/lib/asciidoctor/standoc/blocks.rb +12 -5
  8. data/lib/asciidoctor/standoc/cleanup.rb +17 -8
  9. data/lib/asciidoctor/standoc/cleanup_block.rb +3 -0
  10. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +1 -3
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +3 -0
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +15 -6
  13. data/lib/asciidoctor/standoc/cleanup_section.rb +36 -8
  14. data/lib/asciidoctor/standoc/front.rb +5 -3
  15. data/lib/asciidoctor/standoc/inline.rb +43 -18
  16. data/lib/asciidoctor/standoc/isodoc.rng +31 -1
  17. data/lib/asciidoctor/standoc/macros.rb +2 -1
  18. data/lib/asciidoctor/standoc/macros_yaml2text.rb +142 -0
  19. data/lib/asciidoctor/standoc/ref.rb +6 -4
  20. data/lib/asciidoctor/standoc/section.rb +41 -9
  21. data/lib/asciidoctor/standoc/utils.rb +2 -11
  22. data/lib/asciidoctor/standoc/validate.rb +8 -2
  23. data/lib/asciidoctor/standoc/validate_section.rb +1 -3
  24. data/lib/metanorma/standoc/latexml_requirement.rb +14 -12
  25. data/lib/metanorma/standoc/version.rb +1 -1
  26. data/metanorma-standoc.gemspec +2 -2
  27. data/spec/asciidoctor-standoc/base_spec.rb +8 -0
  28. data/spec/asciidoctor-standoc/blocks_spec.rb +74 -2
  29. data/spec/asciidoctor-standoc/cleanup_spec.rb +75 -28
  30. data/spec/asciidoctor-standoc/inline_spec.rb +4 -3
  31. data/spec/asciidoctor-standoc/macros_spec.rb +9 -8
  32. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +564 -0
  33. data/spec/asciidoctor-standoc/refs_dl_spec.rb +91 -3
  34. data/spec/asciidoctor-standoc/refs_spec.rb +272 -166
  35. data/spec/asciidoctor-standoc/section_spec.rb +197 -6
  36. data/spec/asciidoctor-standoc/validate_spec.rb +67 -2
  37. data/spec/assets/codes.yml +695 -0
  38. data/spec/assets/xref_error.adoc +7 -0
  39. data/spec/examples/codes_table.html +3174 -0
  40. data/spec/metanorma/processor_spec.rb +2 -2
  41. data/spec/spec_helper.rb +1 -0
  42. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +77 -271
  43. data/spec/vcr_cassettes/isobib_get_123.yml +36 -82
  44. data/spec/vcr_cassettes/isobib_get_123_2001.yml +17 -40
  45. data/spec/vcr_cassettes/isobib_get_124.yml +19 -101
  46. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  47. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +34 -34
  48. metadata +11 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92fc31b8bb1e9754d79b535a4daf3025602e87e0611a5bf6381b9acf5a3d80e6
4
- data.tar.gz: 801345a1e19a5d89df053dbcd969ae508b604f82914e93623bbfebb7f33b55af
3
+ metadata.gz: e964fb25b29d5ecbe775bf397a17f9cf264fa3709e8756be7a9025bcf043250f
4
+ data.tar.gz: d6085180737f332f6aa657eb129bf72f02ca0466b60e22276ddda03cd2cbd788
5
5
  SHA512:
6
- metadata.gz: 829deae2c17c445636d4e7ef20e2e34043e1e6dff35c9d3e7c41949119867e8865279a6ed527f60ac5c413bb87058cd4262a6ada7719b36850f099aaa1e39cac
7
- data.tar.gz: 44adac89d280d897bb4fa515f6da866da79bdde608a40bf3ea3ff31e2dd0d3f22c989e671e9ab6b1fe54d534c3476ac82d1acd22ecf87ca98248b4948a87cc50
6
+ metadata.gz: baccf6cbbb3c32defcac92b95911e83f10f44338a2bb631a8c6ee86a7b00833583d27161b18ad45b2d80aeec8dcbe3dd349a39b4cfa08670f6cdbe1c8492323c
7
+ data.tar.gz: 347739395332e6d3ac88ea0ec5bec557fa0d06dee7f7f2bbafa198e245131dd313c3f229f63bb3afc92c99eb4cd0cec8fc2a9f969e0cbf42a76271e45955e8eb
@@ -6,15 +6,23 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/ubuntu.yml
11
+ - .github/workflows/windows.yml
9
12
 
10
13
  jobs:
11
14
  test-macos:
12
15
  name: Test on Ruby ${{ matrix.ruby }} macOS
13
16
  runs-on: macos-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
@@ -28,7 +36,8 @@ jobs:
28
36
  - name: Install LaTeXML
29
37
  run: |
30
38
  brew install libxml2 cpanminus
31
- env PATH=$(brew --prefix libxml2)/bin:$PATH cpanm --notest XML::LibXSLT@1.96 git://github.com/brucemiller/LaTeXML.git@9a0e7dc5
39
+ env PATH=$(brew --prefix libxml2)/bin:$PATH \
40
+ cpanm --notest XML::LibXSLT@1.96 git://github.com/brucemiller/LaTeXML.git@9a0e7dc5
32
41
  - name: Install PlantUML
33
42
  run: |
34
43
  brew install plantuml
@@ -6,15 +6,23 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/windows.yml
9
12
 
10
13
  jobs:
11
14
  test-linux:
12
15
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
13
16
  runs-on: ubuntu-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
@@ -31,14 +39,16 @@ jobs:
31
39
  bundle install --jobs 4 --retry 3
32
40
  - name: Install LaTeXML
33
41
  run: |
34
- sudo snap install latexml
35
- sudo snap alias latexml.math latexmlmath
42
+ sudo snap install latexml --edge
43
+ echo "::add-path::/snap/bin"
36
44
  - name: Install PlantUML
37
45
  run: |
38
46
  curl -L https://raw.githubusercontent.com/metanorma/plantuml-install/master/ubuntu.sh | sudo bash
39
47
  - name: Install puppeteer
40
48
  run: |
41
- npm -g i puppeteer
49
+ sudo apt-get update
50
+ sudo apt-get install -y libgbm1
51
+ npm install -g puppeteer@3.0.1
42
52
  - name: Run specs
43
53
  run: |
44
54
  bundle exec rake
@@ -6,15 +6,23 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/ubuntu.yml
9
12
 
10
13
  jobs:
11
14
  test-windows:
12
15
  name: Test on Ruby ${{ matrix.ruby }} Windows
13
16
  runs-on: windows-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
@@ -34,7 +42,6 @@ jobs:
34
42
  run: |
35
43
  gem install bundler
36
44
  bundle config --local path vendor/bundle
37
- bundle update
38
45
  bundle install --jobs 4 --retry 3
39
46
  - name: Install LaTeXML
40
47
  shell: cmd
@@ -15,6 +15,7 @@ module Asciidoctor
15
15
  XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
16
16
 
17
17
  Asciidoctor::Extensions.register do
18
+ preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
18
19
  inline_macro Asciidoctor::Standoc::AltTermInlineMacro
19
20
  inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
20
21
  inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
@@ -27,6 +28,14 @@ module Asciidoctor
27
28
  block Asciidoctor::Standoc::PseudocodeBlockMacro
28
29
  end
29
30
 
31
+ def xml_root_tag
32
+ self.class::XML_ROOT_TAG
33
+ end
34
+
35
+ def xml_namespace
36
+ self.class::XML_NAMESPACE
37
+ end
38
+
30
39
  def content(node)
31
40
  node.content
32
41
  end
@@ -34,7 +43,7 @@ module Asciidoctor
34
43
  def skip(node, name = nil)
35
44
  name = name || node.node_name
36
45
  w = "converter missing for #{name} node in Metanorma backend"
37
- @log.add("Asciidoctor Input", node, w)
46
+ @log.add("AsciiDoc Input", node, w)
38
47
  nil
39
48
  end
40
49
 
@@ -54,6 +63,7 @@ module Asciidoctor
54
63
  datauriimage: node.attr("data-uri-image"),
55
64
  htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
56
65
  doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
66
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
57
67
  }
58
68
  end
59
69
 
@@ -78,6 +88,7 @@ module Asciidoctor
78
88
  olstyle: node.attr("olstyle"),
79
89
  htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
80
90
  doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
91
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
81
92
  }
82
93
  end
83
94
 
@@ -98,7 +109,7 @@ module Asciidoctor
98
109
  @fontheader = default_fonts(node)
99
110
  @files_to_delete = []
100
111
  @filename = node.attr("docfile") ?
101
- node.attr("docfile").gsub(/\.adoc$/, "").gsub(%r{^.*/}, "") : ""
112
+ File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
102
113
  @localdir = Utils::localdir(node)
103
114
  @no_isobib_cache = node.attr("no-isobib-cache")
104
115
  @no_isobib = node.attr("no-isobib")
@@ -158,24 +169,28 @@ module Asciidoctor
158
169
  html_converter(node).convert(@filename + ".xml")
159
170
  doc_converter(node).convert(@filename + ".xml")
160
171
  end
172
+ clean_exit
173
+ ret
174
+ end
175
+
176
+ def clean_exit
161
177
  @log.write(@localdir + @filename + ".err") unless @novalid
162
178
  @files_to_delete.each { |f| FileUtils.rm f }
163
- ret
164
179
  end
165
180
 
166
181
  def makexml1(node)
167
182
  result = ["<?xml version='1.0' encoding='UTF-8'?>",
168
- "<#{self.class::XML_ROOT_TAG}>"]
183
+ "<#{xml_root_tag}>"]
169
184
  result << noko { |ixml| front node, ixml }
170
185
  result << noko { |ixml| middle node, ixml }
171
- result << "</#{self.class::XML_ROOT_TAG}>"
186
+ result << "</#{xml_root_tag}>"
172
187
  textcleanup(result)
173
188
  end
174
189
 
175
190
  def makexml(node)
176
191
  result = makexml1(node)
177
192
  ret1 = cleanup(Nokogiri::XML(result))
178
- ret1.root.add_namespace(nil, self.class::XML_NAMESPACE)
193
+ ret1.root.add_namespace(nil, xml_namespace)
179
194
  validate(ret1) unless @novalid
180
195
  ret1
181
196
  end
@@ -207,15 +222,19 @@ module Asciidoctor
207
222
  end
208
223
 
209
224
  def add_term_source(xml_t, seen_xref, m)
210
- xml_t.origin seen_xref.children[0].content,
211
- **attr_code(term_source_attr(seen_xref))
225
+ if seen_xref.children[0].name == "concept"
226
+ xml_t.origin { |o| o << seen_xref.children[0].to_xml }
227
+ else
228
+ xml_t.origin seen_xref.children[0].content,
229
+ **attr_code(term_source_attr(seen_xref))
230
+ end
212
231
  m[:text] && xml_t.modification do |mod|
213
232
  mod.p { |p| p << m[:text].sub(/^\s+/, "") }
214
233
  end
215
234
  end
216
235
 
217
236
  TERM_REFERENCE_RE_STR = <<~REGEXP.freeze
218
- ^(?<xref><xref[^>]+>([^<]*</xref>)?)
237
+ ^(?<xref><(xref|concept)[^>]+>([^<]*</(xref|concept)>)?)
219
238
  (,\s(?<text>.*))?
220
239
  $
221
240
  REGEXP
@@ -226,8 +245,7 @@ module Asciidoctor
226
245
  def extract_termsource_refs(text, node)
227
246
  matched = TERM_REFERENCE_RE.match text
228
247
  matched.nil? and
229
- #Utils::warning(node, "term reference not in expected format", text)
230
- @log.add("Asciidoctor Input", node, "term reference not in expected format: #{text}")
248
+ @log.add("AsciiDoc Input", node, "term reference not in expected format: #{text}")
231
249
  matched
232
250
  end
233
251
 
@@ -88,7 +88,7 @@
88
88
  <text/>
89
89
  </element>
90
90
  </define>
91
- <define name="LocalizedString">
91
+ <define name="LocalizedString1">
92
92
  <optional>
93
93
  <!-- multiple languages and scripts possible: comma delimit them if so -->
94
94
  <attribute name="language"/>
@@ -98,6 +98,16 @@
98
98
  </optional>
99
99
  <text/>
100
100
  </define>
101
+ <define name="LocalizedString">
102
+ <choice>
103
+ <ref name="LocalizedString1"/>
104
+ <oneOrMore>
105
+ <element name="variant">
106
+ <ref name="LocalizedString1"/>
107
+ </element>
108
+ </oneOrMore>
109
+ </choice>
110
+ </define>
101
111
  <!--
102
112
  Unlike UML, change type to format: type is overloaded
103
113
  Would be need if plain were default value and could omit the attribute
@@ -121,7 +131,7 @@
121
131
  </optional>
122
132
  <ref name="LocalizedStringOrXsAny"/>
123
133
  </define>
124
- <define name="LocalizedStringOrXsAny">
134
+ <define name="LocalizedStringOrXsAny1">
125
135
  <optional>
126
136
  <!-- multiple languages and scripts possible: comma delimit them if so -->
127
137
  <attribute name="language"/>
@@ -136,6 +146,16 @@
136
146
  </choice>
137
147
  </oneOrMore>
138
148
  </define>
149
+ <define name="LocalizedStringOrXsAny">
150
+ <choice>
151
+ <ref name="LocalizedStringOrXsAny1"/>
152
+ <oneOrMore>
153
+ <element name="variant">
154
+ <ref name="LocalizedStringOrXsAny1"/>
155
+ </element>
156
+ </oneOrMore>
157
+ </choice>
158
+ </define>
139
159
  <define name="contributor">
140
160
  <element name="contributor">
141
161
  <zeroOrMore>
@@ -767,6 +787,8 @@
767
787
  <value>unchanged</value>
768
788
  <value>circulated</value>
769
789
  <value>adapted</value>
790
+ <value>vote-started</value>
791
+ <value>vote-ended</value>
770
792
  </choice>
771
793
  </define>
772
794
  <define name="bdate">
@@ -1019,38 +1041,63 @@
1019
1041
  </define>
1020
1042
  <define name="DocRelationType">
1021
1043
  <choice>
1022
- <value>obsoletes</value>
1023
- <value>obsoletedBy</value>
1024
- <value>supersedes</value>
1025
- <value>supersededBy</value>
1026
- <value>updates</value>
1027
- <value>updatedBy</value>
1028
- <value>complements</value>
1029
- <value>derivedFrom</value>
1030
- <value>translatedFrom</value>
1031
- <value>hasTranslation</value>
1032
- <value>adoptedFrom</value>
1033
- <value>equivalent</value>
1034
- <value>identical</value>
1035
- <value>nonequivalent</value>
1036
- <value>includedIn</value>
1037
1044
  <value>includes</value>
1038
- <value>instance</value>
1039
- <value>instanceOf</value>
1040
- <value>partOf</value>
1045
+ <value>includedIn</value>
1041
1046
  <value>hasPart</value>
1042
- <value>hasDraft</value>
1043
- <value>draftOf</value>
1047
+ <value>partOf</value>
1044
1048
  <value>merges</value>
1049
+ <value>mergedInto</value>
1045
1050
  <value>splits</value>
1046
- <value>amends</value>
1047
- <value>amendedBy</value>
1048
- <value>corrects</value>
1049
- <value>correctedBy</value>
1050
- <value>revises</value>
1051
- <value>revisedBy</value>
1051
+ <value>splitInto</value>
1052
+ <value>instance</value>
1053
+ <value>hasInstance</value>
1054
+ <value>exemplarOf</value>
1055
+ <value>hasExemplar</value>
1056
+ <value>manifestationOf</value>
1057
+ <value>hasManifestation</value>
1058
+ <value>reproductionOf</value>
1059
+ <value>hasReproduction</value>
1060
+ <value>reprintOf</value>
1061
+ <value>hasReprint</value>
1062
+ <value>expressionOf</value>
1063
+ <value>hasExpression</value>
1064
+ <value>translatedFrom</value>
1065
+ <value>hasTranslation</value>
1066
+ <value>arrangementOf</value>
1067
+ <value>hasArrangement</value>
1068
+ <value>abridgementOf</value>
1069
+ <value>hasAbridgement</value>
1070
+ <value>annotationOf</value>
1071
+ <value>hasAnnotation</value>
1072
+ <value>draftOf</value>
1073
+ <value>hasDraft</value>
1074
+ <value>editionOf</value>
1075
+ <value>hasEdition</value>
1076
+ <value>updates</value>
1077
+ <value>updatedBy</value>
1078
+ <value>derivedFrom</value>
1079
+ <value>derives</value>
1052
1080
  <value>describes</value>
1053
1081
  <value>describedBy</value>
1082
+ <value>catalogues</value>
1083
+ <value>cataloguedBy</value>
1084
+ <value>hasSuccessor</value>
1085
+ <value>successorOf</value>
1086
+ <value>adaptedFrom</value>
1087
+ <value>hasAdaptation</value>
1088
+ <value>adoptedFrom</value>
1089
+ <value>adoptedAs</value>
1090
+ <value>reviewOf</value>
1091
+ <value>hasReview</value>
1092
+ <value>commentaryOf</value>
1093
+ <value>hasCommentary</value>
1094
+ <value>related</value>
1095
+ <value>complements</value>
1096
+ <value>complementOf</value>
1097
+ <value>obsoletes</value>
1098
+ <value>obsoletedBy</value>
1099
+ <value>cited</value>
1100
+ <value>isCitedIn</value>
1054
1101
  </choice>
1055
1102
  </define>
1056
1103
  <define name="docrelation">
@@ -21,6 +21,10 @@ module Asciidoctor
21
21
  subsequence: node.attr("subsequence") )
22
22
  end
23
23
 
24
+ def note_attr(node)
25
+ attr_code(id_attr(node).merge("keep-separate": node.attr("keep-separate")))
26
+ end
27
+
24
28
  # We append each contained block to its parent
25
29
  def open(node)
26
30
  role = node.role || node.attr("style")
@@ -91,7 +95,7 @@ module Asciidoctor
91
95
 
92
96
  def termnote(n)
93
97
  noko do |xml|
94
- xml.termnote **id_attr(n) do |ex|
98
+ xml.termnote **note_attr(n) do |ex|
95
99
  wrap_in_para(n, ex)
96
100
  end
97
101
  end.join("\n")
@@ -99,7 +103,7 @@ module Asciidoctor
99
103
 
100
104
  def note(n)
101
105
  noko do |xml|
102
- xml.note **id_attr(n) do |c|
106
+ xml.note **note_attr(n) do |c|
103
107
  wrap_in_para(n, c)
104
108
  end
105
109
  end.join("\n")
@@ -146,8 +150,7 @@ module Asciidoctor
146
150
 
147
151
  def pseudocode_example(node)
148
152
  noko do |xml|
149
- xml.figure **{id: Asciidoctor::Standoc::Utils::anchor_or_uuid(node),
150
- class: "pseudocode"} do |ex|
153
+ xml.figure **id_unnum_attr(node).merge(class: "pseudocode") do |ex|
151
154
  figure_title(node, ex)
152
155
  wrap_in_para(node, ex)
153
156
  end
@@ -244,7 +247,11 @@ module Asciidoctor
244
247
  end
245
248
 
246
249
  def pass(node)
247
- node.content
250
+ noko do |xml|
251
+ xml.passthrough **attr_code(formats: node.attr("format")) do |p|
252
+ p << HTMLEntities.new.encode(node.content, :basic, :hexadecimal)
253
+ end
254
+ end
248
255
  end
249
256
  end
250
257
  end
@@ -20,18 +20,18 @@ module Asciidoctor
20
20
  "<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
21
21
  end
22
22
  text = Html2Doc.
23
- asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"]).
24
- gsub(%r{<math xmlns='http://www.w3.org/1998/Math/MathML'>},
25
- "<stem type='MathML'>"\
26
- "<math xmlns='http://www.w3.org/1998/Math/MathML'>").
27
- gsub(%r{</math>}, %{</math></stem>})
23
+ asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"])
24
+ x = Nokogiri::XML(text)
25
+ x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
26
+ y.wrap("<stem type='MathML'></stem>")
27
+ end
28
+ text = x.to_xml
28
29
  end
29
30
  text.gsub(/\s+<fn /, "<fn ")
30
31
  end
31
32
 
32
33
  def cleanup(xmldoc)
33
34
  element_name_cleanup(xmldoc)
34
- termdef_cleanup(xmldoc)
35
35
  sections_cleanup(xmldoc)
36
36
  obligations_cleanup(xmldoc)
37
37
  table_cleanup(xmldoc)
@@ -45,15 +45,15 @@ module Asciidoctor
45
45
  reference_names(xmldoc)
46
46
  symbols_cleanup(xmldoc)
47
47
  xref_cleanup(xmldoc)
48
- origin_cleanup(xmldoc)
49
48
  concept_cleanup(xmldoc)
49
+ origin_cleanup(xmldoc)
50
+ termdef_cleanup(xmldoc)
50
51
  RelatonIev::iev_cleanup(xmldoc, @bibdb)
51
52
  element_name_cleanup(xmldoc)
52
53
  bpart_cleanup(xmldoc)
53
54
  quotesource_cleanup(xmldoc)
54
55
  callout_cleanup(xmldoc)
55
56
  footnote_cleanup(xmldoc)
56
- empty_element_cleanup(xmldoc)
57
57
  mathml_cleanup(xmldoc)
58
58
  script_cleanup(xmldoc)
59
59
  docidentifier_cleanup(xmldoc)
@@ -63,6 +63,8 @@ module Asciidoctor
63
63
  boilerplate_cleanup(xmldoc)
64
64
  smartquotes_cleanup(xmldoc)
65
65
  para_cleanup(xmldoc)
66
+ empty_element_cleanup(xmldoc)
67
+ img_cleanup(xmldoc)
66
68
  xmldoc
67
69
  end
68
70
 
@@ -157,6 +159,13 @@ module Asciidoctor
157
159
  x.replace(x.children)
158
160
  end
159
161
  end
162
+
163
+ def img_cleanup(xmldoc)
164
+ return xmldoc unless @datauriimage
165
+ xmldoc.xpath("//image").each do |i|
166
+ i["src"] = datauri(i["src"])
167
+ end
168
+ end
160
169
  end
161
170
  end
162
171
  end