metanorma-standoc 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +20 -16
- data/README.adoc +1 -3
- data/lib/asciidoctor/standoc/cleanup.rb +52 -4
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
- data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
- data/lib/asciidoctor/standoc/converter.rb +2 -0
- data/lib/asciidoctor/standoc/isodoc.rng +13 -0
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +15 -0
- data/lib/asciidoctor/standoc/ref.rb +2 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -0
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1498 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +341 -1543
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +7 -7
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +34 -0
- data/spec/asciidoctor-standoc/refs_spec.rb +12 -12
- data/spec/fixtures/test.exp +121 -0
- data/spec/spec_helper.rb +29 -1
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +43 -43
- data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +29 -29
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +52 -40
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ca3aedd38f18114d3fb4c86c797294a3f1fb4fced3dbe22141980ad899df051
|
4
|
+
data.tar.gz: b885be1a706d741781853f85df50fe988b9ed93d31f15f6458c3f8debe8ab704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b679c9834b6a85dcbbb743a50f4fe4cae499cf6bc8f6bebe2c58545bc09b282fe2c529068fa8db2a3027023f983f6b589a1b1883b356f18710d34cbdf8e13ce4
|
7
|
+
data.tar.gz: 583bc49e6a03656378f097a2acfa91578699d04be365bd92e3515b0252a940104efddf778ef79784fa27e06997345505a8527c530a86cdeaf3d13c78cc644e1f
|
data/.github/workflows/rake.yml
CHANGED
@@ -4,7 +4,8 @@ name: rake
|
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
|
-
branches: [ master ]
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
8
9
|
pull_request:
|
9
10
|
|
10
11
|
jobs:
|
@@ -31,32 +32,35 @@ jobs:
|
|
31
32
|
steps:
|
32
33
|
- uses: actions/checkout@master
|
33
34
|
|
34
|
-
-
|
35
|
-
uses: ruby/setup-ruby@v1
|
35
|
+
- uses: ruby/setup-ruby@v1
|
36
36
|
with:
|
37
37
|
ruby-version: ${{ matrix.ruby }}
|
38
|
-
bundler-cache: true
|
39
38
|
|
40
|
-
-
|
41
|
-
|
39
|
+
- uses: actions/cache@v1
|
40
|
+
with:
|
41
|
+
path: vendor/bundle
|
42
|
+
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
43
|
+
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
44
|
+
|
45
|
+
- run: bundle config set path 'vendor/bundle'
|
46
|
+
|
47
|
+
- run: bundle install --jobs 4 --retry 3
|
42
48
|
|
43
|
-
- name:
|
49
|
+
- name: install plantuml ubuntu
|
44
50
|
if: matrix.os == 'ubuntu-latest'
|
45
51
|
uses: nick-invision/retry@v1
|
46
52
|
with:
|
47
53
|
polling_interval_seconds: 5
|
48
54
|
timeout_minutes: 5
|
49
55
|
max_attempts: 3
|
50
|
-
command:
|
56
|
+
command: >
|
57
|
+
sudo apt-get update -y && sudo bash -c
|
58
|
+
"curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
51
59
|
|
52
|
-
-
|
53
|
-
if: matrix.os == 'macos-latest'
|
60
|
+
- if: matrix.os == 'macos-latest'
|
54
61
|
run: brew install plantuml
|
55
62
|
|
56
|
-
-
|
57
|
-
|
58
|
-
run: |
|
59
|
-
cinst -y plantuml
|
63
|
+
- if: matrix.os == 'windows-latest'
|
64
|
+
run: cinst -y plantuml
|
60
65
|
|
61
|
-
-
|
62
|
-
run: bundle exec rake
|
66
|
+
- run: bundle exec rake
|
data/README.adoc
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
= Metanorma-standoc
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma-standoc.svg["Gem Version", link="https://rubygems.org/gems/metanorma-standoc"]
|
4
|
-
image:https://github.com/metanorma/metanorma-standoc/workflows/
|
5
|
-
image:https://github.com/metanorma/metanorma-standoc/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-standoc/actions?workflow=ubuntu"]
|
6
|
-
image:https://github.com/metanorma/metanorma-standoc/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-standoc/actions?workflow=windows"]
|
4
|
+
image:https://github.com/metanorma/metanorma-standoc/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-standoc/actions?workflow=rake"]
|
7
5
|
image:https://codeclimate.com/github/metanorma/metanorma-standoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-standoc"]
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-standoc.svg["Pull Requests", link="https://github.com/metanorma/metanorma-standoc/pulls"]
|
9
7
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-standoc/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-standoc/releases"]
|
@@ -69,6 +69,7 @@ module Asciidoctor
|
|
69
69
|
bibdata_cleanup(xmldoc)
|
70
70
|
boilerplate_cleanup(xmldoc)
|
71
71
|
smartquotes_cleanup(xmldoc)
|
72
|
+
variant_cleanup(xmldoc)
|
72
73
|
para_cleanup(xmldoc)
|
73
74
|
empty_element_cleanup(xmldoc)
|
74
75
|
img_cleanup(xmldoc)
|
@@ -155,17 +156,42 @@ module Asciidoctor
|
|
155
156
|
x.children = math
|
156
157
|
end
|
157
158
|
|
159
|
+
MATHML_NS = "http://www.w3.org/1998/Math/MathML".freeze
|
160
|
+
|
158
161
|
def mathml_preserve_space(m)
|
159
|
-
m.xpath(".//m:mtext",
|
160
|
-
"m" => "http://www.w3.org/1998/Math/MathML").each do |x|
|
162
|
+
m.xpath(".//m:mtext", "m" => MATHML_NS).each do |x|
|
161
163
|
x.children = x.children.to_xml.gsub(/^\s/, " ").
|
162
164
|
gsub(/\s$/, " ")
|
163
165
|
end
|
164
166
|
end
|
165
167
|
|
166
168
|
def mathml_namespace(stem)
|
167
|
-
stem.xpath("./math", ).each
|
168
|
-
|
169
|
+
stem.xpath("./math", ).each { |x| x.default_namespace = MATHML_NS }
|
170
|
+
end
|
171
|
+
|
172
|
+
def mathml_mi_italics
|
173
|
+
{ uppergreek: true, upperroman: true,
|
174
|
+
lowergreek: true, lowerroman: true }
|
175
|
+
end
|
176
|
+
|
177
|
+
# presuppose multichar mi upright, singlechar mi MathML default italic
|
178
|
+
def mathml_italicise(x)
|
179
|
+
x.xpath(".//m:mi", "m" => MATHML_NS).each do |i|
|
180
|
+
char = HTMLEntities.new.decode(i.text)
|
181
|
+
i["mathvariant"] = "normal" if mi_italicise?(char)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def mi_italicise?(c)
|
186
|
+
return false if c.length > 1
|
187
|
+
if /\p{Greek}/.match(c)
|
188
|
+
/\p{Lower}/.match(c) && !mathml_mi_italics[:lowergreek] ||
|
189
|
+
/\p{Upper}/.match(c) && !mathml_mi_italics[:uppergreek]
|
190
|
+
elsif /\p{Latin}/.match(c)
|
191
|
+
/\p{Lower}/.match(c) && !mathml_mi_italics[:lowerroman] ||
|
192
|
+
/\p{Upper}/.match(c) && !mathml_mi_italics[:upperroman]
|
193
|
+
else
|
194
|
+
false
|
169
195
|
end
|
170
196
|
end
|
171
197
|
|
@@ -174,6 +200,7 @@ module Asciidoctor
|
|
174
200
|
xml_unescape_mathml(x)
|
175
201
|
mathml_namespace(x)
|
176
202
|
mathml_preserve_space(x)
|
203
|
+
mathml_italicise(x)
|
177
204
|
end
|
178
205
|
end
|
179
206
|
|
@@ -192,6 +219,27 @@ module Asciidoctor
|
|
192
219
|
i["src"] = datauri(i["src"])
|
193
220
|
end
|
194
221
|
end
|
222
|
+
|
223
|
+
def variant_cleanup(xmldoc)
|
224
|
+
xmldoc.xpath("//*[variant]").each do |c|
|
225
|
+
c&.next&.text? && c&.next&.next&.name == "variant" &&
|
226
|
+
c.next.text.gsub(/\s/, "").empty? and c.next.remove
|
227
|
+
end
|
228
|
+
xmldoc.xpath("//*[variant]").each do |c|
|
229
|
+
next unless c.children.any? do |n|
|
230
|
+
n.name != "variant" && (!n.text? || !n.text.gsub(/\s/, "").empty?)
|
231
|
+
end
|
232
|
+
c.xpath("./variant").each do |n|
|
233
|
+
if n.at_xpath('preceding-sibling::node()[not(self::text()'\
|
234
|
+
'[not(normalize-space())])][1][self::variantwrap]')
|
235
|
+
n.previous_element << n
|
236
|
+
else
|
237
|
+
n.replace('<variantwrap/>').first << n
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
xmldoc.xpath("//variantwrap").each { |n| n.name = "variant" }
|
242
|
+
end
|
195
243
|
end
|
196
244
|
end
|
197
245
|
end
|
@@ -19,12 +19,22 @@ module Asciidoctor
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def dl1_table_cleanup(xmldoc)
|
23
|
+
q = "//table/following-sibling::*[1][self::dl]"
|
24
|
+
xmldoc.xpath(q).each do |s|
|
25
|
+
if s["key"] == "true"
|
26
|
+
s.previous_element << s.remove
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
# move Key dl after table footer
|
23
|
-
def
|
32
|
+
def dl2_table_cleanup(xmldoc)
|
24
33
|
q = "//table/following-sibling::*[1][self::p]"
|
25
34
|
xmldoc.xpath(q).each do |s|
|
26
35
|
if s.text =~ /^\s*key[^a-z]*$/i && !s.next_element.nil? &&
|
27
36
|
s.next_element.name == "dl"
|
37
|
+
s.next_element["key"] = "true"
|
28
38
|
s.previous_element << s.next_element.remove
|
29
39
|
s.remove
|
30
40
|
end
|
@@ -54,7 +64,8 @@ module Asciidoctor
|
|
54
64
|
end
|
55
65
|
|
56
66
|
def table_cleanup(xmldoc)
|
57
|
-
|
67
|
+
dl1_table_cleanup(xmldoc)
|
68
|
+
dl2_table_cleanup(xmldoc)
|
58
69
|
notes_table_cleanup(xmldoc)
|
59
70
|
header_rows_cleanup(xmldoc)
|
60
71
|
end
|
@@ -74,22 +85,47 @@ module Asciidoctor
|
|
74
85
|
|
75
86
|
# include where definition list inside stem block
|
76
87
|
def formula_cleanup(x)
|
88
|
+
formula_cleanup_where1(x)
|
89
|
+
formula_cleanup_where2(x)
|
90
|
+
end
|
91
|
+
|
92
|
+
def formula_cleanup_where1(x)
|
93
|
+
q = "//formula/following-sibling::*[1][self::dl]"
|
94
|
+
x.xpath(q).each do |s|
|
95
|
+
if s["key"] == "true"
|
96
|
+
s.previous_element << s.remove
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def formula_cleanup_where2(x)
|
77
102
|
q = "//formula/following-sibling::*[1][self::p]"
|
78
103
|
x.xpath(q).each do |s|
|
79
104
|
if s.text =~ /^\s*where[^a-z]*$/i && !s.next_element.nil? &&
|
80
105
|
s.next_element.name == "dl"
|
106
|
+
s.next_element["key"] = "true"
|
81
107
|
s.previous_element << s.next_element.remove
|
82
108
|
s.remove
|
83
109
|
end
|
84
110
|
end
|
85
111
|
end
|
86
112
|
|
113
|
+
def figure_dl_cleanup1(xmldoc)
|
114
|
+
q = "//figure/following-sibling::*[self::dl]"
|
115
|
+
xmldoc.xpath(q).each do |s|
|
116
|
+
if s["key"] == "true"
|
117
|
+
s.previous_element << s.remove
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
87
122
|
# include key definition list inside figure
|
88
|
-
def
|
123
|
+
def figure_dl_cleanup2(xmldoc)
|
89
124
|
q = "//figure/following-sibling::*[self::p]"
|
90
125
|
xmldoc.xpath(q).each do |s|
|
91
126
|
if s.text =~ /^\s*key[^a-z]*$/i && !s.next_element.nil? &&
|
92
127
|
s.next_element.name == "dl"
|
128
|
+
s.next_element["key"] = "true"
|
93
129
|
s.previous_element << s.next_element.remove
|
94
130
|
s.remove
|
95
131
|
end
|
@@ -115,7 +151,8 @@ module Asciidoctor
|
|
115
151
|
|
116
152
|
def figure_cleanup(xmldoc)
|
117
153
|
figure_footnote_cleanup(xmldoc)
|
118
|
-
|
154
|
+
figure_dl_cleanup1(xmldoc)
|
155
|
+
figure_dl_cleanup2(xmldoc)
|
119
156
|
subfigure_cleanup(xmldoc)
|
120
157
|
end
|
121
158
|
|
@@ -49,8 +49,12 @@ module Asciidoctor
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def extract_localities(x)
|
52
|
-
|
53
|
-
|
52
|
+
f = x&.children&.first or return
|
53
|
+
f.text? or return
|
54
|
+
head = f.remove.text
|
55
|
+
tail = x&.children&.remove
|
56
|
+
extract_localities1(x, head)
|
57
|
+
tail and x << tail
|
54
58
|
end
|
55
59
|
|
56
60
|
def extract_localities1(x, text)
|
@@ -25,6 +25,7 @@ module Asciidoctor
|
|
25
25
|
preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
|
26
26
|
preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
|
27
27
|
preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
|
28
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
|
28
29
|
inline_macro Asciidoctor::Standoc::AltTermInlineMacro
|
29
30
|
inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
|
30
31
|
inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
|
@@ -32,6 +33,7 @@ module Asciidoctor
|
|
32
33
|
inline_macro Asciidoctor::Standoc::HTML5RubyMacro
|
33
34
|
inline_macro Asciidoctor::Standoc::ConceptInlineMacro
|
34
35
|
inline_macro Asciidoctor::Standoc::AutonumberInlineMacro
|
36
|
+
inline_macro Asciidoctor::Standoc::VariantInlineMacro
|
35
37
|
block Asciidoctor::Standoc::ToDoAdmonitionBlock
|
36
38
|
treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
|
37
39
|
block Asciidoctor::Standoc::PlantUMLBlockMacro
|
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -141,6 +149,11 @@
|
|
141
149
|
<data type="boolean"/>
|
142
150
|
</attribute>
|
143
151
|
</optional>
|
152
|
+
<optional>
|
153
|
+
<attribute name="key">
|
154
|
+
<data type="boolean"/>
|
155
|
+
</attribute>
|
156
|
+
</optional>
|
144
157
|
<oneOrMore>
|
145
158
|
<ref name="dt"/>
|
146
159
|
<ref name="dd"/>
|
@@ -55,7 +55,7 @@ module Asciidoctor
|
|
55
55
|
|
56
56
|
def ol_attrs(node)
|
57
57
|
attr_code(keep_attrs(node).merge(id: Utils::anchor_or_uuid(node),
|
58
|
-
|
58
|
+
type: olist_style(node.style)))
|
59
59
|
end
|
60
60
|
|
61
61
|
def olist(node)
|
@@ -87,7 +87,9 @@ module Asciidoctor
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def dl_attrs(node)
|
90
|
-
attr_code(
|
90
|
+
attr_code(keep_attrs(node).
|
91
|
+
merge(id: Utils::anchor_or_uuid(node),
|
92
|
+
key: node.option?("key") ? "true" : nil))
|
91
93
|
end
|
92
94
|
|
93
95
|
def dlist(node)
|
@@ -6,6 +6,7 @@ require_relative "./macros_plantuml.rb"
|
|
6
6
|
require_relative "./datamodel/attributes_table_preprocessor.rb"
|
7
7
|
require_relative "./datamodel/diagram_preprocessor.rb"
|
8
8
|
require "metanorma-plugin-datastruct"
|
9
|
+
require "metanorma-plugin-lutaml"
|
9
10
|
|
10
11
|
module Asciidoctor
|
11
12
|
module Standoc
|
@@ -186,5 +187,19 @@ module Asciidoctor
|
|
186
187
|
%{<autonumber type=#{target}>#{out}</autonumber>}
|
187
188
|
end
|
188
189
|
end
|
190
|
+
|
191
|
+
class VariantInlineMacro < Extensions::InlineMacroProcessor
|
192
|
+
use_dsl
|
193
|
+
named :lang
|
194
|
+
parse_content_as :text
|
195
|
+
|
196
|
+
def process(parent, target, attrs)
|
197
|
+
/^(?<lang>[^-]*)(-(?<script>.*))?$/ =~ target
|
198
|
+
out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
|
199
|
+
script ?
|
200
|
+
%{<variant lang=#{lang} script=#{script}>#{out}</variant>} :
|
201
|
+
%{<variant lang=#{lang}>#{out}</variant>}
|
202
|
+
end
|
203
|
+
end
|
189
204
|
end
|
190
205
|
end
|
@@ -94,7 +94,7 @@ module Asciidoctor
|
|
94
94
|
d.on "--"
|
95
95
|
end
|
96
96
|
iso_publisher(t, m[:code])
|
97
|
-
m[:fn].nil? or t.note(**plaintxt.merge(type: "
|
97
|
+
m[:fn].nil? or t.note(**plaintxt.merge(type: "Unpublished-Status")) do |p|
|
98
98
|
p << "#{m[:fn]}"
|
99
99
|
end
|
100
100
|
end
|
@@ -124,7 +124,7 @@ module Asciidoctor
|
|
124
124
|
conditional_date(t, m, yr == "--")
|
125
125
|
iso_publisher(t, m[:code])
|
126
126
|
m.names.include?("fn") && m[:fn] and
|
127
|
-
t.note(**plaintxt.merge(type: "
|
127
|
+
t.note(**plaintxt.merge(type: "Unpublished-Status")) { |p| p << "#{m[:fn]}" }
|
128
128
|
t.extent **{ type: 'part' } do |e|
|
129
129
|
e.referenceFrom "all"
|
130
130
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "isodoc", "~> 1.2.0"
|
32
32
|
spec.add_dependency "iev", "~> 0.2.1"
|
33
33
|
spec.add_dependency "metanorma-plugin-datastruct"
|
34
|
+
spec.add_dependency "metanorma-plugin-lutaml"
|
34
35
|
# relaton-cli not just relaton, to avoid circular reference in metanorma
|
35
36
|
spec.add_dependency "relaton-cli", "~> 1.5.0"
|
36
37
|
spec.add_dependency "relaton-iev", "~> 1.0.0"
|
@@ -0,0 +1,1498 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "relaton_iec"
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
RSpec.describe Asciidoctor::Standoc do
|
6
|
+
it "strips any initial boilerplate from terms and definitions" do
|
7
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
8
|
+
#{ASCIIDOC_BLANK_HDR}
|
9
|
+
== Terms and Definitions
|
10
|
+
|
11
|
+
I am boilerplate
|
12
|
+
|
13
|
+
* So am I
|
14
|
+
|
15
|
+
=== Time
|
16
|
+
|
17
|
+
This paragraph is extraneous
|
18
|
+
INPUT
|
19
|
+
#{BLANK_HDR}
|
20
|
+
<sections>
|
21
|
+
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
22
|
+
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
23
|
+
|
24
|
+
<term id="_">
|
25
|
+
<preferred>Time</preferred>
|
26
|
+
<definition><p id="_">This paragraph is extraneous</p></definition>
|
27
|
+
</term></terms>
|
28
|
+
</sections>
|
29
|
+
</standard-document>
|
30
|
+
OUTPUT
|
31
|
+
end
|
32
|
+
|
33
|
+
it "removes initial extraneous material from Normative References" do
|
34
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
35
|
+
#{ASCIIDOC_BLANK_HDR}
|
36
|
+
[bibliography]
|
37
|
+
== Normative References
|
38
|
+
|
39
|
+
This is extraneous information
|
40
|
+
|
41
|
+
* [[[iso216,ISO 216]]], _Reference_
|
42
|
+
|
43
|
+
This is also extraneous information
|
44
|
+
INPUT
|
45
|
+
#{BLANK_HDR}
|
46
|
+
<sections></sections>
|
47
|
+
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
|
48
|
+
#{NORM_REF_BOILERPLATE}
|
49
|
+
<bibitem id="iso216" type="standard">
|
50
|
+
<title format="text/plain">Reference</title>
|
51
|
+
<docidentifier>ISO 216</docidentifier>
|
52
|
+
<docnumber>216</docnumber>
|
53
|
+
<contributor>
|
54
|
+
<role type="publisher"/>
|
55
|
+
<organization>
|
56
|
+
<name>ISO</name>
|
57
|
+
</organization>
|
58
|
+
</contributor>
|
59
|
+
</bibitem>
|
60
|
+
<p id='_'>This is also extraneous information</p>
|
61
|
+
</references>
|
62
|
+
</bibliography>
|
63
|
+
</standard-document>
|
64
|
+
OUTPUT
|
65
|
+
end
|
66
|
+
|
67
|
+
it "sorts references with their notes in Bibliography" do
|
68
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
69
|
+
#{ASCIIDOC_BLANK_HDR}
|
70
|
+
[bibliography]
|
71
|
+
== Bibliography
|
72
|
+
|
73
|
+
This is extraneous information
|
74
|
+
|
75
|
+
* [[[iso216,ISO 216]]], _Reference_
|
76
|
+
|
77
|
+
NOTE: ABC
|
78
|
+
|
79
|
+
NOTE: DEF
|
80
|
+
|
81
|
+
This is further extraneous information
|
82
|
+
|
83
|
+
NOTE: GHI
|
84
|
+
|
85
|
+
* [[[iso216,ISO 215]]], _Reference_
|
86
|
+
|
87
|
+
NOTE: JKL
|
88
|
+
|
89
|
+
This is also extraneous information
|
90
|
+
INPUT
|
91
|
+
#{BLANK_HDR}
|
92
|
+
<sections> </sections>
|
93
|
+
<bibliography>
|
94
|
+
<references id='_' obligation='informative' normative="false">
|
95
|
+
<title>Bibliography</title>
|
96
|
+
<p id='_'>This is extraneous information</p>
|
97
|
+
<bibitem id='iso216' type='standard'>
|
98
|
+
<title format='text/plain'>Reference</title>
|
99
|
+
<docidentifier>ISO 216</docidentifier>
|
100
|
+
<docnumber>216</docnumber>
|
101
|
+
<contributor>
|
102
|
+
<role type='publisher'/>
|
103
|
+
<organization>
|
104
|
+
<name>ISO</name>
|
105
|
+
</organization>
|
106
|
+
</contributor>
|
107
|
+
</bibitem>
|
108
|
+
<note id='_'>
|
109
|
+
<p id='_'>ABC</p>
|
110
|
+
</note>
|
111
|
+
<note id='_'>
|
112
|
+
<p id='_'>DEF</p>
|
113
|
+
</note>
|
114
|
+
<bibitem id='iso216' type='standard'>
|
115
|
+
<title format='text/plain'>Reference</title>
|
116
|
+
<docidentifier>ISO 215</docidentifier>
|
117
|
+
<docnumber>215</docnumber>
|
118
|
+
<contributor>
|
119
|
+
<role type='publisher'/>
|
120
|
+
<organization>
|
121
|
+
<name>ISO</name>
|
122
|
+
</organization>
|
123
|
+
</contributor>
|
124
|
+
</bibitem>
|
125
|
+
<note id='_'>
|
126
|
+
<p id='_'>JKL</p>
|
127
|
+
</note>
|
128
|
+
<p id='_'>
|
129
|
+
This is further extraneous information
|
130
|
+
<note id='_'>
|
131
|
+
<p id='_'>GHI</p>
|
132
|
+
</note>
|
133
|
+
</p>
|
134
|
+
<p id='_'>This is also extraneous information</p>
|
135
|
+
</references>
|
136
|
+
</bibliography>
|
137
|
+
</standard-document>
|
138
|
+
OUTPUT
|
139
|
+
end
|
140
|
+
|
141
|
+
it "defaults section obligations" do
|
142
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
143
|
+
#{ASCIIDOC_BLANK_HDR}
|
144
|
+
|
145
|
+
== Clause
|
146
|
+
Text
|
147
|
+
|
148
|
+
[appendix]
|
149
|
+
== Clause
|
150
|
+
|
151
|
+
Text
|
152
|
+
INPUT
|
153
|
+
#{BLANK_HDR}
|
154
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
155
|
+
<title>Clause</title>
|
156
|
+
<p id="_">Text</p>
|
157
|
+
</clause>
|
158
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
159
|
+
<title>Clause</title>
|
160
|
+
<p id="_">Text</p>
|
161
|
+
</annex>
|
162
|
+
</standard-document>
|
163
|
+
OUTPUT
|
164
|
+
end
|
165
|
+
|
166
|
+
it "extends clause levels past 5" do
|
167
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
168
|
+
#{ASCIIDOC_BLANK_HDR}
|
169
|
+
|
170
|
+
== Clause1
|
171
|
+
|
172
|
+
=== Clause2
|
173
|
+
|
174
|
+
==== Clause3
|
175
|
+
|
176
|
+
===== Clause4
|
177
|
+
|
178
|
+
====== Clause 5
|
179
|
+
|
180
|
+
[level=6]
|
181
|
+
====== Clause 6
|
182
|
+
|
183
|
+
[level=7]
|
184
|
+
====== Clause 7A
|
185
|
+
|
186
|
+
[level=7]
|
187
|
+
====== Clause 7B
|
188
|
+
|
189
|
+
[level=6]
|
190
|
+
====== Clause 6B
|
191
|
+
|
192
|
+
====== Clause 5B
|
193
|
+
|
194
|
+
INPUT
|
195
|
+
#{BLANK_HDR}
|
196
|
+
<sections>
|
197
|
+
<clause id="_" inline-header="false" obligation="normative">
|
198
|
+
<title>Clause1</title>
|
199
|
+
<clause id="_" inline-header="false" obligation="normative">
|
200
|
+
<title>Clause2</title>
|
201
|
+
<clause id="_" inline-header="false" obligation="normative">
|
202
|
+
<title>Clause3</title>
|
203
|
+
<clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
|
204
|
+
<title>Clause 5</title>
|
205
|
+
<clause id="_" inline-header="false" obligation="normative">
|
206
|
+
<title>Clause 6</title>
|
207
|
+
<clause id="_" inline-header="false" obligation="normative">
|
208
|
+
<title>Clause 7A</title>
|
209
|
+
</clause><clause id="_" inline-header="false" obligation="normative">
|
210
|
+
<title>Clause 7B</title>
|
211
|
+
</clause></clause><clause id="_" inline-header="false" obligation="normative">
|
212
|
+
<title>Clause 6B</title>
|
213
|
+
</clause></clause>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<clause id="_" inline-header="false" obligation="normative">
|
219
|
+
<title>Clause 5B</title>
|
220
|
+
</clause></clause>
|
221
|
+
</clause>
|
222
|
+
</clause>
|
223
|
+
</clause>
|
224
|
+
</sections>
|
225
|
+
</standard-document>
|
226
|
+
OUTPUT
|
227
|
+
end
|
228
|
+
|
229
|
+
it "inserts boilerplate before empty Normative References" do
|
230
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
231
|
+
#{ASCIIDOC_BLANK_HDR}
|
232
|
+
|
233
|
+
[bibliography]
|
234
|
+
== Normative References
|
235
|
+
|
236
|
+
INPUT
|
237
|
+
#{BLANK_HDR}
|
238
|
+
<sections>
|
239
|
+
|
240
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
241
|
+
<title>Normative references</title><p id="_">There are no normative references in this document.</p>
|
242
|
+
</references></bibliography>
|
243
|
+
</standard-document>
|
244
|
+
OUTPUT
|
245
|
+
end
|
246
|
+
|
247
|
+
it "inserts boilerplate before non-empty Normative References" do
|
248
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
249
|
+
#{ASCIIDOC_BLANK_HDR}
|
250
|
+
|
251
|
+
[bibliography]
|
252
|
+
== Normative References
|
253
|
+
* [[[a,b]]] A
|
254
|
+
|
255
|
+
INPUT
|
256
|
+
#{BLANK_HDR}
|
257
|
+
<sections>
|
258
|
+
|
259
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
260
|
+
<title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
261
|
+
<bibitem id="a">
|
262
|
+
<formattedref format="application/x-isodoc+xml">A</formattedref>
|
263
|
+
<docidentifier>b</docidentifier>
|
264
|
+
</bibitem>
|
265
|
+
</references></bibliography>
|
266
|
+
</standard-document>
|
267
|
+
|
268
|
+
OUTPUT
|
269
|
+
end
|
270
|
+
|
271
|
+
it "inserts boilerplate before empty Normative References in French" do
|
272
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
273
|
+
= Document title
|
274
|
+
Author
|
275
|
+
:docfile: test.adoc
|
276
|
+
:nodoc:
|
277
|
+
:novalid:
|
278
|
+
:no-isobib:
|
279
|
+
:language: fr
|
280
|
+
|
281
|
+
[bibliography]
|
282
|
+
== Normative References
|
283
|
+
|
284
|
+
INPUT
|
285
|
+
#{BLANK_HDR.sub(/<language>en/, "<language>fr")}
|
286
|
+
<sections>
|
287
|
+
|
288
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
289
|
+
<title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
|
290
|
+
</references></bibliography>
|
291
|
+
</standard-document>
|
292
|
+
OUTPUT
|
293
|
+
end
|
294
|
+
|
295
|
+
it "processes section names, with footnotes" do
|
296
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
297
|
+
#{ASCIIDOC_BLANK_HDR}
|
298
|
+
.Foreword.footnote:[A]
|
299
|
+
|
300
|
+
Text
|
301
|
+
|
302
|
+
[abstract]
|
303
|
+
== Abstract.footnote:[A]
|
304
|
+
|
305
|
+
Text
|
306
|
+
|
307
|
+
[heading=introduction]
|
308
|
+
== Introduction.footnote:[A]
|
309
|
+
|
310
|
+
=== Introduction Subsection
|
311
|
+
|
312
|
+
[heading=acknowledgements]
|
313
|
+
== Acknowledgements.footnote:[A]
|
314
|
+
|
315
|
+
[.preface]
|
316
|
+
== Dedication
|
317
|
+
|
318
|
+
[heading=scope]
|
319
|
+
== Scope.footnote:[A]
|
320
|
+
|
321
|
+
Text
|
322
|
+
|
323
|
+
[bibliography,heading=normative references]
|
324
|
+
== Normative References.footnote:[A]
|
325
|
+
|
326
|
+
[bibliography,normative=true]
|
327
|
+
== Normative References 2.footnote:[A]
|
328
|
+
|
329
|
+
[heading=terms and definitions]
|
330
|
+
== Terms and Definitions.footnote:[A]
|
331
|
+
|
332
|
+
=== Term1
|
333
|
+
|
334
|
+
[heading="terms and definitions"]
|
335
|
+
== Terms, Definitions, Symbols and Abbreviated Terms.footnote:[A]
|
336
|
+
|
337
|
+
[.nonterm]
|
338
|
+
=== Introduction
|
339
|
+
|
340
|
+
==== Intro 1
|
341
|
+
|
342
|
+
=== Intro 2
|
343
|
+
|
344
|
+
[.nonterm]
|
345
|
+
==== Intro 3
|
346
|
+
|
347
|
+
=== Intro 4
|
348
|
+
|
349
|
+
==== Intro 5
|
350
|
+
|
351
|
+
===== Term1
|
352
|
+
|
353
|
+
=== Normal Terms
|
354
|
+
|
355
|
+
==== Term2
|
356
|
+
|
357
|
+
[heading=symbols and abbreviated terms]
|
358
|
+
=== Symbols and Abbreviated Terms.footnote:[A]
|
359
|
+
|
360
|
+
[.nonterm]
|
361
|
+
==== General
|
362
|
+
|
363
|
+
[heading=symbols]
|
364
|
+
==== Symbols 1.footnote:[A]
|
365
|
+
|
366
|
+
[heading=abbreviated terms]
|
367
|
+
== Abbreviated Terms.footnote:[A]
|
368
|
+
|
369
|
+
== Clause 4
|
370
|
+
|
371
|
+
=== Introduction
|
372
|
+
|
373
|
+
=== Clause 4.2
|
374
|
+
|
375
|
+
== Terms and Definitions
|
376
|
+
|
377
|
+
[appendix]
|
378
|
+
== Annex.footnote:[A]
|
379
|
+
|
380
|
+
=== Annex A.1
|
381
|
+
|
382
|
+
[bibliography,heading=bibliography]
|
383
|
+
== Bibliography.footnote:[A]
|
384
|
+
|
385
|
+
[bibliography,normative=false]
|
386
|
+
== Bibliography 2.footnote:[A]
|
387
|
+
|
388
|
+
=== Bibliography Subsection
|
389
|
+
|
390
|
+
INPUT
|
391
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
392
|
+
<bibdata type='standard'>
|
393
|
+
<title language='en' format='text/plain'>Document title</title>
|
394
|
+
<language>en</language>
|
395
|
+
<script>Latn</script>
|
396
|
+
<abstract>
|
397
|
+
<p>Text</p>
|
398
|
+
</abstract>
|
399
|
+
<status>
|
400
|
+
<stage>published</stage>
|
401
|
+
</status>
|
402
|
+
<copyright>
|
403
|
+
<from>2020</from>
|
404
|
+
</copyright>
|
405
|
+
<ext>
|
406
|
+
<doctype>article</doctype>
|
407
|
+
</ext>
|
408
|
+
</bibdata>
|
409
|
+
<preface>
|
410
|
+
<abstract id='_'>
|
411
|
+
<title>Abstract</title>
|
412
|
+
<p id='_'>Text</p>
|
413
|
+
</abstract>
|
414
|
+
<foreword id='_' obligation='informative'>
|
415
|
+
<title>
|
416
|
+
Foreword
|
417
|
+
<fn reference='1'>
|
418
|
+
<p id='_'>A</p>
|
419
|
+
</fn>
|
420
|
+
</title>
|
421
|
+
<p id='_'>Text</p>
|
422
|
+
</foreword>
|
423
|
+
<introduction id='_' obligation='informative'>
|
424
|
+
<title>Introduction</title>
|
425
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
426
|
+
<title>Introduction Subsection</title>
|
427
|
+
</clause>
|
428
|
+
</introduction>
|
429
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
430
|
+
<title>Dedication</title>
|
431
|
+
</clause>
|
432
|
+
<acknowledgements id='_' obligation='informative'>
|
433
|
+
<title>
|
434
|
+
Acknowledgements
|
435
|
+
<fn reference='1'>
|
436
|
+
<p id='_'>A</p>
|
437
|
+
</fn>
|
438
|
+
</title>
|
439
|
+
</acknowledgements>
|
440
|
+
</preface>
|
441
|
+
<sections>
|
442
|
+
<clause id='_' type='scope' inline-header='false' obligation='normative'>
|
443
|
+
<title>
|
444
|
+
Scope
|
445
|
+
<fn reference='1'>
|
446
|
+
<p id='_'>A</p>
|
447
|
+
</fn>
|
448
|
+
</title>
|
449
|
+
<p id='_'>Text</p>
|
450
|
+
</clause>
|
451
|
+
<terms id='_' obligation='normative'>
|
452
|
+
<title>
|
453
|
+
Terms and definitions
|
454
|
+
<fn reference='1'>
|
455
|
+
<p id='_'>A</p>
|
456
|
+
</fn>
|
457
|
+
</title>
|
458
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
459
|
+
<term id='_'>
|
460
|
+
<preferred>Term1</preferred>
|
461
|
+
</term>
|
462
|
+
</terms>
|
463
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
464
|
+
<title>
|
465
|
+
Terms, Definitions, Symbols and Abbreviated Terms.
|
466
|
+
<fn reference='1'>
|
467
|
+
<p id='_'>A</p>
|
468
|
+
</fn>
|
469
|
+
</title>
|
470
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
471
|
+
<title>Introduction</title>
|
472
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
473
|
+
<title>Intro 1</title>
|
474
|
+
</clause>
|
475
|
+
</clause>
|
476
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
477
|
+
<title>Intro 2</title>
|
478
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
479
|
+
<title>Intro 3</title>
|
480
|
+
</clause>
|
481
|
+
</clause>
|
482
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
483
|
+
<title>Intro 4</title>
|
484
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
485
|
+
<title>Intro 5</title>
|
486
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
487
|
+
<title>Term1</title>
|
488
|
+
</clause>
|
489
|
+
</clause>
|
490
|
+
</clause>
|
491
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
492
|
+
<title>Normal Terms</title>
|
493
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
494
|
+
<title>Term2</title>
|
495
|
+
</clause>
|
496
|
+
</clause>
|
497
|
+
<definitions id='_' obligation='normative'>
|
498
|
+
<title>
|
499
|
+
Symbols and abbreviated terms
|
500
|
+
<fn reference='1'>
|
501
|
+
<p id='_'>A</p>
|
502
|
+
</fn>
|
503
|
+
</title>
|
504
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
505
|
+
<title>General</title>
|
506
|
+
</clause>
|
507
|
+
<definitions id='_' type='symbols' obligation='normative'>
|
508
|
+
<title>
|
509
|
+
Symbols
|
510
|
+
<fn reference='1'>
|
511
|
+
<p id='_'>A</p>
|
512
|
+
</fn>
|
513
|
+
</title>
|
514
|
+
</definitions>
|
515
|
+
</definitions>
|
516
|
+
</clause>
|
517
|
+
<definitions id='_' type='abbreviated_terms' obligation='normative'>
|
518
|
+
<title>
|
519
|
+
Abbreviated terms
|
520
|
+
<fn reference='1'>
|
521
|
+
<p id='_'>A</p>
|
522
|
+
</fn>
|
523
|
+
</title>
|
524
|
+
</definitions>
|
525
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
526
|
+
<title>Clause 4</title>
|
527
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
528
|
+
<title>Introduction</title>
|
529
|
+
</clause>
|
530
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
531
|
+
<title>Clause 4.2</title>
|
532
|
+
</clause>
|
533
|
+
</clause>
|
534
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
535
|
+
<title>Terms and Definitions</title>
|
536
|
+
</clause>
|
537
|
+
</sections>
|
538
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
539
|
+
<title>
|
540
|
+
Annex.
|
541
|
+
<fn reference='1'>
|
542
|
+
<p id='_'>A</p>
|
543
|
+
</fn>
|
544
|
+
</title>
|
545
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
546
|
+
<title>Annex A.1</title>
|
547
|
+
</clause>
|
548
|
+
</annex>
|
549
|
+
<bibliography>
|
550
|
+
<references id='_' normative='true' obligation='informative'>
|
551
|
+
<title>Normative references</title>
|
552
|
+
<p id='_'>There are no normative references in this document.</p>
|
553
|
+
</references>
|
554
|
+
<references id='_' normative='false' obligation='informative'>
|
555
|
+
<title>Bibliography</title>
|
556
|
+
</references>
|
557
|
+
<references id='_' normative='false' obligation='informative'>
|
558
|
+
<title>Bibliography</title>
|
559
|
+
</references>
|
560
|
+
<clause id='_' obligation='informative'>
|
561
|
+
<title>Bibliography</title>
|
562
|
+
<references id='_' normative='false' obligation='informative'>
|
563
|
+
<title>Bibliography Subsection</title>
|
564
|
+
</references>
|
565
|
+
</clause>
|
566
|
+
</bibliography>
|
567
|
+
</standard-document>
|
568
|
+
OUTPUT
|
569
|
+
end
|
570
|
+
|
571
|
+
it "processes section names, default to English" do
|
572
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
573
|
+
#{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
|
574
|
+
.Foreword
|
575
|
+
|
576
|
+
Text
|
577
|
+
|
578
|
+
[abstract]
|
579
|
+
== Abstract
|
580
|
+
|
581
|
+
Text
|
582
|
+
|
583
|
+
[heading=introduction]
|
584
|
+
== Introduction
|
585
|
+
|
586
|
+
=== Introduction Subsection
|
587
|
+
|
588
|
+
[heading=acknowledgements]
|
589
|
+
== Acknowledgements
|
590
|
+
|
591
|
+
[.preface]
|
592
|
+
== Dedication
|
593
|
+
|
594
|
+
[heading=scope]
|
595
|
+
== Scope
|
596
|
+
|
597
|
+
Text
|
598
|
+
|
599
|
+
[bibliography,heading=normative references]
|
600
|
+
== Normative References
|
601
|
+
|
602
|
+
[bibliography,normative=true]
|
603
|
+
== Normative References 2
|
604
|
+
|
605
|
+
[heading=terms and definitions]
|
606
|
+
== Terms and Definitions
|
607
|
+
|
608
|
+
=== Term1
|
609
|
+
|
610
|
+
[heading="terms and definitions"]
|
611
|
+
== Terms, Definitions, Symbols and Abbreviated Terms
|
612
|
+
|
613
|
+
[.nonterm]
|
614
|
+
=== Introduction
|
615
|
+
|
616
|
+
==== Intro 1
|
617
|
+
|
618
|
+
=== Intro 2
|
619
|
+
|
620
|
+
[.nonterm]
|
621
|
+
==== Intro 3
|
622
|
+
|
623
|
+
=== Intro 4
|
624
|
+
|
625
|
+
==== Intro 5
|
626
|
+
|
627
|
+
===== Term1
|
628
|
+
|
629
|
+
=== Normal Terms
|
630
|
+
|
631
|
+
==== Term2
|
632
|
+
|
633
|
+
[heading=symbols and abbreviated terms]
|
634
|
+
=== Symbols and Abbreviated Terms
|
635
|
+
|
636
|
+
[.nonterm]
|
637
|
+
==== General
|
638
|
+
|
639
|
+
[heading=symbols]
|
640
|
+
==== Symbols 1
|
641
|
+
|
642
|
+
[heading=abbreviated terms]
|
643
|
+
== Abbreviated Terms
|
644
|
+
|
645
|
+
== Clause 4
|
646
|
+
|
647
|
+
=== Introduction
|
648
|
+
|
649
|
+
=== Clause 4.2
|
650
|
+
|
651
|
+
== Terms and Definitions
|
652
|
+
|
653
|
+
[appendix]
|
654
|
+
== Annex
|
655
|
+
|
656
|
+
=== Annex A.1
|
657
|
+
|
658
|
+
[bibliography,heading=bibliography]
|
659
|
+
== Bibliography
|
660
|
+
|
661
|
+
[bibliography,normative=false]
|
662
|
+
== Bibliography 2
|
663
|
+
|
664
|
+
=== Bibliography Subsection
|
665
|
+
|
666
|
+
INPUT
|
667
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
668
|
+
<bibdata type='standard'>
|
669
|
+
<title language='en' format='text/plain'>Document title</title>
|
670
|
+
<language>tlh</language>
|
671
|
+
<script>Latn</script>
|
672
|
+
<abstract>
|
673
|
+
<p>Text</p>
|
674
|
+
</abstract>
|
675
|
+
<status>
|
676
|
+
<stage>published</stage>
|
677
|
+
</status>
|
678
|
+
<copyright>
|
679
|
+
<from>2020</from>
|
680
|
+
</copyright>
|
681
|
+
<ext>
|
682
|
+
<doctype>article</doctype>
|
683
|
+
</ext>
|
684
|
+
</bibdata>
|
685
|
+
<preface>
|
686
|
+
<abstract id='_'>
|
687
|
+
<title>Abstract</title>
|
688
|
+
<p id='_'>Text</p>
|
689
|
+
</abstract>
|
690
|
+
<foreword id='_' obligation='informative'>
|
691
|
+
<title>Foreword</title>
|
692
|
+
<p id='_'>Text</p>
|
693
|
+
</foreword>
|
694
|
+
<introduction id='_' obligation='informative'>
|
695
|
+
<title>Introduction</title>
|
696
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
697
|
+
<title>Introduction Subsection</title>
|
698
|
+
</clause>
|
699
|
+
</introduction>
|
700
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
701
|
+
<title>Dedication</title>
|
702
|
+
</clause>
|
703
|
+
<acknowledgements id='_' obligation='informative'>
|
704
|
+
<title>Acknowledgements</title>
|
705
|
+
</acknowledgements>
|
706
|
+
</preface>
|
707
|
+
<sections>
|
708
|
+
<clause id='_' type='scope' inline-header='false' obligation='normative'>
|
709
|
+
<title>Scope</title>
|
710
|
+
<p id='_'>Text</p>
|
711
|
+
</clause>
|
712
|
+
<terms id='_' obligation='normative'>
|
713
|
+
<title>Terms and definitions</title>
|
714
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
715
|
+
<term id='_'>
|
716
|
+
<preferred>Term1</preferred>
|
717
|
+
</term>
|
718
|
+
</terms>
|
719
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
720
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
721
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
722
|
+
<title>Introduction</title>
|
723
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
724
|
+
<title>Intro 1</title>
|
725
|
+
</clause>
|
726
|
+
</clause>
|
727
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
728
|
+
<title>Intro 2</title>
|
729
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
730
|
+
<title>Intro 3</title>
|
731
|
+
</clause>
|
732
|
+
</clause>
|
733
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
734
|
+
<title>Intro 4</title>
|
735
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
736
|
+
<title>Intro 5</title>
|
737
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
738
|
+
<title>Term1</title>
|
739
|
+
</clause>
|
740
|
+
</clause>
|
741
|
+
</clause>
|
742
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
743
|
+
<title>Normal Terms</title>
|
744
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
745
|
+
<title>Term2</title>
|
746
|
+
</clause>
|
747
|
+
</clause>
|
748
|
+
<definitions id='_' obligation='normative'>
|
749
|
+
<title>Symbols and abbreviated terms</title>
|
750
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
751
|
+
<title>General</title>
|
752
|
+
</clause>
|
753
|
+
<definitions id='_' type='symbols' obligation='normative'>
|
754
|
+
<title>Symbols</title>
|
755
|
+
</definitions>
|
756
|
+
</definitions>
|
757
|
+
</clause>
|
758
|
+
<definitions id='_' type='abbreviated_terms' obligation='normative'>
|
759
|
+
<title>Abbreviated terms</title>
|
760
|
+
</definitions>
|
761
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
762
|
+
<title>Clause 4</title>
|
763
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
764
|
+
<title>Introduction</title>
|
765
|
+
</clause>
|
766
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
767
|
+
<title>Clause 4.2</title>
|
768
|
+
</clause>
|
769
|
+
</clause>
|
770
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
771
|
+
<title>Terms and Definitions</title>
|
772
|
+
</clause>
|
773
|
+
</sections>
|
774
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
775
|
+
<title>Annex</title>
|
776
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
777
|
+
<title>Annex A.1</title>
|
778
|
+
</clause>
|
779
|
+
</annex>
|
780
|
+
<bibliography>
|
781
|
+
<references id='_' normative='true' obligation='informative'>
|
782
|
+
<title>Normative references</title>
|
783
|
+
<p id='_'>There are no normative references in this document.</p>
|
784
|
+
</references>
|
785
|
+
<references id='_' normative='false' obligation='informative'>
|
786
|
+
<title>Bibliography</title>
|
787
|
+
</references>
|
788
|
+
<references id='_' normative='false' obligation='informative'>
|
789
|
+
<title>Bibliography</title>
|
790
|
+
</references>
|
791
|
+
<clause id='_' obligation='informative'>
|
792
|
+
<title>Bibliography</title>
|
793
|
+
<references id='_' normative='false' obligation='informative'>
|
794
|
+
<title>Bibliography Subsection</title>
|
795
|
+
</references>
|
796
|
+
</clause>
|
797
|
+
</bibliography>
|
798
|
+
</standard-document>
|
799
|
+
OUTPUT
|
800
|
+
end
|
801
|
+
|
802
|
+
it "processes section names, French" do
|
803
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
804
|
+
#{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
|
805
|
+
.Foreword
|
806
|
+
|
807
|
+
Text
|
808
|
+
|
809
|
+
[abstract]
|
810
|
+
== Abstract
|
811
|
+
|
812
|
+
Text
|
813
|
+
|
814
|
+
[heading=introduction]
|
815
|
+
== Introduction
|
816
|
+
|
817
|
+
=== Introduction Subsection
|
818
|
+
|
819
|
+
[heading=acknowledgements]
|
820
|
+
== Acknowledgements
|
821
|
+
|
822
|
+
[.preface]
|
823
|
+
== Dedication
|
824
|
+
|
825
|
+
[heading=scope]
|
826
|
+
== Scope
|
827
|
+
|
828
|
+
Text
|
829
|
+
|
830
|
+
[bibliography,heading=normative references]
|
831
|
+
== Normative References
|
832
|
+
|
833
|
+
[bibliography,normative=true]
|
834
|
+
== Normative References 2
|
835
|
+
|
836
|
+
[heading=terms and definitions]
|
837
|
+
== Terms and Definitions
|
838
|
+
|
839
|
+
=== Term1
|
840
|
+
|
841
|
+
[heading="terms and definitions"]
|
842
|
+
== Terms, Definitions, Symbols and Abbreviated Terms
|
843
|
+
|
844
|
+
[.nonterm]
|
845
|
+
=== Introduction
|
846
|
+
|
847
|
+
==== Intro 1
|
848
|
+
|
849
|
+
=== Intro 2
|
850
|
+
|
851
|
+
[.nonterm]
|
852
|
+
==== Intro 3
|
853
|
+
|
854
|
+
=== Intro 4
|
855
|
+
|
856
|
+
==== Intro 5
|
857
|
+
|
858
|
+
===== Term1
|
859
|
+
|
860
|
+
=== Normal Terms
|
861
|
+
|
862
|
+
==== Term2
|
863
|
+
|
864
|
+
[heading=symbols and abbreviated terms]
|
865
|
+
=== Symbols and Abbreviated Terms
|
866
|
+
|
867
|
+
[.nonterm]
|
868
|
+
==== General
|
869
|
+
|
870
|
+
[heading=symbols]
|
871
|
+
==== Symbols 1
|
872
|
+
|
873
|
+
[heading=abbreviated terms]
|
874
|
+
== Abbreviated Terms
|
875
|
+
|
876
|
+
== Clause 4
|
877
|
+
|
878
|
+
=== Introduction
|
879
|
+
|
880
|
+
=== Clause 4.2
|
881
|
+
|
882
|
+
== Terms and Definitions
|
883
|
+
|
884
|
+
[appendix]
|
885
|
+
== Annex
|
886
|
+
|
887
|
+
=== Annex A.1
|
888
|
+
|
889
|
+
[bibliography,heading=bibliography]
|
890
|
+
== Bibliography
|
891
|
+
|
892
|
+
[bibliography,normative=false]
|
893
|
+
== Bibliography 2
|
894
|
+
|
895
|
+
=== Bibliography Subsection
|
896
|
+
|
897
|
+
INPUT
|
898
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
899
|
+
<bibdata type='standard'>
|
900
|
+
<title language='en' format='text/plain'>Document title</title>
|
901
|
+
<language>fr</language>
|
902
|
+
<script>Latn</script>
|
903
|
+
<abstract>
|
904
|
+
<p>Text</p>
|
905
|
+
</abstract>
|
906
|
+
<status>
|
907
|
+
<stage>published</stage>
|
908
|
+
</status>
|
909
|
+
<copyright>
|
910
|
+
<from>2020</from>
|
911
|
+
</copyright>
|
912
|
+
<ext>
|
913
|
+
<doctype>article</doctype>
|
914
|
+
</ext>
|
915
|
+
</bibdata>
|
916
|
+
<preface>
|
917
|
+
<abstract id='_'>
|
918
|
+
<title>Résumé</title>
|
919
|
+
<p id='_'>Text</p>
|
920
|
+
</abstract>
|
921
|
+
<foreword id='_' obligation='informative'>
|
922
|
+
<title>Avant-propos</title>
|
923
|
+
<p id='_'>Text</p>
|
924
|
+
</foreword>
|
925
|
+
<introduction id='_' obligation='informative'>
|
926
|
+
<title>Introduction</title>
|
927
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
928
|
+
<title>Introduction Subsection</title>
|
929
|
+
</clause>
|
930
|
+
</introduction>
|
931
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
932
|
+
<title>Dedication</title>
|
933
|
+
</clause>
|
934
|
+
<acknowledgements id='_' obligation='informative'>
|
935
|
+
<title>Remerciements</title>
|
936
|
+
</acknowledgements>
|
937
|
+
</preface>
|
938
|
+
<sections>
|
939
|
+
<clause id='_' type='scope' inline-header='false' obligation='normative'>
|
940
|
+
<title>Domaine d’application</title>
|
941
|
+
<p id='_'>Text</p>
|
942
|
+
</clause>
|
943
|
+
<terms id='_' obligation='normative'>
|
944
|
+
<title>Terms et définitions</title>
|
945
|
+
<p id='_'>
|
946
|
+
Pour les besoins du présent document, les termes et définitions suivants
|
947
|
+
s’appliquent.
|
948
|
+
</p>
|
949
|
+
<term id='_'>
|
950
|
+
<preferred>Term1</preferred>
|
951
|
+
</term>
|
952
|
+
</terms>
|
953
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
954
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
955
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
956
|
+
<title>Introduction</title>
|
957
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
958
|
+
<title>Intro 1</title>
|
959
|
+
</clause>
|
960
|
+
</clause>
|
961
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
962
|
+
<title>Intro 2</title>
|
963
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
964
|
+
<title>Intro 3</title>
|
965
|
+
</clause>
|
966
|
+
</clause>
|
967
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
968
|
+
<title>Intro 4</title>
|
969
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
970
|
+
<title>Intro 5</title>
|
971
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
972
|
+
<title>Term1</title>
|
973
|
+
</clause>
|
974
|
+
</clause>
|
975
|
+
</clause>
|
976
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
977
|
+
<title>Normal Terms</title>
|
978
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
979
|
+
<title>Term2</title>
|
980
|
+
</clause>
|
981
|
+
</clause>
|
982
|
+
<definitions id='_' obligation='normative'>
|
983
|
+
<title>Symboles et termes abrégés</title>
|
984
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
985
|
+
<title>General</title>
|
986
|
+
</clause>
|
987
|
+
<definitions id='_' type='symbols' obligation='normative'>
|
988
|
+
<title>Symboles</title>
|
989
|
+
</definitions>
|
990
|
+
</definitions>
|
991
|
+
</clause>
|
992
|
+
<definitions id='_' type='abbreviated_terms' obligation='normative'>
|
993
|
+
<title>Termes abrégés</title>
|
994
|
+
</definitions>
|
995
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
996
|
+
<title>Clause 4</title>
|
997
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
998
|
+
<title>Introduction</title>
|
999
|
+
</clause>
|
1000
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1001
|
+
<title>Clause 4.2</title>
|
1002
|
+
</clause>
|
1003
|
+
</clause>
|
1004
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1005
|
+
<title>Terms and Definitions</title>
|
1006
|
+
</clause>
|
1007
|
+
</sections>
|
1008
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
1009
|
+
<title>Annex</title>
|
1010
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1011
|
+
<title>Annex A.1</title>
|
1012
|
+
</clause>
|
1013
|
+
</annex>
|
1014
|
+
<bibliography>
|
1015
|
+
<references id='_' normative='true' obligation='informative'>
|
1016
|
+
<title>Références normatives</title>
|
1017
|
+
<p id='_'>Le présent document ne contient aucune référence normative.</p>
|
1018
|
+
</references>
|
1019
|
+
<references id='_' normative='false' obligation='informative'>
|
1020
|
+
<title>Bibliographie</title>
|
1021
|
+
</references>
|
1022
|
+
<references id='_' normative='false' obligation='informative'>
|
1023
|
+
<title>Bibliography</title>
|
1024
|
+
</references>
|
1025
|
+
<clause id='_' obligation='informative'>
|
1026
|
+
<title>Bibliography</title>
|
1027
|
+
<references id='_' normative='false' obligation='informative'>
|
1028
|
+
<title>Bibliography Subsection</title>
|
1029
|
+
</references>
|
1030
|
+
</clause>
|
1031
|
+
</bibliography>
|
1032
|
+
</standard-document>
|
1033
|
+
OUTPUT
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
it "processes section names, Simplified Chinese" do
|
1037
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1038
|
+
#{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
|
1039
|
+
.Foreword
|
1040
|
+
|
1041
|
+
Text
|
1042
|
+
|
1043
|
+
[abstract]
|
1044
|
+
== Abstract
|
1045
|
+
|
1046
|
+
Text
|
1047
|
+
|
1048
|
+
[heading=introduction]
|
1049
|
+
== Introduction
|
1050
|
+
|
1051
|
+
=== Introduction Subsection
|
1052
|
+
|
1053
|
+
[heading=acknowledgements]
|
1054
|
+
== Acknowledgements
|
1055
|
+
|
1056
|
+
[.preface]
|
1057
|
+
== Dedication
|
1058
|
+
|
1059
|
+
[heading=scope]
|
1060
|
+
== Scope
|
1061
|
+
|
1062
|
+
Text
|
1063
|
+
|
1064
|
+
[bibliography,heading=normative references]
|
1065
|
+
== Normative References
|
1066
|
+
|
1067
|
+
[bibliography,normative=true]
|
1068
|
+
== Normative References 2
|
1069
|
+
|
1070
|
+
[heading=terms and definitions]
|
1071
|
+
== Terms and Definitions
|
1072
|
+
|
1073
|
+
=== Term1
|
1074
|
+
|
1075
|
+
[heading="terms and definitions"]
|
1076
|
+
== Terms, Definitions, Symbols and Abbreviated Terms
|
1077
|
+
|
1078
|
+
[.nonterm]
|
1079
|
+
=== Introduction
|
1080
|
+
|
1081
|
+
==== Intro 1
|
1082
|
+
|
1083
|
+
=== Intro 2
|
1084
|
+
|
1085
|
+
[.nonterm]
|
1086
|
+
==== Intro 3
|
1087
|
+
|
1088
|
+
=== Intro 4
|
1089
|
+
|
1090
|
+
==== Intro 5
|
1091
|
+
|
1092
|
+
===== Term1
|
1093
|
+
|
1094
|
+
=== Normal Terms
|
1095
|
+
|
1096
|
+
==== Term2
|
1097
|
+
|
1098
|
+
[heading=symbols and abbreviated terms]
|
1099
|
+
=== Symbols and Abbreviated Terms
|
1100
|
+
|
1101
|
+
[.nonterm]
|
1102
|
+
==== General
|
1103
|
+
|
1104
|
+
[heading=symbols]
|
1105
|
+
==== Symbols 1
|
1106
|
+
|
1107
|
+
[heading=abbreviated terms]
|
1108
|
+
== Abbreviated Terms
|
1109
|
+
|
1110
|
+
== Clause 4
|
1111
|
+
|
1112
|
+
=== Introduction
|
1113
|
+
|
1114
|
+
=== Clause 4.2
|
1115
|
+
|
1116
|
+
== Terms and Definitions
|
1117
|
+
|
1118
|
+
[appendix]
|
1119
|
+
== Annex
|
1120
|
+
|
1121
|
+
=== Annex A.1
|
1122
|
+
|
1123
|
+
[bibliography,heading=bibliography]
|
1124
|
+
== Bibliography
|
1125
|
+
|
1126
|
+
[bibliography,normative=false]
|
1127
|
+
== Bibliography 2
|
1128
|
+
|
1129
|
+
=== Bibliography Subsection
|
1130
|
+
|
1131
|
+
INPUT
|
1132
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
1133
|
+
<bibdata type='standard'>
|
1134
|
+
<title language='en' format='text/plain'>Document title</title>
|
1135
|
+
<language>zh</language>
|
1136
|
+
<script>Hans</script>
|
1137
|
+
<abstract>
|
1138
|
+
<p>Text</p>
|
1139
|
+
</abstract>
|
1140
|
+
<status>
|
1141
|
+
<stage>published</stage>
|
1142
|
+
</status>
|
1143
|
+
<copyright>
|
1144
|
+
<from>2020</from>
|
1145
|
+
</copyright>
|
1146
|
+
<ext>
|
1147
|
+
<doctype>article</doctype>
|
1148
|
+
</ext>
|
1149
|
+
</bibdata>
|
1150
|
+
<preface>
|
1151
|
+
<abstract id='_'>
|
1152
|
+
<title>摘要</title>
|
1153
|
+
<p id='_'>Text</p>
|
1154
|
+
</abstract>
|
1155
|
+
<foreword id='_' obligation='informative'>
|
1156
|
+
<title>前言</title>
|
1157
|
+
<p id='_'>Text</p>
|
1158
|
+
</foreword>
|
1159
|
+
<introduction id='_' obligation='informative'>
|
1160
|
+
<title>引言</title>
|
1161
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
1162
|
+
<title>Introduction Subsection</title>
|
1163
|
+
</clause>
|
1164
|
+
</introduction>
|
1165
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
1166
|
+
<title>Dedication</title>
|
1167
|
+
</clause>
|
1168
|
+
<acknowledgements id='_' obligation='informative'>
|
1169
|
+
<title>致謝</title>
|
1170
|
+
</acknowledgements>
|
1171
|
+
</preface>
|
1172
|
+
<sections>
|
1173
|
+
<clause id='_' type='scope' inline-header='false' obligation='normative'>
|
1174
|
+
<title>范围</title>
|
1175
|
+
<p id='_'>Text</p>
|
1176
|
+
</clause>
|
1177
|
+
<terms id='_' obligation='normative'>
|
1178
|
+
<title>术语和定义</title>
|
1179
|
+
<p id='_'>下列术语和定义适用于本文件。</p>
|
1180
|
+
<term id='_'>
|
1181
|
+
<preferred>Term1</preferred>
|
1182
|
+
</term>
|
1183
|
+
</terms>
|
1184
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1185
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
1186
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1187
|
+
<title>Introduction</title>
|
1188
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1189
|
+
<title>Intro 1</title>
|
1190
|
+
</clause>
|
1191
|
+
</clause>
|
1192
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1193
|
+
<title>Intro 2</title>
|
1194
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1195
|
+
<title>Intro 3</title>
|
1196
|
+
</clause>
|
1197
|
+
</clause>
|
1198
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1199
|
+
<title>Intro 4</title>
|
1200
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1201
|
+
<title>Intro 5</title>
|
1202
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1203
|
+
<title>Term1</title>
|
1204
|
+
</clause>
|
1205
|
+
</clause>
|
1206
|
+
</clause>
|
1207
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1208
|
+
<title>Normal Terms</title>
|
1209
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1210
|
+
<title>Term2</title>
|
1211
|
+
</clause>
|
1212
|
+
</clause>
|
1213
|
+
<definitions id='_' obligation='normative'>
|
1214
|
+
<title>符号、代号和缩略语</title>
|
1215
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1216
|
+
<title>General</title>
|
1217
|
+
</clause>
|
1218
|
+
<definitions id='_' type='symbols' obligation='normative'>
|
1219
|
+
<title>符号</title>
|
1220
|
+
</definitions>
|
1221
|
+
</definitions>
|
1222
|
+
</clause>
|
1223
|
+
<definitions id='_' type='abbreviated_terms' obligation='normative'>
|
1224
|
+
<title>代号和缩略语</title>
|
1225
|
+
</definitions>
|
1226
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1227
|
+
<title>Clause 4</title>
|
1228
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1229
|
+
<title>Introduction</title>
|
1230
|
+
</clause>
|
1231
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1232
|
+
<title>Clause 4.2</title>
|
1233
|
+
</clause>
|
1234
|
+
</clause>
|
1235
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1236
|
+
<title>Terms and Definitions</title>
|
1237
|
+
</clause>
|
1238
|
+
</sections>
|
1239
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
1240
|
+
<title>Annex</title>
|
1241
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1242
|
+
<title>Annex A.1</title>
|
1243
|
+
</clause>
|
1244
|
+
</annex>
|
1245
|
+
<bibliography>
|
1246
|
+
<references id='_' normative='true' obligation='informative'>
|
1247
|
+
<title>规范性引用文件</title>
|
1248
|
+
<p id='_'>本文件并没有规范性引用文件。</p>
|
1249
|
+
</references>
|
1250
|
+
<references id='_' normative='false' obligation='informative'>
|
1251
|
+
<title>参考文献</title>
|
1252
|
+
</references>
|
1253
|
+
<references id='_' normative='false' obligation='informative'>
|
1254
|
+
<title>Bibliography</title>
|
1255
|
+
</references>
|
1256
|
+
<clause id='_' obligation='informative'>
|
1257
|
+
<title>Bibliography</title>
|
1258
|
+
<references id='_' normative='false' obligation='informative'>
|
1259
|
+
<title>Bibliography Subsection</title>
|
1260
|
+
</references>
|
1261
|
+
</clause>
|
1262
|
+
</bibliography>
|
1263
|
+
</standard-document>
|
1264
|
+
OUTPUT
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
it "processes section names, internationalisation file" do
|
1268
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1269
|
+
#{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
|
1270
|
+
.Foreword
|
1271
|
+
|
1272
|
+
Text
|
1273
|
+
|
1274
|
+
[abstract]
|
1275
|
+
== Abstract
|
1276
|
+
|
1277
|
+
Text
|
1278
|
+
|
1279
|
+
[heading=introduction]
|
1280
|
+
== Introduction
|
1281
|
+
|
1282
|
+
=== Introduction Subsection
|
1283
|
+
|
1284
|
+
[heading=acknowledgements]
|
1285
|
+
== Acknowledgements
|
1286
|
+
|
1287
|
+
[.preface]
|
1288
|
+
== Dedication
|
1289
|
+
|
1290
|
+
[heading=scope]
|
1291
|
+
== Scope
|
1292
|
+
|
1293
|
+
Text
|
1294
|
+
|
1295
|
+
[bibliography,heading=normative references]
|
1296
|
+
== Normative References
|
1297
|
+
|
1298
|
+
[bibliography,normative=true]
|
1299
|
+
== Normative References 2
|
1300
|
+
|
1301
|
+
[heading=terms and definitions]
|
1302
|
+
== Terms and Definitions
|
1303
|
+
|
1304
|
+
=== Term1
|
1305
|
+
|
1306
|
+
[heading="terms and definitions"]
|
1307
|
+
== Terms, Definitions, Symbols and Abbreviated Terms
|
1308
|
+
|
1309
|
+
[.nonterm]
|
1310
|
+
=== Introduction
|
1311
|
+
|
1312
|
+
==== Intro 1
|
1313
|
+
|
1314
|
+
=== Intro 2
|
1315
|
+
|
1316
|
+
[.nonterm]
|
1317
|
+
==== Intro 3
|
1318
|
+
|
1319
|
+
=== Intro 4
|
1320
|
+
|
1321
|
+
==== Intro 5
|
1322
|
+
|
1323
|
+
===== Term1
|
1324
|
+
|
1325
|
+
=== Normal Terms
|
1326
|
+
|
1327
|
+
==== Term2
|
1328
|
+
|
1329
|
+
[heading=symbols and abbreviated terms]
|
1330
|
+
=== Symbols and Abbreviated Terms
|
1331
|
+
|
1332
|
+
[.nonterm]
|
1333
|
+
==== General
|
1334
|
+
|
1335
|
+
[heading=symbols]
|
1336
|
+
==== Symbols 1
|
1337
|
+
|
1338
|
+
[heading=abbreviated terms]
|
1339
|
+
== Abbreviated Terms
|
1340
|
+
|
1341
|
+
== Clause 4
|
1342
|
+
|
1343
|
+
=== Introduction
|
1344
|
+
|
1345
|
+
=== Clause 4.2
|
1346
|
+
|
1347
|
+
== Terms and Definitions
|
1348
|
+
|
1349
|
+
[appendix]
|
1350
|
+
== Annex
|
1351
|
+
|
1352
|
+
=== Annex A.1
|
1353
|
+
|
1354
|
+
[bibliography,heading=bibliography]
|
1355
|
+
== Bibliography
|
1356
|
+
|
1357
|
+
[bibliography,normative=false]
|
1358
|
+
== Bibliography 2
|
1359
|
+
|
1360
|
+
=== Bibliography Subsection
|
1361
|
+
|
1362
|
+
INPUT
|
1363
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
1364
|
+
<bibdata type='standard'>
|
1365
|
+
<title language='en' format='text/plain'>Document title</title>
|
1366
|
+
<language>en</language>
|
1367
|
+
<script>Latn</script>
|
1368
|
+
<abstract>
|
1369
|
+
<p>Text</p>
|
1370
|
+
</abstract>
|
1371
|
+
<status>
|
1372
|
+
<stage>published</stage>
|
1373
|
+
</status>
|
1374
|
+
<copyright>
|
1375
|
+
<from>2020</from>
|
1376
|
+
</copyright>
|
1377
|
+
<ext>
|
1378
|
+
<doctype>article</doctype>
|
1379
|
+
</ext>
|
1380
|
+
</bibdata>
|
1381
|
+
<preface>
|
1382
|
+
<abstract id='_'>
|
1383
|
+
<title>Abstract</title>
|
1384
|
+
<p id='_'>Text</p>
|
1385
|
+
</abstract>
|
1386
|
+
<foreword id='_' obligation='informative'>
|
1387
|
+
<title>Antaŭparolo</title>
|
1388
|
+
<p id='_'>Text</p>
|
1389
|
+
</foreword>
|
1390
|
+
<introduction id='_' obligation='informative'>
|
1391
|
+
<title>Enkonduko</title>
|
1392
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
1393
|
+
<title>Introduction Subsection</title>
|
1394
|
+
</clause>
|
1395
|
+
</introduction>
|
1396
|
+
<clause id='_' inline-header='false' obligation='informative'>
|
1397
|
+
<title>Dedication</title>
|
1398
|
+
</clause>
|
1399
|
+
<acknowledgements id='_' obligation='informative'>
|
1400
|
+
<title>Acknowledgements</title>
|
1401
|
+
</acknowledgements>
|
1402
|
+
</preface>
|
1403
|
+
<sections>
|
1404
|
+
<clause id='_' type='scope' inline-header='false' obligation='normative'>
|
1405
|
+
<title>Amplekso</title>
|
1406
|
+
<p id='_'>Text</p>
|
1407
|
+
</clause>
|
1408
|
+
<terms id='_' obligation='normative'>
|
1409
|
+
<title>Terms and definitions</title>
|
1410
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1411
|
+
<term id='_'>
|
1412
|
+
<preferred>Term1</preferred>
|
1413
|
+
</term>
|
1414
|
+
</terms>
|
1415
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1416
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
1417
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1418
|
+
<title>Introduction</title>
|
1419
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1420
|
+
<title>Intro 1</title>
|
1421
|
+
</clause>
|
1422
|
+
</clause>
|
1423
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1424
|
+
<title>Intro 2</title>
|
1425
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1426
|
+
<title>Intro 3</title>
|
1427
|
+
</clause>
|
1428
|
+
</clause>
|
1429
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1430
|
+
<title>Intro 4</title>
|
1431
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1432
|
+
<title>Intro 5</title>
|
1433
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1434
|
+
<title>Term1</title>
|
1435
|
+
</clause>
|
1436
|
+
</clause>
|
1437
|
+
</clause>
|
1438
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1439
|
+
<title>Normal Terms</title>
|
1440
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1441
|
+
<title>Term2</title>
|
1442
|
+
</clause>
|
1443
|
+
</clause>
|
1444
|
+
<definitions id='_' obligation='normative'>
|
1445
|
+
<title>Symbols and abbreviated terms</title>
|
1446
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1447
|
+
<title>General</title>
|
1448
|
+
</clause>
|
1449
|
+
<definitions id='_' type='symbols' obligation='normative'>
|
1450
|
+
<title>Simboloj kai mallongigitaj terminoj</title>
|
1451
|
+
</definitions>
|
1452
|
+
</definitions>
|
1453
|
+
</clause>
|
1454
|
+
<definitions id='_' type='abbreviated_terms' obligation='normative'>
|
1455
|
+
<title>Abbreviated terms</title>
|
1456
|
+
</definitions>
|
1457
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1458
|
+
<title>Clause 4</title>
|
1459
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1460
|
+
<title>Introduction</title>
|
1461
|
+
</clause>
|
1462
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1463
|
+
<title>Clause 4.2</title>
|
1464
|
+
</clause>
|
1465
|
+
</clause>
|
1466
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1467
|
+
<title>Terms and Definitions</title>
|
1468
|
+
</clause>
|
1469
|
+
</sections>
|
1470
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
1471
|
+
<title>Annex</title>
|
1472
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1473
|
+
<title>Annex A.1</title>
|
1474
|
+
</clause>
|
1475
|
+
</annex>
|
1476
|
+
<bibliography>
|
1477
|
+
<references id='_' normative='true' obligation='informative'>
|
1478
|
+
<title>Normaj citaĵoj</title>
|
1479
|
+
<p id='_'>There are no normative references in this document.</p>
|
1480
|
+
</references>
|
1481
|
+
<references id='_' normative='false' obligation='informative'>
|
1482
|
+
<title>Bibliografio</title>
|
1483
|
+
</references>
|
1484
|
+
<references id='_' normative='false' obligation='informative'>
|
1485
|
+
<title>Bibliography</title>
|
1486
|
+
</references>
|
1487
|
+
<clause id='_' obligation='informative'>
|
1488
|
+
<title>Bibliography</title>
|
1489
|
+
<references id='_' normative='false' obligation='informative'>
|
1490
|
+
<title>Bibliography Subsection</title>
|
1491
|
+
</references>
|
1492
|
+
</clause>
|
1493
|
+
</bibliography>
|
1494
|
+
</standard-document>
|
1495
|
+
OUTPUT
|
1496
|
+
end
|
1497
|
+
|
1498
|
+
end
|