metanorma-standoc 1.5.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 +66 -0
- data/README.adoc +1 -3
- data/lib/asciidoctor/standoc/base.rb +6 -1
- data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
- data/lib/asciidoctor/standoc/cleanup.rb +79 -12
- data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -6
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -3
- data/lib/asciidoctor/standoc/cleanup_inline.rb +11 -2
- data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
- data/lib/asciidoctor/standoc/cleanup_section.rb +1 -2
- data/lib/asciidoctor/standoc/converter.rb +6 -2
- data/lib/asciidoctor/standoc/front.rb +9 -3
- data/lib/asciidoctor/standoc/front_contributor.rb +58 -18
- data/lib/asciidoctor/standoc/inline.rb +21 -31
- data/lib/asciidoctor/standoc/isodoc.rng +135 -58
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +59 -33
- data/lib/asciidoctor/standoc/ref.rb +41 -46
- data/lib/asciidoctor/standoc/ref_sect.rb +12 -5
- data/lib/asciidoctor/standoc/section.rb +11 -10
- data/lib/asciidoctor/standoc/table.rb +3 -2
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
- data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
- data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
- data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
- data/lib/liquid/custom_filters/values.rb +7 -0
- data/lib/metanorma/standoc.rb +0 -5
- data/lib/metanorma/standoc/version.rb +20 -1
- data/metanorma-standoc.gemspec +5 -4
- data/spec/asciidoctor-standoc/base_spec.rb +246 -9
- data/spec/asciidoctor-standoc/blocks_spec.rb +255 -143
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1498 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +409 -1572
- data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +6 -20
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +36 -0
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +6 -561
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +2 -2
- data/spec/asciidoctor-standoc/refs_spec.rb +266 -55
- data/spec/asciidoctor-standoc/section_spec.rb +0 -1
- data/spec/asciidoctor-standoc/table_spec.rb +112 -112
- data/spec/asciidoctor-standoc/validate_spec.rb +5 -1
- data/spec/examples/codes_table.html +1365 -1365
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
- data/spec/fixtures/test.exp +121 -0
- data/spec/spec_helper.rb +142 -108
- data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +781 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -234
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -59
- data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -115
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -57
- data/spec/vcr_cassettes/isobib_get_124.yml +13 -59
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +50 -36
- metadata +59 -11
- data/.github/workflows/macos.yml +0 -46
- data/.github/workflows/ubuntu.yml +0 -49
- data/.github/workflows/windows.yml +0 -53
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
- data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
- data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -45,8 +45,9 @@ module Asciidoctor
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def table_cell(c, xml_tr, tblsec)
|
48
|
-
cell_attributes =
|
49
|
-
|
48
|
+
cell_attributes =
|
49
|
+
{ id: c.id, colspan: c.colspan, valign: c.attr("valign"),
|
50
|
+
rowspan: c.rowspan, align: c.attr("halign") }
|
50
51
|
cell_tag = "td"
|
51
52
|
cell_tag = "th" if tblsec == :head || c.style == :header
|
52
53
|
xml_tr.send cell_tag, **attr_code(cell_attributes) do |thd|
|
@@ -2,29 +2,29 @@
|
|
2
2
|
[yaml2text,<%= model_path %>,definition]
|
3
3
|
----
|
4
4
|
|
5
|
-
=== {definition.name
|
5
|
+
=== {definition.name | default: "<%= file_name %>"}
|
6
6
|
{definition.definition}
|
7
7
|
|
8
|
-
{if definition.attributes}
|
9
|
-
.{definition.name
|
8
|
+
{% if definition.attributes %}
|
9
|
+
.{definition.name | default: "<%= file_name %>"} attributes
|
10
10
|
|===
|
11
11
|
|Name |Definition |Mandatory/ Optional/ Conditional |Max Occur |Data Type
|
12
12
|
|
13
|
-
{definition.attributes
|
14
|
-
|{key} |{definition.attributes[key].definition
|
13
|
+
{definition.attributes.*,key,EOK}
|
14
|
+
|{key} |{% if definition.attributes[key].definition %}{{ definition.attributes[key].definition }}{% else %}TODO: enum {{ key }}'s definition{% endif %} |{% if definition.attributes[key].cardinality.min == 0 %}O{% else %}M{% endif %} |{% if definition.attributes[key].cardinality.max == "*" %}N{% else %}1{% endif %} |{% if definition.attributes[key].origin %}<<{{ definition.attributes[key].origin }}>>{% endif %} `{definition.attributes[key].type}`
|
15
15
|
{EOK}
|
16
16
|
|===
|
17
|
-
{
|
17
|
+
{% endif %}
|
18
18
|
|
19
|
-
{if definition['values']}
|
20
|
-
.{definition.name
|
19
|
+
{% if definition['values'] %}
|
20
|
+
.{definition.name | default: "<%= file_name %>"} values
|
21
21
|
|===
|
22
22
|
|Name |Definition
|
23
23
|
|
24
|
-
{definition['values']
|
24
|
+
{definition['values'].*,key,EOK}
|
25
25
|
|{key} |{definition['values'][key].definition}
|
26
26
|
{EOK}
|
27
27
|
|===
|
28
|
-
{
|
28
|
+
{% endif %}
|
29
29
|
|
30
30
|
----
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class KeyIterator < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_name, @var_name = markup.split(',').map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
res = ''
|
11
|
+
iterator = context[@context_name].is_a?(Hash) ? context[@context_name].keys : context[@context_name]
|
12
|
+
iterator.each.with_index do |key, index|
|
13
|
+
context['index'] = index
|
14
|
+
context[@var_name] = key
|
15
|
+
res += super
|
16
|
+
end
|
17
|
+
res
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class WithJsonNestedContext < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_file_variable, @context_name = markup.split(",").map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
context_file = context[@context_file_variable].to_s.strip
|
11
|
+
context[@context_name] = JSON.parse(
|
12
|
+
File.read(context_file, encoding: "utf-8")
|
13
|
+
)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class WithYamlNestedContext < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_file_variable, @context_name = markup.split(",").map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
context_file = context[@context_file_variable].to_s.strip
|
11
|
+
context[@context_name] = YAML.safe_load(
|
12
|
+
File.read(context_file, encoding: "utf-8"),
|
13
|
+
[Date, Time]
|
14
|
+
)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/metanorma/standoc.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
module Metanorma
|
2
|
+
class << self
|
3
|
+
# https://stackoverflow.com/a/53399471
|
4
|
+
def parent_of(mod)
|
5
|
+
parent_name = mod.name =~ /::[^:]+\Z/ ? $`.freeze : nil
|
6
|
+
Object.const_get(parent_name) if parent_name
|
7
|
+
end
|
8
|
+
|
9
|
+
def all_modules(mod)
|
10
|
+
[mod] + mod.constants.map { |c| mod.const_get(c) }
|
11
|
+
.select {|c| c.is_a?(Module) && parent_of(c) == mod }
|
12
|
+
.flat_map {|m| all_modules(m) }
|
13
|
+
end
|
14
|
+
|
15
|
+
def versioned(mod, flavour)
|
16
|
+
all_modules(mod).select {|c| defined? c::VERSION}.
|
17
|
+
select {|c| c.name =~ /::#{flavour}$/ }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
2
21
|
module Standoc
|
3
|
-
|
22
|
+
VERSION = "1.6.3".freeze
|
4
23
|
end
|
5
24
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -30,13 +30,17 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
31
|
spec.add_dependency "isodoc", "~> 1.2.0"
|
32
32
|
spec.add_dependency "iev", "~> 0.2.1"
|
33
|
-
spec.add_dependency "
|
33
|
+
spec.add_dependency "metanorma-plugin-datastruct"
|
34
|
+
spec.add_dependency "metanorma-plugin-lutaml"
|
35
|
+
# relaton-cli not just relaton, to avoid circular reference in metanorma
|
36
|
+
spec.add_dependency "relaton-cli", "~> 1.5.0"
|
34
37
|
spec.add_dependency "relaton-iev", "~> 1.0.0"
|
35
38
|
spec.add_dependency "sterile", "~> 1.0.14"
|
36
39
|
spec.add_dependency "concurrent-ruby"
|
37
40
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
38
41
|
spec.add_dependency "mimemagic"
|
39
42
|
spec.add_dependency "mathml2asciimath"
|
43
|
+
spec.add_dependency "latexmath"
|
40
44
|
|
41
45
|
spec.add_development_dependency "byebug"
|
42
46
|
spec.add_development_dependency "sassc", "2.4.0"
|
@@ -50,7 +54,4 @@ Gem::Specification.new do |spec|
|
|
50
54
|
spec.add_development_dependency "timecop", "~> 0.9"
|
51
55
|
spec.add_development_dependency "vcr", "~> 5.0.0"
|
52
56
|
spec.add_development_dependency "webmock"
|
53
|
-
#spec.add_development_dependency "relaton-iec"
|
54
|
-
#spec.add_development_dependency "relaton-iso"
|
55
|
-
#spec.add_development_dependency "relaton-ietf"
|
56
57
|
end
|
@@ -32,8 +32,101 @@ RSpec.describe Asciidoctor::Standoc do
|
|
32
32
|
expect(File.exist?("htmlstyle.css")).to be false
|
33
33
|
end
|
34
34
|
|
35
|
+
it "processes publisher abbreviations" do
|
36
|
+
mock_org_abbrevs
|
37
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
38
|
+
= Document title
|
39
|
+
Author
|
40
|
+
:docfile: test.adoc
|
41
|
+
:nodoc:
|
42
|
+
:novalid:
|
43
|
+
:publisher: International Electrotechnical Commission,IETF,ISO
|
44
|
+
INPUT
|
45
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
46
|
+
<bibdata type='standard'>
|
47
|
+
<title language='en' format='text/plain'>Document title</title>
|
48
|
+
<contributor>
|
49
|
+
<role type='author'/>
|
50
|
+
<organization>
|
51
|
+
<name>International Electrotechnical Commission</name>
|
52
|
+
<abbreviation>IEC</abbreviation>
|
53
|
+
</organization>
|
54
|
+
</contributor>
|
55
|
+
<contributor>
|
56
|
+
<role type='author'/>
|
57
|
+
<organization>
|
58
|
+
<name>IETF</name>
|
59
|
+
</organization>
|
60
|
+
</contributor>
|
61
|
+
<contributor>
|
62
|
+
<role type='author'/>
|
63
|
+
<organization>
|
64
|
+
<name>International Standards Organization</name>
|
65
|
+
<abbreviation>ISO</abbreviation>
|
66
|
+
</organization>
|
67
|
+
</contributor>
|
68
|
+
<contributor>
|
69
|
+
<role type='publisher'/>
|
70
|
+
<organization>
|
71
|
+
<name>International Electrotechnical Commission</name>
|
72
|
+
<abbreviation>IEC</abbreviation>
|
73
|
+
</organization>
|
74
|
+
</contributor>
|
75
|
+
<contributor>
|
76
|
+
<role type='publisher'/>
|
77
|
+
<organization>
|
78
|
+
<name>IETF</name>
|
79
|
+
</organization>
|
80
|
+
</contributor>
|
81
|
+
<contributor>
|
82
|
+
<role type='publisher'/>
|
83
|
+
<organization>
|
84
|
+
<name>International Standards Organization</name>
|
85
|
+
<abbreviation>ISO</abbreviation>
|
86
|
+
</organization>
|
87
|
+
</contributor>
|
88
|
+
<language>en</language>
|
89
|
+
<script>Latn</script>
|
90
|
+
<status>
|
91
|
+
<stage>published</stage>
|
92
|
+
</status>
|
93
|
+
<copyright>
|
94
|
+
<from>2020</from>
|
95
|
+
<owner>
|
96
|
+
<organization>
|
97
|
+
<name>International Electrotechnical Commission</name>
|
98
|
+
<abbreviation>IEC</abbreviation>
|
99
|
+
</organization>
|
100
|
+
</owner>
|
101
|
+
</copyright>
|
102
|
+
<copyright>
|
103
|
+
<from>2020</from>
|
104
|
+
<owner>
|
105
|
+
<organization>
|
106
|
+
<name>IETF</name>
|
107
|
+
</organization>
|
108
|
+
</owner>
|
109
|
+
</copyright>
|
110
|
+
<copyright>
|
111
|
+
<from>2020</from>
|
112
|
+
<owner>
|
113
|
+
<organization>
|
114
|
+
<name>International Standards Organization</name>
|
115
|
+
<abbreviation>ISO</abbreviation>
|
116
|
+
</organization>
|
117
|
+
</owner>
|
118
|
+
</copyright>
|
119
|
+
<ext>
|
120
|
+
<doctype>article</doctype>
|
121
|
+
</ext>
|
122
|
+
</bibdata>
|
123
|
+
<sections> </sections>
|
124
|
+
</standard-document>
|
125
|
+
OUTPUT
|
126
|
+
end
|
127
|
+
|
35
128
|
it "processes default metadata" do
|
36
|
-
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~
|
129
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
37
130
|
= Document title
|
38
131
|
Author
|
39
132
|
:docfile: test.adoc
|
@@ -98,7 +191,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
98
191
|
:role_2: editor
|
99
192
|
:affiliation_2: Rockhead and Quarry Cave Construction Company
|
100
193
|
:affiliation_abbrev_2: RQCCC
|
101
|
-
:address_2: 6A Rubble Way,
|
194
|
+
:address_2: 6A Rubble Way, + \\
|
195
|
+
Bedrock
|
102
196
|
:email_2: barney@rockhead.example.com
|
103
197
|
:phone_2: 789
|
104
198
|
:fax_2: 012
|
@@ -107,12 +201,22 @@ RSpec.describe Asciidoctor::Standoc do
|
|
107
201
|
:part-of: ABC
|
108
202
|
:translated-from: DEF,GHI;JKL MNO,PQR
|
109
203
|
:keywords: a, b, c
|
204
|
+
:pub-address: 1 Infinity Loop + \\
|
205
|
+
California
|
206
|
+
:pub-phone: 3333333
|
207
|
+
:pub-fax: 4444444
|
208
|
+
:pub-email: x@example.com
|
209
|
+
:pub-uri: http://www.example.com
|
210
|
+
:isbn: ISBN-13
|
211
|
+
:isbn10: ISBN-10
|
110
212
|
INPUT
|
111
213
|
<?xml version="1.0" encoding="UTF-8"?>
|
112
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc">
|
214
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
113
215
|
<bibdata type="standard">
|
114
216
|
<title language="en" format="text/plain">Main Title — Title</title>
|
115
217
|
<docidentifier>1000-1</docidentifier>
|
218
|
+
<docidentifier type='ISBN'>ISBN-13</docidentifier>
|
219
|
+
<docidentifier type='ISBN10'>ISBN-10</docidentifier>
|
116
220
|
<docnumber>1000</docnumber>
|
117
221
|
<date type="published">
|
118
222
|
<on>1000-01-01</on>
|
@@ -159,19 +263,19 @@ RSpec.describe Asciidoctor::Standoc do
|
|
159
263
|
<contributor>
|
160
264
|
<role type="author"/>
|
161
265
|
<organization>
|
162
|
-
<name>
|
266
|
+
<name>Hanna Barbera</name>
|
163
267
|
</organization>
|
164
268
|
</contributor>
|
165
269
|
<contributor>
|
166
270
|
<role type="author"/>
|
167
271
|
<organization>
|
168
|
-
<name>
|
272
|
+
<name>Cartoon Network</name>
|
169
273
|
</organization>
|
170
274
|
</contributor>
|
171
275
|
<contributor>
|
172
276
|
<role type="author"/>
|
173
277
|
<organization>
|
174
|
-
<name>
|
278
|
+
<name>Ribose, Inc.</name>
|
175
279
|
</organization>
|
176
280
|
</contributor>
|
177
281
|
<contributor>
|
@@ -185,7 +289,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
185
289
|
<name>Slate Rock and Gravel Company</name>
|
186
290
|
<abbreviation>SRG</abbreviation>
|
187
291
|
<address>
|
188
|
-
|
292
|
+
<formattedAddress>
|
293
|
+
6 Rubble Way, Bedrock
|
294
|
+
</formattedAddress>
|
189
295
|
</address>
|
190
296
|
</organization>
|
191
297
|
</affiliation>
|
@@ -207,7 +313,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
207
313
|
<name>Rockhead and Quarry Cave Construction Company</name>
|
208
314
|
<abbreviation>RQCCC</abbreviation>
|
209
315
|
<address>
|
210
|
-
<formattedAddress>6A Rubble Way, Bedrock</formattedAddress>
|
316
|
+
<formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
|
211
317
|
</address>
|
212
318
|
</organization>
|
213
319
|
</affiliation>
|
@@ -328,6 +434,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
328
434
|
:relaton-uri: F
|
329
435
|
:title-eo: Dokumenttitolo
|
330
436
|
:doctype: This is a DocType
|
437
|
+
:subdivision: Subdivision
|
438
|
+
:subdivision-abbr: SD
|
331
439
|
|
332
440
|
[abstract]
|
333
441
|
== Abstract
|
@@ -339,7 +447,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
339
447
|
== Clause 1
|
340
448
|
INPUT
|
341
449
|
<?xml version="1.0" encoding="UTF-8"?>
|
342
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc">
|
450
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
343
451
|
<bibdata type="standard">
|
344
452
|
<title language="en" format="text/plain">Document title</title>
|
345
453
|
<title language="eo" format="text/plain">Dokumenttitolo</title>
|
@@ -442,6 +550,105 @@ RSpec.describe Asciidoctor::Standoc do
|
|
442
550
|
OUTPUT
|
443
551
|
end
|
444
552
|
|
553
|
+
it "processes subdivisions" do
|
554
|
+
mock_default_publisher
|
555
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
556
|
+
= Document title
|
557
|
+
Author
|
558
|
+
:docfile: test.adoc
|
559
|
+
:nodoc:
|
560
|
+
:novalid:
|
561
|
+
:revdate: 2000-01
|
562
|
+
:published-date: 1000-01
|
563
|
+
:docnumber: 1000
|
564
|
+
:partnumber: 1-1
|
565
|
+
:tc-docnumber: 2000
|
566
|
+
:language: el
|
567
|
+
:script: Grek
|
568
|
+
:subdivision: Subdivision
|
569
|
+
:subdivision-abbr: SD
|
570
|
+
:doctype: This is a DocType
|
571
|
+
:pub-address: 1 Infinity Loop + \\
|
572
|
+
California
|
573
|
+
:pub-phone: 3333333
|
574
|
+
:pub-fax: 4444444
|
575
|
+
:pub-email: x@example.com
|
576
|
+
:pub-uri: http://www.example.com
|
577
|
+
|
578
|
+
INPUT
|
579
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
580
|
+
<bibdata type='standard'>
|
581
|
+
<title language='en' format='text/plain'>Document title</title>
|
582
|
+
<docidentifier>1000-1-1</docidentifier>
|
583
|
+
<docnumber>1000</docnumber>
|
584
|
+
<date type='published'>
|
585
|
+
<on>1000-01</on>
|
586
|
+
</date>
|
587
|
+
<contributor>
|
588
|
+
<role type='author'/>
|
589
|
+
<organization>
|
590
|
+
<name>International Standards Organization</name>
|
591
|
+
<subdivision>Subdivision</subdivision>
|
592
|
+
<abbreviation>SD</abbreviation>
|
593
|
+
<address>
|
594
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
595
|
+
</address>
|
596
|
+
<phone>3333333</phone>
|
597
|
+
<phone type='fax'>4444444</phone>
|
598
|
+
<email>x@example.com</email>
|
599
|
+
<uri>http://www.example.com</uri>
|
600
|
+
</organization>
|
601
|
+
</contributor>
|
602
|
+
<contributor>
|
603
|
+
<role type='publisher'/>
|
604
|
+
<organization>
|
605
|
+
<name>International Standards Organization</name>
|
606
|
+
<subdivision>Subdivision</subdivision>
|
607
|
+
<abbreviation>SD</abbreviation>
|
608
|
+
<address>
|
609
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
610
|
+
</address>
|
611
|
+
<phone>3333333</phone>
|
612
|
+
<phone type='fax'>4444444</phone>
|
613
|
+
<email>x@example.com</email>
|
614
|
+
<uri>http://www.example.com</uri>
|
615
|
+
</organization>
|
616
|
+
</contributor>
|
617
|
+
<version>
|
618
|
+
<revision-date>2000-01</revision-date>
|
619
|
+
</version>
|
620
|
+
<language>el</language>
|
621
|
+
<script>Grek</script>
|
622
|
+
<status>
|
623
|
+
<stage>published</stage>
|
624
|
+
</status>
|
625
|
+
<copyright>
|
626
|
+
<from>2020</from>
|
627
|
+
<owner>
|
628
|
+
<organization>
|
629
|
+
<name>International Standards Organization</name>
|
630
|
+
<subdivision>Subdivision</subdivision>
|
631
|
+
<abbreviation>SD</abbreviation>
|
632
|
+
<address>
|
633
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
634
|
+
</address>
|
635
|
+
<phone>3333333</phone>
|
636
|
+
<phone type='fax'>4444444</phone>
|
637
|
+
<email>x@example.com</email>
|
638
|
+
<uri>http://www.example.com</uri>
|
639
|
+
</organization>
|
640
|
+
</owner>
|
641
|
+
</copyright>
|
642
|
+
<ext>
|
643
|
+
<doctype>this-is-a-doctype</doctype>
|
644
|
+
</ext>
|
645
|
+
</bibdata>
|
646
|
+
<sections> </sections>
|
647
|
+
</standard-document>
|
648
|
+
|
649
|
+
OUTPUT
|
650
|
+
end
|
651
|
+
|
445
652
|
it "reads scripts into blank HTML document" do
|
446
653
|
FileUtils.rm_f "test.html"
|
447
654
|
Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
|
@@ -526,6 +733,36 @@ QU1FOiB0ZXN0Cgo=
|
|
526
733
|
])
|
527
734
|
end
|
528
735
|
|
736
|
+
it "test submitting-organizations with delimiter in end" do
|
737
|
+
FileUtils.rm_f "test.doc"
|
738
|
+
Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
|
739
|
+
= Document title
|
740
|
+
Author
|
741
|
+
:docfile: test.adoc
|
742
|
+
:doctype: standard
|
743
|
+
:encoding: utf-8
|
744
|
+
:lang: en
|
745
|
+
:submitting-organizations: Organization One; Organization Two;
|
746
|
+
:publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc.",
|
747
|
+
INPUT
|
748
|
+
expect(File.exist?("test.doc")).to be true
|
749
|
+
end
|
750
|
+
|
751
|
+
private
|
752
|
+
|
753
|
+
def mock_org_abbrevs
|
754
|
+
allow_any_instance_of(::Asciidoctor::Standoc::Front).to receive(:org_abbrev).and_return(
|
755
|
+
{ "International Standards Organization" => "ISO",
|
756
|
+
"International Electrotechnical Commission" => "IEC" }
|
757
|
+
)
|
758
|
+
end
|
759
|
+
|
760
|
+
def mock_default_publisher
|
761
|
+
allow_any_instance_of(::Asciidoctor::Standoc::Front).to receive(:default_publisher).and_return(
|
762
|
+
"International Standards Organization"
|
763
|
+
)
|
764
|
+
end
|
765
|
+
|
529
766
|
|
530
767
|
end
|
531
768
|
|