metanorma-standoc 1.3.25 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +8 -0
- data/.github/workflows/ubuntu.yml +8 -0
- data/.github/workflows/windows.yml +8 -0
- data/.gitignore +1 -0
- data/lib/asciidoctor/standoc/base.rb +10 -29
- data/lib/asciidoctor/standoc/biblio.rng +35 -5
- data/lib/asciidoctor/standoc/blocks.rb +30 -20
- data/lib/asciidoctor/standoc/cleanup.rb +11 -1
- data/lib/asciidoctor/standoc/cleanup_block.rb +5 -2
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +1 -3
- data/lib/asciidoctor/standoc/cleanup_ref.rb +11 -6
- data/lib/asciidoctor/standoc/cleanup_section.rb +23 -127
- data/lib/asciidoctor/standoc/cleanup_terms.rb +134 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +102 -0
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +408 -0
- data/lib/asciidoctor/standoc/inline.rb +11 -6
- data/lib/asciidoctor/standoc/isodoc.rng +23 -4
- data/lib/asciidoctor/standoc/macros.rb +13 -8
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +19 -13
- data/lib/asciidoctor/standoc/ref.rb +14 -57
- data/lib/asciidoctor/standoc/ref_sect.rb +124 -0
- data/lib/asciidoctor/standoc/section.rb +21 -38
- data/lib/asciidoctor/standoc/validate.rb +8 -2
- data/lib/asciidoctor/standoc/validate_section.rb +1 -3
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +30 -0
- data/lib/asciidoctor/standoc/views/datamodel/plantuml_representation.adoc.erb +20 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor-standoc/blocks_spec.rb +18 -1
- data/spec/asciidoctor-standoc/cleanup_spec.rb +100 -26
- data/spec/asciidoctor-standoc/datamodel/attributes_table_preprocessor_spec.rb +76 -0
- data/spec/asciidoctor-standoc/datamodel/diagram_preprocessor_spec.rb +72 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +6 -2
- data/spec/asciidoctor-standoc/macros_spec.rb +55 -4
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +2 -1
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +91 -3
- data/spec/asciidoctor-standoc/refs_spec.rb +35 -21
- data/spec/asciidoctor-standoc/section_spec.rb +139 -6
- data/spec/asciidoctor-standoc/validate_spec.rb +33 -2
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/examples/datamodel/address_class_profile.adoc +4 -0
- data/spec/examples/datamodel/address_component_profile.adoc +4 -0
- data/spec/examples/datamodel/common_models_diagram.adoc +4 -0
- data/spec/examples/datamodel/models/models/AddressClassProfile.yml +90 -0
- data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +63 -0
- data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +15 -0
- data/spec/examples/datamodel/models/models/AddressProfile.yml +36 -0
- data/spec/examples/datamodel/models/models/AttributeProfile.yml +32 -0
- data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +79 -0
- data/spec/examples/datamodel/models/models/Localization copy.yml +23 -0
- data/spec/examples/datamodel/models/models/Localization.yml +23 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +36 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +15 -0
- data/spec/examples/datamodel/models/models/Signature copy.yml +20 -0
- data/spec/examples/datamodel/models/models/Signature.yml +20 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +16 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode.yml +16 -0
- data/spec/examples/datamodel/models/models/Validity.yml +14 -0
- data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +22 -0
- data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +2 -0
- data/spec/examples/datamodel/models/style.uml.inc +37 -0
- data/spec/examples/datamodel/models/views/CommonModels.yml +9 -0
- data/spec/examples/datamodel/models/views/TopDown.yml +62 -0
- data/spec/examples/datamodel/top_down_diagram.adoc +4 -0
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +149 -0
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +71 -0
- data/spec/fixtures/macros_datamodel/common_models_diagram.xml +7 -0
- data/spec/fixtures/macros_datamodel/top_down_diagram.xml +7 -0
- data/spec/spec_helper.rb +13 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +65 -65
- data/spec/vcr_cassettes/isobib_get_123.yml +37 -37
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +17 -17
- data/spec/vcr_cassettes/isobib_get_124.yml +16 -16
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +40 -37
- metadata +42 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e86d9135fffb1f112db82f9d052632aa36f134a76b03ff48e65dcb841c7cbb4
|
4
|
+
data.tar.gz: ea05dff988ebaf6b51c029d99cbadd195300c3c524acd301157a335257436c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beead161e217dba5841732200aa8cb897900ea90b1a449f092fe63ffe40ca59a6b904b098affd1a475723ac4663ba5dadd09fdab48b661376c4fe659360c79a4
|
7
|
+
data.tar.gz: 43b697f04165938864eab22a1d4d49613adef7ae1703995a5541018fe438f09ff21dd43e37e25ebeab9a0d514b50f64b64d2a8a47c8836b924d4578b9f076d19
|
data/.github/workflows/macos.yml
CHANGED
@@ -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
|
@@ -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
|
@@ -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
|
data/.gitignore
CHANGED
@@ -15,6 +15,8 @@ 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::Datamodel::AttributesTablePreprocessor
|
19
|
+
preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
|
18
20
|
preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
|
19
21
|
inline_macro Asciidoctor::Standoc::AltTermInlineMacro
|
20
22
|
inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
|
@@ -43,7 +45,7 @@ module Asciidoctor
|
|
43
45
|
def skip(node, name = nil)
|
44
46
|
name = name || node.node_name
|
45
47
|
w = "converter missing for #{name} node in Metanorma backend"
|
46
|
-
@log.add("
|
48
|
+
@log.add("AsciiDoc Input", node, w)
|
47
49
|
nil
|
48
50
|
end
|
49
51
|
|
@@ -109,7 +111,7 @@ module Asciidoctor
|
|
109
111
|
@fontheader = default_fonts(node)
|
110
112
|
@files_to_delete = []
|
111
113
|
@filename = node.attr("docfile") ?
|
112
|
-
node.attr("docfile").gsub(/\.adoc$/, "")
|
114
|
+
File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
|
113
115
|
@localdir = Utils::localdir(node)
|
114
116
|
@no_isobib_cache = node.attr("no-isobib-cache")
|
115
117
|
@no_isobib = node.attr("no-isobib")
|
@@ -125,31 +127,6 @@ module Asciidoctor
|
|
125
127
|
i18n_init(lang, script)
|
126
128
|
end
|
127
129
|
|
128
|
-
def init_bib_caches(node)
|
129
|
-
return if @no_isobib
|
130
|
-
global = !@no_isobib_cache && !node.attr("local-cache-only")
|
131
|
-
local = node.attr("local-cache") || node.attr("local-cache-only")
|
132
|
-
local = nil if @no_isobib_cache
|
133
|
-
@bibdb = Relaton::DbCache.init_bib_caches(
|
134
|
-
local_cache: local,
|
135
|
-
flush_caches: node.attr("flush-caches"),
|
136
|
-
global_cache: global)
|
137
|
-
end
|
138
|
-
|
139
|
-
def init_iev_caches(node)
|
140
|
-
unless (@no_isobib_cache || @no_isobib)
|
141
|
-
node.attr("local-cache-only") or
|
142
|
-
@iev_globalname = global_ievcache_name
|
143
|
-
@iev_localname = local_ievcache_name(node.attr("local-cache") ||
|
144
|
-
node.attr("local-cache-only"))
|
145
|
-
if node.attr("flush-caches")
|
146
|
-
FileUtils.rm_f @iev_globalname unless @iev_globalname.nil?
|
147
|
-
FileUtils.rm_f @iev_localname unless @iev_localname.nil?
|
148
|
-
end
|
149
|
-
end
|
150
|
-
#@iev = Iev::Db.new(globalname, localname) unless @no_isobib
|
151
|
-
end
|
152
|
-
|
153
130
|
def default_fonts(node)
|
154
131
|
b = node.attr("body-font") ||
|
155
132
|
(node.attr("script") == "Hans" ? '"SimSun",serif' :
|
@@ -169,9 +146,13 @@ module Asciidoctor
|
|
169
146
|
html_converter(node).convert(@filename + ".xml")
|
170
147
|
doc_converter(node).convert(@filename + ".xml")
|
171
148
|
end
|
149
|
+
clean_exit
|
150
|
+
ret
|
151
|
+
end
|
152
|
+
|
153
|
+
def clean_exit
|
172
154
|
@log.write(@localdir + @filename + ".err") unless @novalid
|
173
155
|
@files_to_delete.each { |f| FileUtils.rm f }
|
174
|
-
ret
|
175
156
|
end
|
176
157
|
|
177
158
|
def makexml1(node)
|
@@ -241,7 +222,7 @@ module Asciidoctor
|
|
241
222
|
def extract_termsource_refs(text, node)
|
242
223
|
matched = TERM_REFERENCE_RE.match text
|
243
224
|
matched.nil? and
|
244
|
-
@log.add("
|
225
|
+
@log.add("AsciiDoc Input", node, "term reference not in expected format: #{text}")
|
245
226
|
matched
|
246
227
|
end
|
247
228
|
|
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
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="
|
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>
|
@@ -641,9 +661,9 @@
|
|
641
661
|
<optional>
|
642
662
|
<ref name="status"/>
|
643
663
|
</optional>
|
644
|
-
<
|
664
|
+
<zeroOrMore>
|
645
665
|
<ref name="copyright"/>
|
646
|
-
</
|
666
|
+
</zeroOrMore>
|
647
667
|
<zeroOrMore>
|
648
668
|
<ref name="docrelation"/>
|
649
669
|
</zeroOrMore>
|
@@ -1001,7 +1021,17 @@
|
|
1001
1021
|
<optional>
|
1002
1022
|
<ref name="to"/>
|
1003
1023
|
</optional>
|
1004
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
1005
1035
|
</element>
|
1006
1036
|
</define>
|
1007
1037
|
<define name="from">
|
@@ -21,11 +21,21 @@ module Asciidoctor
|
|
21
21
|
subsequence: node.attr("subsequence") )
|
22
22
|
end
|
23
23
|
|
24
|
+
def termnote_attr(node)
|
25
|
+
attr_code(id_attr(node).merge(
|
26
|
+
"keep-separate": node.attr("keep-separate")))
|
27
|
+
end
|
28
|
+
|
29
|
+
def note_attr(node)
|
30
|
+
attr_code(id_attr(node).merge(
|
31
|
+
"keep-separate": node.attr("keep-separate"),
|
32
|
+
beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil))
|
33
|
+
end
|
34
|
+
|
24
35
|
# We append each contained block to its parent
|
25
36
|
def open(node)
|
26
37
|
role = node.role || node.attr("style")
|
27
|
-
Utils::reqt_subpart(role) and
|
28
|
-
return requirement_subpart(node)
|
38
|
+
Utils::reqt_subpart(role) and return requirement_subpart(node)
|
29
39
|
result = []
|
30
40
|
node.blocks.each do |b|
|
31
41
|
result << send(b.context, b)
|
@@ -49,18 +59,16 @@ module Asciidoctor
|
|
49
59
|
|
50
60
|
# NOTE: html escaping is performed by Nokogiri
|
51
61
|
def stem(node)
|
52
|
-
stem_content = node.lines.join("\n")
|
53
62
|
noko do |xml|
|
54
63
|
xml.formula **formula_attr(node) do |s|
|
55
|
-
stem_parse(
|
64
|
+
stem_parse(node.lines.join("\n"), s, node.style.to_sym)
|
56
65
|
end
|
57
66
|
end
|
58
67
|
end
|
59
68
|
|
60
69
|
def sidebar_attrs(node)
|
61
70
|
todo_attrs(node).merge(attr_code(
|
62
|
-
from: node.attr("from"),
|
63
|
-
to: node.attr("to") || node.attr("from") ))
|
71
|
+
from: node.attr("from"), to: node.attr("to") || node.attr("from") ))
|
64
72
|
end
|
65
73
|
|
66
74
|
def sidebar(node)
|
@@ -91,7 +99,7 @@ module Asciidoctor
|
|
91
99
|
|
92
100
|
def termnote(n)
|
93
101
|
noko do |xml|
|
94
|
-
xml.termnote **
|
102
|
+
xml.termnote **termnote_attr(n) do |ex|
|
95
103
|
wrap_in_para(n, ex)
|
96
104
|
end
|
97
105
|
end.join("\n")
|
@@ -99,7 +107,7 @@ module Asciidoctor
|
|
99
107
|
|
100
108
|
def note(n)
|
101
109
|
noko do |xml|
|
102
|
-
xml.note **
|
110
|
+
xml.note **note_attr(n) do |c|
|
103
111
|
wrap_in_para(n, c)
|
104
112
|
end
|
105
113
|
end.join("\n")
|
@@ -107,12 +115,11 @@ module Asciidoctor
|
|
107
115
|
|
108
116
|
def admonition_attrs(node)
|
109
117
|
name = node.attr("name")
|
110
|
-
|
111
|
-
|
112
|
-
name = t if type.casecmp(t).zero?
|
113
|
-
end
|
118
|
+
a = node.attr("type") and ["danger", "safety precautions"].each do |t|
|
119
|
+
name = t if a.casecmp(t).zero?
|
114
120
|
end
|
115
|
-
attr_code(id: Utils::anchor_or_uuid(node), type: name
|
121
|
+
attr_code(id: Utils::anchor_or_uuid(node), type: name,
|
122
|
+
beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil)
|
116
123
|
end
|
117
124
|
|
118
125
|
def admonition(node)
|
@@ -145,9 +152,10 @@ module Asciidoctor
|
|
145
152
|
end
|
146
153
|
|
147
154
|
def pseudocode_example(node)
|
155
|
+
# prevent A's and other subs inappropriate for pseudocode
|
156
|
+
node.blocks.each { |b| b.remove_sub(:replacements) }
|
148
157
|
noko do |xml|
|
149
|
-
xml.figure **
|
150
|
-
class: "pseudocode"} do |ex|
|
158
|
+
xml.figure **id_unnum_attr(node).merge(class: "pseudocode") do |ex|
|
151
159
|
figure_title(node, ex)
|
152
160
|
wrap_in_para(node, ex)
|
153
161
|
end
|
@@ -186,8 +194,7 @@ module Asciidoctor
|
|
186
194
|
end
|
187
195
|
|
188
196
|
def para_attrs(node)
|
189
|
-
attr_code(align: node.attr("align"),
|
190
|
-
id: Utils::anchor_or_uuid(node))
|
197
|
+
attr_code(align: node.attr("align"), id: Utils::anchor_or_uuid(node))
|
191
198
|
end
|
192
199
|
|
193
200
|
def paragraph(node)
|
@@ -210,9 +217,8 @@ module Asciidoctor
|
|
210
217
|
s << m[:text]
|
211
218
|
end
|
212
219
|
end
|
213
|
-
|
220
|
+
node.attr("attribution") and
|
214
221
|
out.author { |a| a << node.attr("attribution") }
|
215
|
-
end
|
216
222
|
end
|
217
223
|
|
218
224
|
def quote(node)
|
@@ -244,7 +250,11 @@ module Asciidoctor
|
|
244
250
|
end
|
245
251
|
|
246
252
|
def pass(node)
|
247
|
-
|
253
|
+
noko do |xml|
|
254
|
+
xml.passthrough **attr_code(formats: node.attr("format")) do |p|
|
255
|
+
p << HTMLEntities.new.encode(node.content, :basic, :hexadecimal)
|
256
|
+
end
|
257
|
+
end
|
248
258
|
end
|
249
259
|
end
|
250
260
|
end
|
@@ -7,6 +7,7 @@ require_relative "./cleanup_footnotes.rb"
|
|
7
7
|
require_relative "./cleanup_ref.rb"
|
8
8
|
require_relative "./cleanup_boilerplate.rb"
|
9
9
|
require_relative "./cleanup_section.rb"
|
10
|
+
require_relative "./cleanup_terms.rb"
|
10
11
|
require_relative "./cleanup_inline.rb"
|
11
12
|
require "relaton_iev"
|
12
13
|
|
@@ -39,6 +40,7 @@ module Asciidoctor
|
|
39
40
|
figure_cleanup(xmldoc)
|
40
41
|
ref_cleanup(xmldoc)
|
41
42
|
note_cleanup(xmldoc)
|
43
|
+
clausebefore_cleanup(xmldoc)
|
42
44
|
ref_dl_cleanup(xmldoc)
|
43
45
|
normref_cleanup(xmldoc)
|
44
46
|
biblio_cleanup(xmldoc)
|
@@ -54,7 +56,6 @@ module Asciidoctor
|
|
54
56
|
quotesource_cleanup(xmldoc)
|
55
57
|
callout_cleanup(xmldoc)
|
56
58
|
footnote_cleanup(xmldoc)
|
57
|
-
empty_element_cleanup(xmldoc)
|
58
59
|
mathml_cleanup(xmldoc)
|
59
60
|
script_cleanup(xmldoc)
|
60
61
|
docidentifier_cleanup(xmldoc)
|
@@ -64,6 +65,8 @@ module Asciidoctor
|
|
64
65
|
boilerplate_cleanup(xmldoc)
|
65
66
|
smartquotes_cleanup(xmldoc)
|
66
67
|
para_cleanup(xmldoc)
|
68
|
+
empty_element_cleanup(xmldoc)
|
69
|
+
img_cleanup(xmldoc)
|
67
70
|
xmldoc
|
68
71
|
end
|
69
72
|
|
@@ -158,6 +161,13 @@ module Asciidoctor
|
|
158
161
|
x.replace(x.children)
|
159
162
|
end
|
160
163
|
end
|
164
|
+
|
165
|
+
def img_cleanup(xmldoc)
|
166
|
+
return xmldoc unless @datauriimage
|
167
|
+
xmldoc.xpath("//image").each do |i|
|
168
|
+
i["src"] = datauri(i["src"])
|
169
|
+
end
|
170
|
+
end
|
161
171
|
end
|
162
172
|
end
|
163
173
|
end
|
@@ -131,10 +131,13 @@ module Asciidoctor
|
|
131
131
|
def note_cleanup(xmldoc)
|
132
132
|
q = "//note[following-sibling::*[not(local-name() = 'note')]]"
|
133
133
|
xmldoc.xpath(q).each do |n|
|
134
|
+
next if n["keep-separate"] == "true"
|
134
135
|
next unless n.ancestors("table").empty?
|
135
136
|
prev = n.previous_element || next
|
136
137
|
n.parent = prev if ELEMS_ALLOW_NOTES.include? prev.name
|
137
138
|
end
|
139
|
+
xmldoc.xpath("//note[@keep-separate]").each { |n| n.delete("keep-separate") }
|
140
|
+
xmldoc.xpath("//termnote[@keep-separate]").each { |n| n.delete("keep-separate") }
|
138
141
|
end
|
139
142
|
|
140
143
|
def requirement_cleanup(x)
|
@@ -144,7 +147,7 @@ module Asciidoctor
|
|
144
147
|
|
145
148
|
def requirement_inherit(x)
|
146
149
|
x.xpath("//requirement | //recommendation | //permission").each do |r|
|
147
|
-
ins = r.at("./classification") ||
|
150
|
+
ins = r.at("./classification") ||
|
148
151
|
r.at("./description | ./measurementtarget | ./specification | "\
|
149
152
|
"./verification | ./import | ./description | ./requirement | "\
|
150
153
|
"./recommendation | ./permission")
|
@@ -155,7 +158,7 @@ module Asciidoctor
|
|
155
158
|
def requirement_descriptions(x)
|
156
159
|
x.xpath("//requirement | //recommendation | //permission").each do |r|
|
157
160
|
r.children.each do |e|
|
158
|
-
unless e.element? && (Utils::reqt_subpart(e.name) ||
|
161
|
+
unless e.element? && (Utils::reqt_subpart(e.name) ||
|
159
162
|
%w(requirement recommendation permission).include?(e.name))
|
160
163
|
t = Nokogiri::XML::Element.new("description", x)
|
161
164
|
e.before(t)
|