metanorma-standoc 1.8.8 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +3 -7
  5. data/Gemfile.devel +0 -0
  6. data/lib/asciidoctor/standoc/base.rb +42 -36
  7. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  8. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  9. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  10. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  11. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  12. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  13. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  14. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +77 -134
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  21. data/lib/asciidoctor/standoc/converter.rb +10 -3
  22. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  23. data/lib/asciidoctor/standoc/front.rb +35 -18
  24. data/lib/asciidoctor/standoc/front_contributor.rb +70 -45
  25. data/lib/asciidoctor/standoc/inline.rb +30 -22
  26. data/lib/asciidoctor/standoc/isodoc.rng +321 -4
  27. data/lib/asciidoctor/standoc/lists.rb +4 -2
  28. data/lib/asciidoctor/standoc/macros.rb +50 -23
  29. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  30. data/lib/asciidoctor/standoc/ref.rb +87 -112
  31. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  32. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  33. data/lib/asciidoctor/standoc/section.rb +3 -1
  34. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +31 -16
  35. data/lib/asciidoctor/standoc/terms.rb +27 -16
  36. data/lib/asciidoctor/standoc/utils.rb +35 -9
  37. data/lib/asciidoctor/standoc/validate.rb +30 -28
  38. data/lib/metanorma-standoc.rb +0 -1
  39. data/lib/metanorma/standoc/version.rb +5 -5
  40. data/metanorma-standoc.gemspec +11 -11
  41. data/spec/asciidoctor/base_spec.rb +715 -509
  42. data/spec/asciidoctor/blocks_spec.rb +830 -727
  43. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  44. data/spec/asciidoctor/cleanup_spec.rb +1836 -1673
  45. data/spec/asciidoctor/inline_spec.rb +330 -283
  46. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  47. data/spec/asciidoctor/lists_spec.rb +3 -3
  48. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  49. data/spec/asciidoctor/macros_spec.rb +546 -444
  50. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  51. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  52. data/spec/asciidoctor/refs_spec.rb +1528 -1533
  53. data/spec/asciidoctor/section_spec.rb +778 -689
  54. data/spec/asciidoctor/table_spec.rb +6 -6
  55. data/spec/asciidoctor/validate_spec.rb +296 -304
  56. data/spec/spec_helper.rb +13 -9
  57. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +66 -66
  58. data/spec/vcr_cassettes/isobib_get_123.yml +17 -17
  59. data/spec/vcr_cassettes/isobib_get_123_1.yml +31 -31
  60. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +40 -40
  61. data/spec/vcr_cassettes/isobib_get_123_2001.yml +17 -17
  62. data/spec/vcr_cassettes/isobib_get_124.yml +16 -16
  63. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  64. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +78 -66
  65. metadata +69 -67
  66. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  67. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  68. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  69. data/lib/liquid/custom_filters/values.rb +0 -7
@@ -1,5 +1,4 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
- #require_relative "asciidoctor/standoc"
3
2
  require_relative "asciidoctor/standoc/converter"
4
3
  require_relative "metanorma/standoc/version"
5
4
  require "asciidoctor/extensions"
@@ -8,17 +8,17 @@ module Metanorma
8
8
 
9
9
  def all_modules(mod)
10
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) }
11
+ .select { |c| c.is_a?(Module) && parent_of(c) == mod }
12
+ .flat_map { |m| all_modules(m) }
13
13
  end
14
14
 
15
15
  def versioned(mod, flavour)
16
- all_modules(mod).select {|c| defined? c::VERSION}.
17
- select {|c| c.name =~ /::#{flavour}$/ }
16
+ all_modules(mod).select { |c| defined? c::VERSION }
17
+ .select { |c| c.name =~ /::#{flavour}$/ }
18
18
  end
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION= "1.8.8".freeze
22
+ VERSION = "1.9.4".freeze
23
23
  end
24
24
  end
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "metanorma/standoc/version"
6
6
 
@@ -27,29 +27,29 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
29
  spec.add_dependency "asciidoctor", "~> 2.0.0"
30
- spec.add_dependency "ruby-jing"
31
- spec.add_dependency "isodoc", "~> 1.5.0"
32
30
  spec.add_dependency "iev", "~> 0.2.1"
31
+ spec.add_dependency "isodoc", "~> 1.6.2"
33
32
  spec.add_dependency "metanorma-plugin-datastruct"
34
- spec.add_dependency "metanorma-plugin-lutaml", "~> 0.3.0"
33
+ spec.add_dependency "metanorma-plugin-lutaml"
34
+ spec.add_dependency "ruby-jing"
35
35
  # relaton-cli not just relaton, to avoid circular reference in metanorma
36
- spec.add_dependency "relaton-cli", "~> 1.7.0"
37
- spec.add_dependency "relaton-iev", "~> 1.1.0"
36
+ spec.add_dependency "asciimath2unitsml", "~> 0.3.0"
38
37
  spec.add_dependency "concurrent-ruby"
39
- spec.add_dependency "unicode2latex", "~> 0.0.1"
40
- spec.add_dependency "metanorma-utils", "~> 1.1.0"
41
- spec.add_dependency "mathml2asciimath"
42
38
  spec.add_dependency "latexmath"
43
- spec.add_dependency "asciimath2unitsml", "~> 0.3.0"
39
+ spec.add_dependency "mathml2asciimath"
40
+ spec.add_dependency "metanorma-utils", "~> 1.2.0"
41
+ spec.add_dependency "relaton-cli", "~> 1.8.0"
42
+ spec.add_dependency "relaton-iev", "~> 1.1.0"
43
+ spec.add_dependency "unicode2latex", "~> 0.0.1"
44
44
 
45
45
  spec.add_development_dependency "byebug"
46
- spec.add_development_dependency "sassc", "2.4.0"
47
46
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
48
47
  spec.add_development_dependency "guard", "~> 2.14"
49
48
  spec.add_development_dependency "guard-rspec", "~> 4.7"
50
49
  spec.add_development_dependency "rake", "~> 13.0"
51
50
  spec.add_development_dependency "rspec", "~> 3.6"
52
51
  spec.add_development_dependency "rubocop", "~> 1.5.2"
52
+ spec.add_development_dependency "sassc", "2.4.0"
53
53
  spec.add_development_dependency "simplecov", "~> 0.15"
54
54
  spec.add_development_dependency "timecop", "~> 0.9"
55
55
  spec.add_development_dependency "vcr", "~> 5.0.0"
@@ -7,155 +7,167 @@ RSpec.describe Asciidoctor::Standoc do
7
7
  end
8
8
 
9
9
  it "processes a blank document" do
10
- expect(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).to be_equivalent_to <<~"OUTPUT"
11
- #{ASCIIDOC_BLANK_HDR}
10
+ input = <<~INPUT
11
+ #{ASCIIDOC_BLANK_HDR}
12
12
  INPUT
13
- #{BLANK_HDR}
14
- <sections/>
15
- </standard-document>
13
+ output = <<~OUTPUT
14
+ #{BLANK_HDR}
15
+ <sections/>
16
+ </standard-document>
16
17
  OUTPUT
18
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
19
+ .to be_equivalent_to xmlpp(output)
17
20
  end
18
21
 
19
22
  it "converts a blank document" do
20
23
  FileUtils.rm_f "test.doc"
21
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
24
+ input = <<~INPUT
22
25
  = Document title
23
26
  Author
24
27
  :docfile: test.adoc
25
28
  :novalid:
26
29
  INPUT
27
- #{BLANK_HDR}
28
- <sections/>
29
- </standard-document>
30
+ output = <<~OUTPUT
31
+ #{BLANK_HDR}
32
+ <sections/>
33
+ </standard-document>
30
34
  OUTPUT
35
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
36
+ .to be_equivalent_to xmlpp(output)
31
37
  expect(File.exist?("test.doc")).to be true
32
38
  expect(File.exist?("htmlstyle.css")).to be false
33
39
  end
34
40
 
35
- it "assigns default scripts to major languages" do
41
+ it "assigns default scripts to major languages" do
36
42
  FileUtils.rm_f "test.doc"
37
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
43
+ input = <<~INPUT
38
44
  = Document title
39
45
  Author
40
46
  :docfile: test.adoc
41
47
  :novalid:
42
48
  :language: ar
43
49
  INPUT
44
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
45
- <bibdata type='standard'>
46
- <title language='en' format='text/plain'>Document title</title>
47
- <language>ar</language>
48
- <script>Arab</script>
49
- <status>
50
- <stage>published</stage>
51
- </status>
52
- <copyright>
53
- <from>2021</from>
54
- </copyright>
55
- <ext>
56
- <doctype>article</doctype>
57
- </ext>
58
- </bibdata>
59
- <sections> </sections>
60
- </standard-document>
50
+ output = <<~OUTPUT
51
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
52
+ <bibdata type='standard'>
53
+ <title language='en' format='text/plain'>Document title</title>
54
+ <language>ar</language>
55
+ <script>Arab</script>
56
+ <status>
57
+ <stage>published</stage>
58
+ </status>
59
+ <copyright>
60
+ <from>2021</from>
61
+ </copyright>
62
+ <ext>
63
+ <doctype>article</doctype>
64
+ </ext>
65
+ </bibdata>
66
+ <sections> </sections>
67
+ </standard-document>
61
68
  OUTPUT
69
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
70
+ .to be_equivalent_to xmlpp(output)
62
71
  end
63
72
 
64
73
  it "processes publisher abbreviations" do
65
74
  mock_org_abbrevs
66
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
75
+ input = <<~INPUT
67
76
  = Document title
68
77
  Author
69
78
  :docfile: test.adoc
70
79
  :nodoc:
71
80
  :novalid:
72
81
  :publisher: International Electrotechnical Commission;IETF;ISO
73
- INPUT
74
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
75
- <bibdata type='standard'>
76
- <title language='en' format='text/plain'>Document title</title>
77
- <contributor>
78
- <role type='author'/>
79
- <organization>
80
- <name>International Electrotechnical Commission</name>
81
- <abbreviation>IEC</abbreviation>
82
- </organization>
83
- </contributor>
84
- <contributor>
85
- <role type='author'/>
86
- <organization>
87
- <name>IETF</name>
88
- </organization>
89
- </contributor>
90
- <contributor>
91
- <role type='author'/>
92
- <organization>
93
- <name>International Standards Organization</name>
94
- <abbreviation>ISO</abbreviation>
95
- </organization>
96
- </contributor>
97
- <contributor>
98
- <role type='publisher'/>
99
- <organization>
100
- <name>International Electrotechnical Commission</name>
101
- <abbreviation>IEC</abbreviation>
102
- </organization>
103
- </contributor>
104
- <contributor>
105
- <role type='publisher'/>
106
- <organization>
107
- <name>IETF</name>
108
- </organization>
109
- </contributor>
110
- <contributor>
111
- <role type='publisher'/>
112
- <organization>
113
- <name>International Standards Organization</name>
114
- <abbreviation>ISO</abbreviation>
115
- </organization>
116
- </contributor>
117
- <language>en</language>
118
- <script>Latn</script>
119
- <status>
120
- <stage>published</stage>
121
- </status>
122
- <copyright>
123
- <from>#{Time.now.year}</from>
124
- <owner>
125
- <organization>
126
- <name>International Electrotechnical Commission</name>
127
- <abbreviation>IEC</abbreviation>
128
- </organization>
129
- </owner>
130
- </copyright>
131
- <copyright>
132
- <from>#{Time.now.year}</from>
133
- <owner>
134
- <organization>
135
- <name>IETF</name>
136
- </organization>
137
- </owner>
138
- </copyright>
139
- <copyright>
140
- <from>#{Time.now.year}</from>
141
- <owner>
142
- <organization>
143
- <name>International Standards Organization</name>
144
- <abbreviation>ISO</abbreviation>
145
- </organization>
146
- </owner>
147
- </copyright>
148
- <ext>
149
- <doctype>article</doctype>
150
- </ext>
151
- </bibdata>
152
- <sections> </sections>
153
- </standard-document>
154
- OUTPUT
82
+ INPUT
83
+ output = <<~OUTPUT
84
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
85
+ <bibdata type='standard'>
86
+ <title language='en' format='text/plain'>Document title</title>
87
+ <contributor>
88
+ <role type='author'/>
89
+ <organization>
90
+ <name>International Electrotechnical Commission</name>
91
+ <abbreviation>IEC</abbreviation>
92
+ </organization>
93
+ </contributor>
94
+ <contributor>
95
+ <role type='author'/>
96
+ <organization>
97
+ <name>IETF</name>
98
+ </organization>
99
+ </contributor>
100
+ <contributor>
101
+ <role type='author'/>
102
+ <organization>
103
+ <name>International Standards Organization</name>
104
+ <abbreviation>ISO</abbreviation>
105
+ </organization>
106
+ </contributor>
107
+ <contributor>
108
+ <role type='publisher'/>
109
+ <organization>
110
+ <name>International Electrotechnical Commission</name>
111
+ <abbreviation>IEC</abbreviation>
112
+ </organization>
113
+ </contributor>
114
+ <contributor>
115
+ <role type='publisher'/>
116
+ <organization>
117
+ <name>IETF</name>
118
+ </organization>
119
+ </contributor>
120
+ <contributor>
121
+ <role type='publisher'/>
122
+ <organization>
123
+ <name>International Standards Organization</name>
124
+ <abbreviation>ISO</abbreviation>
125
+ </organization>
126
+ </contributor>
127
+ <language>en</language>
128
+ <script>Latn</script>
129
+ <status>
130
+ <stage>published</stage>
131
+ </status>
132
+ <copyright>
133
+ <from>#{Time.now.year}</from>
134
+ <owner>
135
+ <organization>
136
+ <name>International Electrotechnical Commission</name>
137
+ <abbreviation>IEC</abbreviation>
138
+ </organization>
139
+ </owner>
140
+ </copyright>
141
+ <copyright>
142
+ <from>#{Time.now.year}</from>
143
+ <owner>
144
+ <organization>
145
+ <name>IETF</name>
146
+ </organization>
147
+ </owner>
148
+ </copyright>
149
+ <copyright>
150
+ <from>#{Time.now.year}</from>
151
+ <owner>
152
+ <organization>
153
+ <name>International Standards Organization</name>
154
+ <abbreviation>ISO</abbreviation>
155
+ </organization>
156
+ </owner>
157
+ </copyright>
158
+ <ext>
159
+ <doctype>article</doctype>
160
+ </ext>
161
+ </bibdata>
162
+ <sections> </sections>
163
+ </standard-document>
164
+ OUTPUT
165
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
166
+ .to be_equivalent_to xmlpp(output)
155
167
  end
156
168
 
157
169
  it "processes default metadata" do
158
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
170
+ input = <<~INPUT
159
171
  = Document title
160
172
  Author
161
173
  :docfile: test.adoc
@@ -240,214 +252,275 @@ OUTPUT
240
252
  :pub-uri: http://www.example.com
241
253
  :isbn: ISBN-13
242
254
  :isbn10: ISBN-10
255
+ :classification: a:b, c
243
256
  INPUT
244
- <?xml version="1.0" encoding="UTF-8"?>
245
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
246
- <bibdata type="standard">
247
- <title language="en" format="text/plain">Main Title — Title</title>
248
- <docidentifier>1000-1</docidentifier>
249
- <docidentifier type='ISBN'>ISBN-13</docidentifier>
250
- <docidentifier type='ISBN10'>ISBN-10</docidentifier>
251
- <docnumber>1000</docnumber>
252
- <date type="published">
253
- <on>1000-01-01</on>
254
- </date>
255
- <date type="accessed">
256
- <on>1001-01-01</on>
257
- </date>
258
- <date type="created">
259
- <on>1002-01-01</on>
260
- </date>
261
- <date type="implemented">
262
- <on>1003-01-01</on>
263
- </date>
264
- <date type="obsoleted">
265
- <on>1004-01-01</on>
266
- </date>
267
- <date type="confirmed">
268
- <on>1005-01-01</on>
269
- </date>
270
- <date type="updated">
271
- <on>1006-01-01</on>
272
- </date>
273
- <date type="issued">
274
- <on>1007-01-01</on>
275
- </date>
276
- <date type="circulated">
277
- <on>1008-01-01</on>
278
- </date>
279
- <date type="unchanged">
280
- <on>1009-01-01</on>
281
- </date>
282
- <date type='vote-started'>
283
- <on>1011-01-01</on>
284
- </date>
285
- <date type='vote-ended'>
286
- <on>1012-01-01</on>
287
- </date>
288
- <date type="Fred">
289
- <on>1010-01-01</on>
290
- </date>
291
- <date type="Jack">
292
- <on>1010-01-01</on>
293
- </date>
294
- <contributor>
295
- <role type="author"/>
296
- <organization>
297
- <name>Hanna Barbera</name>
298
- </organization>
299
- </contributor>
300
- <contributor>
301
- <role type="author"/>
302
- <organization>
303
- <name>Cartoon Network</name>
304
- </organization>
305
- </contributor>
306
- <contributor>
307
- <role type="author"/>
308
- <organization>
309
- <name>Ribose, Inc.</name>
310
- </organization>
311
- </contributor>
312
- <contributor>
313
- <role type="author"/>
314
- <person>
315
- <name>
316
- <completename>Fred Flintstone</completename>
317
- </name>
318
- <affiliation>
319
- <organization>
320
- <name>Slate Rock and Gravel Company</name>
321
- <abbreviation>SRG</abbreviation>
322
- <subdivision>Hermeneutics Unit</subdivision>
323
- <subdivision>Exegetical Subunit</subdivision>
324
- <address>
325
- <formattedAddress>
326
- 6 Rubble Way, Bedrock
327
- </formattedAddress>
328
- </address>
329
- </organization>
330
- </affiliation>
331
- <phone>123</phone>
332
- <phone type='fax'>456</phone>
333
- <uri>http://slate.example.com</uri>
334
- </person>
335
- </contributor>
336
- <contributor>
337
- <role type="editor"/>
338
- <person>
339
- <name>
340
- <forename>Barney</forename>
341
- <initial>B. X.</initial>
342
- <surname>Rubble</surname>
343
- </name>
344
- <affiliation>
345
- <organization>
346
- <name>Rockhead and Quarry Cave Construction Company</name>
347
- <abbreviation>RQCCC</abbreviation>
348
- <subdivision>Hermeneutics Unit</subdivision>
349
- <subdivision>Exegetical Subunit</subdivision>
350
- <address>
351
- <formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
352
- </address>
353
- </organization>
354
- </affiliation>
355
- <phone>789</phone>
356
- <phone type='fax'>012</phone>
357
- <email>barney@rockhead.example.com</email>
358
- </person>
359
- </contributor>
360
- <contributor>
361
- <role type="publisher"/>
362
- <organization>
363
- <name>Hanna Barbera</name>
364
- </organization>
365
- </contributor>
366
- <contributor>
367
- <role type="publisher"/>
368
- <organization>
369
- <name>Cartoon Network</name>
370
- </organization>
371
- </contributor>
372
- <contributor>
373
- <role type="publisher"/>
374
- <organization>
375
- <name>Ribose, Inc.</name>
376
- </organization>
377
- </contributor>
378
- <edition>2</edition>
379
- <version>
380
- <revision-date>2000-01-01</revision-date>
381
- <draft>3.4</draft>
382
- </version>
383
- <language>en</language>
384
- <script>Latn</script>
385
- <status>
386
- <stage>10</stage>
387
- <substage>20</substage>
388
- <iteration>3</iteration>
389
- </status>
390
- <copyright>
391
- <from>2001</from>
392
- <owner>
393
- <organization>
394
- <name>Ribose, Inc.</name>
395
- </organization>
396
- </owner>
397
- </copyright>
398
- <copyright>
399
- <from>2001</from>
400
- <owner>
401
- <organization>
402
- <name>Hanna Barbera</name>
403
- </organization>
404
- </owner>
405
- </copyright>
406
- <relation type="partOf">
407
- <bibitem>
408
- <title>--</title>
409
- <docidentifier>ABC</docidentifier>
410
- </bibitem>
411
- </relation>
412
- <relation type="translatedFrom">
413
- <bibitem>
414
- <title>GHI</title>
415
- <docidentifier>DEF</docidentifier>
416
- </bibitem>
417
- </relation>
418
- <relation type="translatedFrom">
419
- <bibitem>
420
- <title>PQR</title>
421
- <docidentifier>JKL MNO</docidentifier>
422
- </bibitem>
423
- </relation>
424
- <keyword>a</keyword>
425
- <keyword>b</keyword>
426
- <keyword>c</keyword>
427
- <ext>
428
- <doctype>article</doctype>
429
- <editorialgroup>
430
- <technical-committee number="1" type="A">TC</technical-committee>
431
- <technical-committee number="11" type="A1">TC1</technical-committee>
432
- </editorialgroup>
433
- <ics>
434
- <code>1</code>
435
- </ics>
436
- <ics>
437
- <code>2</code>
438
- </ics>
439
- <ics>
440
- <code>3</code>
441
- </ics>
442
- </ext>
443
- </bibdata>
444
- <sections/>
445
- </standard-document>
257
+ output = <<~OUTPUT
258
+ <?xml version="1.0" encoding="UTF-8"?>
259
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
260
+ <bibdata type="standard">
261
+ <title language="en" format="text/plain">Main Title — Title</title>
262
+ <docidentifier>1000-1</docidentifier>
263
+ <docidentifier type='ISBN'>ISBN-13</docidentifier>
264
+ <docidentifier type='ISBN10'>ISBN-10</docidentifier>
265
+ <docnumber>1000</docnumber>
266
+ <date type="published">
267
+ <on>1000-01-01</on>
268
+ </date>
269
+ <date type="accessed">
270
+ <on>1001-01-01</on>
271
+ </date>
272
+ <date type="created">
273
+ <on>1002-01-01</on>
274
+ </date>
275
+ <date type="implemented">
276
+ <on>1003-01-01</on>
277
+ </date>
278
+ <date type="obsoleted">
279
+ <on>1004-01-01</on>
280
+ </date>
281
+ <date type="confirmed">
282
+ <on>1005-01-01</on>
283
+ </date>
284
+ <date type="updated">
285
+ <on>1006-01-01</on>
286
+ </date>
287
+ <date type="issued">
288
+ <on>1007-01-01</on>
289
+ </date>
290
+ <date type="circulated">
291
+ <on>1008-01-01</on>
292
+ </date>
293
+ <date type="unchanged">
294
+ <on>1009-01-01</on>
295
+ </date>
296
+ <date type='vote-started'>
297
+ <on>1011-01-01</on>
298
+ </date>
299
+ <date type='vote-ended'>
300
+ <on>1012-01-01</on>
301
+ </date>
302
+ <date type="Fred">
303
+ <on>1010-01-01</on>
304
+ </date>
305
+ <date type="Jack">
306
+ <on>1010-01-01</on>
307
+ </date>
308
+ <contributor>
309
+ <role type="author"/>
310
+ <organization>
311
+ <name>Hanna Barbera</name>
312
+ </organization>
313
+ </contributor>
314
+ <contributor>
315
+ <role type="author"/>
316
+ <organization>
317
+ <name>Cartoon Network</name>
318
+ </organization>
319
+ </contributor>
320
+ <contributor>
321
+ <role type="author"/>
322
+ <organization>
323
+ <name>Ribose, Inc.</name>
324
+ </organization>
325
+ </contributor>
326
+ <contributor>
327
+ <role type="author"/>
328
+ <person>
329
+ <name>
330
+ <completename>Fred Flintstone</completename>
331
+ </name>
332
+ <affiliation>
333
+ <organization>
334
+ <name>Slate Rock and Gravel Company</name>
335
+ <abbreviation>SRG</abbreviation>
336
+ <subdivision>Hermeneutics Unit</subdivision>
337
+ <subdivision>Exegetical Subunit</subdivision>
338
+ <address>
339
+ <formattedAddress>
340
+ 6 Rubble Way, Bedrock
341
+ </formattedAddress>
342
+ </address>
343
+ </organization>
344
+ </affiliation>
345
+ <phone>123</phone>
346
+ <phone type='fax'>456</phone>
347
+ <uri>http://slate.example.com</uri>
348
+ </person>
349
+ </contributor>
350
+ <contributor>
351
+ <role type="editor"/>
352
+ <person>
353
+ <name>
354
+ <forename>Barney</forename>
355
+ <initial>B. X.</initial>
356
+ <surname>Rubble</surname>
357
+ </name>
358
+ <affiliation>
359
+ <organization>
360
+ <name>Rockhead and Quarry Cave Construction Company</name>
361
+ <abbreviation>RQCCC</abbreviation>
362
+ <subdivision>Hermeneutics Unit</subdivision>
363
+ <subdivision>Exegetical Subunit</subdivision>
364
+ <address>
365
+ <formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
366
+ </address>
367
+ </organization>
368
+ </affiliation>
369
+ <phone>789</phone>
370
+ <phone type='fax'>012</phone>
371
+ <email>barney@rockhead.example.com</email>
372
+ </person>
373
+ </contributor>
374
+ <contributor>
375
+ <role type="publisher"/>
376
+ <organization>
377
+ <name>Hanna Barbera</name>
378
+ <address>
379
+ <formattedAddress>
380
+ 1 Infinity Loop
381
+ <br/>
382
+ California
383
+ </formattedAddress>
384
+ </address>
385
+ <phone>3333333</phone>
386
+ <phone type='fax'>4444444</phone>
387
+ <email>x@example.com</email>
388
+ <uri>http://www.example.com</uri>
389
+ </organization>
390
+ </contributor>
391
+ <contributor>
392
+ <role type="publisher"/>
393
+ <organization>
394
+ <name>Cartoon Network</name>
395
+ <address>
396
+ <formattedAddress>
397
+ 1 Infinity Loop
398
+ <br/>
399
+ California
400
+ </formattedAddress>
401
+ </address>
402
+ <phone>3333333</phone>
403
+ <phone type='fax'>4444444</phone>
404
+ <email>x@example.com</email>
405
+ <uri>http://www.example.com</uri>
406
+ </organization>
407
+ </contributor>
408
+ <contributor>
409
+ <role type="publisher"/>
410
+ <organization>
411
+ <name>Ribose, Inc.</name>
412
+ <address>
413
+ <formattedAddress>
414
+ 1 Infinity Loop
415
+ <br/>
416
+ California
417
+ </formattedAddress>
418
+ </address>
419
+ <phone>3333333</phone>
420
+ <phone type='fax'>4444444</phone>
421
+ <email>x@example.com</email>
422
+ <uri>http://www.example.com</uri>
423
+ </organization>
424
+ </contributor>
425
+ <edition>2</edition>
426
+ <version>
427
+ <revision-date>2000-01-01</revision-date>
428
+ <draft>3.4</draft>
429
+ </version>
430
+ <language>en</language>
431
+ <script>Latn</script>
432
+ <status>
433
+ <stage>10</stage>
434
+ <substage>20</substage>
435
+ <iteration>3</iteration>
436
+ </status>
437
+ <copyright>
438
+ <from>2001</from>
439
+ <owner>
440
+ <organization>
441
+ <name>Ribose, Inc.</name>
442
+ <address>
443
+ <formattedAddress>
444
+ 1 Infinity Loop
445
+ <br/>
446
+ California
447
+ </formattedAddress>
448
+ </address>
449
+ <phone>3333333</phone>
450
+ <phone type='fax'>4444444</phone>
451
+ <email>x@example.com</email>
452
+ <uri>http://www.example.com</uri>
453
+ </organization>
454
+ </owner>
455
+ </copyright>
456
+ <copyright>
457
+ <from>2001</from>
458
+ <owner>
459
+ <organization>
460
+ <name>Hanna Barbera</name>
461
+ <address>
462
+ <formattedAddress>
463
+ 1 Infinity Loop
464
+ <br/>
465
+ California
466
+ </formattedAddress>
467
+ </address>
468
+ <phone>3333333</phone>
469
+ <phone type='fax'>4444444</phone>
470
+ <email>x@example.com</email>
471
+ <uri>http://www.example.com</uri>
472
+ </organization>
473
+ </owner>
474
+ </copyright>
475
+ <relation type="partOf">
476
+ <bibitem>
477
+ <title>--</title>
478
+ <docidentifier>ABC</docidentifier>
479
+ </bibitem>
480
+ </relation>
481
+ <relation type="translatedFrom">
482
+ <bibitem>
483
+ <title>GHI</title>
484
+ <docidentifier>DEF</docidentifier>
485
+ </bibitem>
486
+ </relation>
487
+ <relation type="translatedFrom">
488
+ <bibitem>
489
+ <title>PQR</title>
490
+ <docidentifier>JKL MNO</docidentifier>
491
+ </bibitem>
492
+ </relation>
493
+ <classification type='a'>b</classification>
494
+ <classification type='default'>c</classification>
495
+ <keyword>a</keyword>
496
+ <keyword>b</keyword>
497
+ <keyword>c</keyword>
498
+ <ext>
499
+ <doctype>article</doctype>
500
+ <editorialgroup>
501
+ <technical-committee number="1" type="A">TC</technical-committee>
502
+ <technical-committee number="11" type="A1">TC1</technical-committee>
503
+ </editorialgroup>
504
+ <ics>
505
+ <code>1</code>
506
+ </ics>
507
+ <ics>
508
+ <code>2</code>
509
+ </ics>
510
+ <ics>
511
+ <code>3</code>
512
+ </ics>
513
+ </ext>
514
+ </bibdata>
515
+ <sections/>
516
+ </standard-document>
446
517
  OUTPUT
518
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
519
+ .to be_equivalent_to xmlpp(output)
447
520
  end
448
521
 
449
522
  it "processes complex metadata" do
450
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
523
+ input = <<~INPUT
451
524
  = Document title
452
525
  Author
453
526
  :docfile: test.adoc
@@ -469,8 +542,22 @@ OUTPUT
469
542
  :relaton-uri: F
470
543
  :title-eo: Dokumenttitolo
471
544
  :doctype: This is a DocType
545
+ :docsubtype: This is a DocSubType
472
546
  :subdivision: Subdivision
473
547
  :subdivision-abbr: SD
548
+ :fullname: Fred Flintstone
549
+ :affiliation: Slate Rock and Gravel Company
550
+ :street: 1 Infinity Loop
551
+ :city: Cupertino
552
+ :state: CA
553
+ :country: USA
554
+ :postcode: 95014
555
+ :fullname_2: Barney Rubble
556
+ :affiliation_2: Slate Rock and Gravel Company
557
+ :street_2: Pavillon de Breteuil
558
+ :city_2: Sèvres CEDEX
559
+ :country_2: France
560
+ :postcode_2: F-92312
474
561
 
475
562
  [abstract]
476
563
  == Abstract
@@ -481,113 +568,227 @@ OUTPUT
481
568
  [language=en]
482
569
  == Clause 1
483
570
  INPUT
484
- <?xml version="1.0" encoding="UTF-8"?>
485
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
486
- <bibdata type="standard">
487
- <title language="en" format="text/plain">Document title</title>
488
- <title language="eo" format="text/plain">Dokumenttitolo</title>
489
- <uri>A</uri>
490
- <uri type="xml">B</uri>
491
- <uri type="html">C</uri>
492
- <uri type="pdf">D</uri>
493
- <uri type="doc">E</uri>
494
- <uri type="relaton">F</uri>
495
- <docidentifier>1000-1-1</docidentifier>
496
- <docnumber>1000</docnumber>
497
- <date type='published'>
498
- <on>1000-01</on>
499
- </date>
500
- <contributor>
501
- <role type="author"/>
502
- <organization>
503
- <name>IEC</name>
504
- </organization>
505
- </contributor>
506
- <contributor>
507
- <role type="author"/>
508
- <organization>
509
- <name>IETF</name>
510
- </organization>
511
- </contributor>
512
- <contributor>
513
- <role type="author"/>
514
- <organization>
515
- <name>ISO</name>
516
- </organization>
517
- </contributor>
518
- <contributor>
519
- <role type="publisher"/>
520
- <organization>
521
- <name>IEC</name>
522
- </organization>
523
- </contributor>
524
- <contributor>
525
- <role type="publisher"/>
526
- <organization>
527
- <name>IETF</name>
528
- </organization>
529
- </contributor>
530
- <contributor>
531
- <role type="publisher"/>
532
- <organization>
533
- <name>ISO</name>
534
- </organization>
535
- </contributor>
536
- <version>
537
- <revision-date>2000-01</revision-date>
538
- </version>
539
- <language>el</language>
540
- <script>Grek</script>
541
- <abstract><p>This is the abstract of the document</p>
542
- <p>This is the second paragraph of the abstract of the document.</p></abstract>
543
- <status><stage>published</stage></status>
544
- <copyright>
545
- <from>#{Date.today.year}</from>
546
- <owner>
547
- <organization>
548
- <name>IEC</name>
549
- </organization>
550
- </owner>
551
- </copyright>
552
- <copyright>
553
- <from>#{Date.today.year}</from>
554
- <owner>
555
- <organization>
556
- <name>IETF</name>
557
- </organization>
558
- </owner>
559
- </copyright>
560
- <copyright>
561
- <from>#{Date.today.year}</from>
562
- <owner>
563
- <organization>
564
- <name>ISO</name>
565
- </organization>
566
- </owner>
567
- </copyright>
568
- <ext>
569
- <doctype>this-is-a-doctype</doctype>
570
- </ext>
571
- </bibdata>
572
- <preface>
573
- <abstract id='_'>
574
- <title>Abstract</title>
575
- <p id='_'>This is the abstract of the document</p>
576
- <p id='_'>This is the second paragraph of the abstract of the document.</p>
577
- </abstract>
578
- </preface>
579
- <sections>
580
- <clause id='_' language='en' inline-header='false' obligation='normative'>
581
- <title>Clause 1</title>
582
- </clause>
583
- </sections>
584
- </standard-document>
571
+ output = <<~OUTPUT
572
+ <?xml version="1.0" encoding="UTF-8"?>
573
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
574
+ <bibdata type="standard">
575
+ <title language="en" format="text/plain">Document title</title>
576
+ <title language="eo" format="text/plain">Dokumenttitolo</title>
577
+ <uri>A</uri>
578
+ <uri type="xml">B</uri>
579
+ <uri type="html">C</uri>
580
+ <uri type="pdf">D</uri>
581
+ <uri type="doc">E</uri>
582
+ <uri type="relaton">F</uri>
583
+ <docidentifier>1000-1-1</docidentifier>
584
+ <docnumber>1000</docnumber>
585
+ <date type='published'>
586
+ <on>1000-01</on>
587
+ </date>
588
+ <contributor>
589
+ <role type="author"/>
590
+ <organization>
591
+ <name>IEC</name>
592
+ </organization>
593
+ </contributor>
594
+ <contributor>
595
+ <role type="author"/>
596
+ <organization>
597
+ <name>IETF</name>
598
+ </organization>
599
+ </contributor>
600
+ <contributor>
601
+ <role type="author"/>
602
+ <organization>
603
+ <name>ISO</name>
604
+ </organization>
605
+ </contributor>
606
+ <contributor>
607
+ <role type='author'/>
608
+ <person>
609
+ <name>
610
+ <completename>Fred Flintstone</completename>
611
+ </name>
612
+ <affiliation>
613
+ <organization>
614
+ <name>Slate Rock and Gravel Company</name>
615
+ <address>
616
+ <street>1 Infinity Loop</street>
617
+ <city>Cupertino</city>
618
+ <state>CA</state>
619
+ <country>USA</country>
620
+ <postcode>95014</postcode>
621
+ </address>
622
+ </organization>
623
+ </affiliation>
624
+ </person>
625
+ </contributor>
626
+ <contributor>
627
+ <role type='author'/>
628
+ <person>
629
+ <name>
630
+ <completename>Barney Rubble</completename>
631
+ </name>
632
+ <affiliation>
633
+ <organization>
634
+ <name>Slate Rock and Gravel Company</name>
635
+ <address>
636
+ <street>Pavillon de Breteuil</street>
637
+ <city>S&#232;vres CEDEX</city>
638
+ <country>France</country>
639
+ <postcode>F-92312</postcode>
640
+ </address>
641
+ </organization>
642
+ </affiliation>
643
+ </person>
644
+ </contributor>
645
+ <contributor>
646
+ <role type="publisher"/>
647
+ <organization>
648
+ <name>IEC</name>
649
+ </organization>
650
+ </contributor>
651
+ <contributor>
652
+ <role type="publisher"/>
653
+ <organization>
654
+ <name>IETF</name>
655
+ </organization>
656
+ </contributor>
657
+ <contributor>
658
+ <role type="publisher"/>
659
+ <organization>
660
+ <name>ISO</name>
661
+ </organization>
662
+ </contributor>
663
+ <version>
664
+ <revision-date>2000-01</revision-date>
665
+ </version>
666
+ <language>el</language>
667
+ <script>Grek</script>
668
+ <abstract><p>This is the abstract of the document</p>
669
+ <p>This is the second paragraph of the abstract of the document.</p></abstract>
670
+ <status><stage>published</stage></status>
671
+ <copyright>
672
+ <from>#{Date.today.year}</from>
673
+ <owner>
674
+ <organization>
675
+ <name>IEC</name>
676
+ </organization>
677
+ </owner>
678
+ </copyright>
679
+ <copyright>
680
+ <from>#{Date.today.year}</from>
681
+ <owner>
682
+ <organization>
683
+ <name>IETF</name>
684
+ </organization>
685
+ </owner>
686
+ </copyright>
687
+ <copyright>
688
+ <from>#{Date.today.year}</from>
689
+ <owner>
690
+ <organization>
691
+ <name>ISO</name>
692
+ </organization>
693
+ </owner>
694
+ </copyright>
695
+ <ext>
696
+ <doctype>this-is-a-doctype</doctype>
697
+ <subdoctype>This is a DocSubType</subdoctype>
698
+ </ext>
699
+ </bibdata>
700
+ <preface>
701
+ <abstract id='_'>
702
+ <title>Abstract</title>
703
+ <p id='_'>This is the abstract of the document</p>
704
+ <p id='_'>This is the second paragraph of the abstract of the document.</p>
705
+ </abstract>
706
+ </preface>
707
+ <sections>
708
+ <clause id='_' language='en' inline-header='false' obligation='normative'>
709
+ <title>Clause 1</title>
710
+ </clause>
711
+ </sections>
712
+ </standard-document>
585
713
  OUTPUT
714
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
715
+ .to be_equivalent_to xmlpp(output)
586
716
  end
587
717
 
588
- it "processes subdivisions" do
589
- mock_default_publisher
590
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
718
+ it "processes formatted address overridding address components" do
719
+ input = <<~INPUT
720
+ = Document title
721
+ Author
722
+ :docfile: test.adoc
723
+ :nodoc:
724
+ :novalid:
725
+ :fullname: Fred Flintstone
726
+ :affiliation: Slate Rock and Gravel Company
727
+ :address: Address
728
+ :city: Utopia
729
+ :fullname_2: Barney Rubble
730
+ :affiliation_2: Slate Rock and Gravel Company
731
+ :city_2: Utopia
732
+
733
+ INPUT
734
+ output = <<~OUTPUT
735
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
736
+ <bibdata type='standard'>
737
+ <title language='en' format='text/plain'>Document title</title>
738
+ <contributor>
739
+ <role type='author'/>
740
+ <person>
741
+ <name>
742
+ <completename>Fred Flintstone</completename>
743
+ </name>
744
+ <affiliation>
745
+ <organization>
746
+ <name>Slate Rock and Gravel Company</name>
747
+ <address>
748
+ <formattedAddress>Address</formattedAddress>
749
+ </address>
750
+ </organization>
751
+ </affiliation>
752
+ </person>
753
+ </contributor>
754
+ <contributor>
755
+ <role type='author'/>
756
+ <person>
757
+ <name>
758
+ <completename>Barney Rubble</completename>
759
+ </name>
760
+ <affiliation>
761
+ <organization>
762
+ <name>Slate Rock and Gravel Company</name>
763
+ <address>
764
+ <city>Utopia</city>
765
+ </address>
766
+ </organization>
767
+ </affiliation>
768
+ </person>
769
+ </contributor>
770
+ <language>en</language>
771
+ <script>Latn</script>
772
+ <status>
773
+ <stage>published</stage>
774
+ </status>
775
+ <copyright>
776
+ <from>2021</from>
777
+ </copyright>
778
+ <ext>
779
+ <doctype>article</doctype>
780
+ </ext>
781
+ </bibdata>
782
+ <sections> </sections>
783
+ </standard-document>
784
+ OUTPUT
785
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
786
+ .to be_equivalent_to xmlpp(output)
787
+ end
788
+
789
+ it "processes subdivisions" do
790
+ mock_default_publisher
791
+ input = <<~INPUT
591
792
  = Document title
592
793
  Author
593
794
  :docfile: test.adoc
@@ -611,82 +812,77 @@ OUTPUT
611
812
  :pub-uri: http://www.example.com
612
813
 
613
814
  INPUT
614
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
615
- <bibdata type='standard'>
616
- <title language='en' format='text/plain'>Document title</title>
617
- <docidentifier>1000-1-1</docidentifier>
618
- <docnumber>1000</docnumber>
619
- <date type='published'>
620
- <on>1000-01</on>
621
- </date>
622
- <contributor>
623
- <role type='author'/>
624
- <organization>
625
- <name>International Standards Organization</name>
626
- <subdivision>Subdivision</subdivision>
627
- <abbreviation>SD</abbreviation>
628
- <address>
629
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
630
- </address>
631
- <phone>3333333</phone>
632
- <phone type='fax'>4444444</phone>
633
- <email>x@example.com</email>
634
- <uri>http://www.example.com</uri>
635
- </organization>
636
- </contributor>
637
- <contributor>
638
- <role type='publisher'/>
639
- <organization>
640
- <name>International Standards Organization</name>
641
- <subdivision>Subdivision</subdivision>
642
- <abbreviation>SD</abbreviation>
643
- <address>
644
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
645
- </address>
646
- <phone>3333333</phone>
647
- <phone type='fax'>4444444</phone>
648
- <email>x@example.com</email>
649
- <uri>http://www.example.com</uri>
650
- </organization>
651
- </contributor>
652
- <version>
653
- <revision-date>2000-01</revision-date>
654
- </version>
655
- <language>el</language>
656
- <script>Grek</script>
657
- <status>
658
- <stage>published</stage>
659
- </status>
660
- <copyright>
661
- <from>#{Time.now.year}</from>
662
- <owner>
663
- <organization>
664
- <name>International Standards Organization</name>
665
- <subdivision>Subdivision</subdivision>
666
- <abbreviation>SD</abbreviation>
667
- <address>
668
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
669
- </address>
670
- <phone>3333333</phone>
671
- <phone type='fax'>4444444</phone>
672
- <email>x@example.com</email>
673
- <uri>http://www.example.com</uri>
674
- </organization>
675
- </owner>
676
- </copyright>
677
- <ext>
678
- <doctype>this-is-a-doctype</doctype>
679
- </ext>
680
- </bibdata>
681
- <sections> </sections>
682
- </standard-document>
683
-
684
- OUTPUT
685
- end
815
+ output = <<~OUTPUT
816
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
817
+ <bibdata type='standard'>
818
+ <title language='en' format='text/plain'>Document title</title>
819
+ <docidentifier>1000-1-1</docidentifier>
820
+ <docnumber>1000</docnumber>
821
+ <date type='published'>
822
+ <on>1000-01</on>
823
+ </date>
824
+ <contributor>
825
+ <role type='author'/>
826
+ <organization>
827
+ <name>International Standards Organization</name>
828
+ <subdivision>Subdivision</subdivision>
829
+ <abbreviation>SD</abbreviation>
830
+ </organization>
831
+ </contributor>
832
+ <contributor>
833
+ <role type='publisher'/>
834
+ <organization>
835
+ <name>International Standards Organization</name>
836
+ <subdivision>Subdivision</subdivision>
837
+ <abbreviation>SD</abbreviation>
838
+ <address>
839
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
840
+ </address>
841
+ <phone>3333333</phone>
842
+ <phone type='fax'>4444444</phone>
843
+ <email>x@example.com</email>
844
+ <uri>http://www.example.com</uri>
845
+ </organization>
846
+ </contributor>
847
+ <version>
848
+ <revision-date>2000-01</revision-date>
849
+ </version>
850
+ <language>el</language>
851
+ <script>Grek</script>
852
+ <status>
853
+ <stage>published</stage>
854
+ </status>
855
+ <copyright>
856
+ <from>#{Time.now.year}</from>
857
+ <owner>
858
+ <organization>
859
+ <name>International Standards Organization</name>
860
+ <subdivision>Subdivision</subdivision>
861
+ <abbreviation>SD</abbreviation>
862
+ <address>
863
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
864
+ </address>
865
+ <phone>3333333</phone>
866
+ <phone type='fax'>4444444</phone>
867
+ <email>x@example.com</email>
868
+ <uri>http://www.example.com</uri>
869
+ </organization>
870
+ </owner>
871
+ </copyright>
872
+ <ext>
873
+ <doctype>this-is-a-doctype</doctype>
874
+ </ext>
875
+ </bibdata>
876
+ <sections> </sections>
877
+ </standard-document>
878
+ OUTPUT
879
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
880
+ .to be_equivalent_to xmlpp(output)
881
+ end
686
882
 
687
883
  it "reads scripts into blank HTML document" do
688
884
  FileUtils.rm_f "test.html"
689
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
885
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
690
886
  = Document title
691
887
  Author
692
888
  :docfile: test.adoc
@@ -699,7 +895,7 @@ OUTPUT
699
895
 
700
896
  it "uses specified fonts and assets in HTML" do
701
897
  FileUtils.rm_f "test.html"
702
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
898
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
703
899
  = Document title
704
900
  Author
705
901
  :docfile: test.adoc
@@ -733,7 +929,7 @@ OUTPUT
733
929
 
734
930
  it "uses specified fonts and assets in Word" do
735
931
  FileUtils.rm_f "test.doc"
736
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
932
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
737
933
  = Document title
738
934
  Author
739
935
  :docfile: test.adoc
@@ -763,7 +959,8 @@ OUTPUT
763
959
  expect(html).to match(%r[an empty word intro page])
764
960
  expect(html).to match(%r[word-override])
765
961
  expect(html).to include('\o "1-3"')
766
- expect(html).to include(%[Content-Location: file:///C:/Doc/test_files/header.html
962
+ expect(html).to include(%[Content-ID: <header.html>
963
+ Content-Disposition: inline; filename="header.html"
767
964
  Content-Transfer-Encoding: base64
768
965
  Content-Type: text/html charset="utf-8"
769
966
 
@@ -774,7 +971,7 @@ QU1FOiB0ZXN0Cgo=
774
971
 
775
972
  it "test submitting-organizations with delimiter in end" do
776
973
  FileUtils.rm_f "test.doc"
777
- Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
974
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
778
975
  = Document title
779
976
  Author
780
977
  :docfile: test.adoc
@@ -787,23 +984,32 @@ QU1FOiB0ZXN0Cgo=
787
984
  expect(File.exist?("test.doc")).to be true
788
985
  end
789
986
 
987
+ it "process mn2pdf attributes" do
988
+ node = Nokogiri::XML("<fake/>").at("fake")
989
+ node["mn2pdf-font-manifest-file"] = "passed/as/font/manifest/to/mn2pdf.jar"
990
+
991
+ options = Asciidoctor::Standoc::Converter
992
+ .new(:standoc, header_footer: true)
993
+ .doc_extract_attributes(node)
994
+
995
+ expect(options.dig(:mn2pdf, :font_manifest_file))
996
+ .to eq(node["mn2pdf-font-manifest-file"])
997
+ end
998
+
790
999
  private
791
1000
 
792
1001
  def mock_org_abbrevs
793
- allow_any_instance_of(::Asciidoctor::Standoc::Front).to receive(:org_abbrev).and_return(
794
- { "International Standards Organization" => "ISO",
795
- "International Electrotechnical Commission" => "IEC" }
796
- )
1002
+ allow_any_instance_of(::Asciidoctor::Standoc::Front)
1003
+ .to receive(:org_abbrev).and_return(
1004
+ { "International Standards Organization" => "ISO",
1005
+ "International Electrotechnical Commission" => "IEC" },
1006
+ )
797
1007
  end
798
1008
 
799
- def mock_default_publisher
800
- allow_any_instance_of(::Asciidoctor::Standoc::Front).to receive(:default_publisher).and_return(
801
- "International Standards Organization"
802
- )
1009
+ def mock_default_publisher
1010
+ allow_any_instance_of(::Asciidoctor::Standoc::Front)
1011
+ .to receive(:default_publisher).and_return(
1012
+ "International Standards Organization",
1013
+ )
803
1014
  end
804
-
805
-
806
1015
  end
807
-
808
-
809
-