metanorma-standoc 1.4.4 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -9
  3. data/.github/workflows/ubuntu.yml +1 -5
  4. data/.github/workflows/windows.yml +2 -12
  5. data/.rubocop.yml +1 -1
  6. data/lib/asciidoctor/standoc/base.rb +11 -5
  7. data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +123 -0
  8. data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
  9. data/lib/asciidoctor/standoc/cleanup.rb +32 -12
  10. data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
  11. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -2
  12. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +11 -24
  13. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -3
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +62 -1
  15. data/lib/asciidoctor/standoc/cleanup_ref.rb +10 -7
  16. data/lib/asciidoctor/standoc/cleanup_section.rb +91 -8
  17. data/lib/asciidoctor/standoc/cleanup_terms.rb +12 -2
  18. data/lib/asciidoctor/standoc/converter.rb +3 -3
  19. data/lib/asciidoctor/standoc/front.rb +0 -12
  20. data/lib/asciidoctor/standoc/front_contributor.rb +51 -10
  21. data/lib/asciidoctor/standoc/inline.rb +21 -31
  22. data/lib/asciidoctor/standoc/isodoc.rng +137 -21
  23. data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +44 -0
  24. data/lib/asciidoctor/standoc/log.rb +10 -1
  25. data/lib/asciidoctor/standoc/macros.rb +45 -33
  26. data/lib/asciidoctor/standoc/ref.rb +45 -45
  27. data/lib/asciidoctor/standoc/section.rb +39 -30
  28. data/lib/asciidoctor/standoc/table.rb +3 -2
  29. data/lib/asciidoctor/standoc/utils.rb +18 -1
  30. data/lib/asciidoctor/standoc/validate.rb +30 -18
  31. data/lib/asciidoctor/standoc/validate_section.rb +1 -1
  32. data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
  33. data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +46 -0
  34. data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
  35. data/lib/liquid/custom_filters/values.rb +7 -0
  36. data/lib/metanorma/standoc.rb +0 -5
  37. data/lib/metanorma/standoc/version.rb +20 -1
  38. data/metanorma-standoc.gemspec +4 -5
  39. data/spec/asciidoctor-standoc/base_spec.rb +140 -7
  40. data/spec/asciidoctor-standoc/blocks_spec.rb +275 -149
  41. data/spec/asciidoctor-standoc/cleanup_spec.rb +1372 -56
  42. data/spec/asciidoctor-standoc/inline_spec.rb +133 -6
  43. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +9 -7
  44. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
  45. data/spec/asciidoctor-standoc/macros_spec.rb +43 -23
  46. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +5 -560
  47. data/spec/asciidoctor-standoc/refs_dl_spec.rb +9 -7
  48. data/spec/asciidoctor-standoc/refs_spec.rb +43 -34
  49. data/spec/asciidoctor-standoc/section_spec.rb +42 -39
  50. data/spec/asciidoctor-standoc/table_spec.rb +119 -113
  51. data/spec/asciidoctor-standoc/validate_spec.rb +45 -1
  52. data/spec/assets/i18n.yaml +17 -2
  53. data/spec/examples/codes_table.html +1365 -1365
  54. data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
  55. data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
  56. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
  57. data/spec/metanorma/processor_spec.rb +1 -2
  58. data/spec/spec_helper.rb +110 -109
  59. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +629 -0
  60. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +71 -71
  61. data/spec/vcr_cassettes/isobib_get_123.yml +16 -16
  62. data/spec/vcr_cassettes/isobib_get_123_1.yml +36 -36
  63. data/spec/vcr_cassettes/isobib_get_123_2001.yml +16 -16
  64. data/spec/vcr_cassettes/isobib_get_124.yml +17 -17
  65. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  66. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +39 -37
  67. metadata +29 -14
  68. data/lib/asciidoctor-yaml/i18n-en.yaml +0 -20
  69. data/lib/asciidoctor-yaml/i18n-fr.yaml +0 -13
  70. data/lib/asciidoctor-yaml/i18n-zh-Hans.yaml +0 -15
  71. data/lib/asciidoctor/standoc/i18n.rb +0 -39
  72. data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
  73. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  74. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -2,29 +2,29 @@
2
2
  [yaml2text,<%= model_path %>,definition]
3
3
  ----
4
4
 
5
- === {definition.name || "<%= file_name %>"}
5
+ === {definition.name | default: "<%= file_name %>"}
6
6
  {definition.definition}
7
7
 
8
- {if definition.attributes}
9
- .{definition.name || "<%= file_name %>"} attributes
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&.*,key,EOK}
14
- |{key} |{definition.attributes[key].definition || "TODO: enum " + key.to_s + "'s definition"} |{definition.attributes[key]&.cardinality&.min == 0 ? "O" : "M"} |{definition.attributes[key]&.cardinality&.max == "*" ? "N" : "1"} |{definition.attributes[key].origin ? "<<" + definition.attributes[key].origin.to_s + ">>" : ""}`{definition.attributes[key].type}`
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
- {end}
17
+ {% endif %}
18
18
 
19
- {if definition['values']}
20
- .{definition.name || "<%= file_name %>"} values
19
+ {% if definition['values'] %}
20
+ .{definition.name | default: "<%= file_name %>"} values
21
21
  |===
22
22
  |Name |Definition
23
23
 
24
- {definition['values']&.*,key,EOK}
24
+ {definition['values'].*,key,EOK}
25
25
  |{key} |{definition['values'][key].definition}
26
26
  {EOK}
27
27
  |===
28
- {end}
28
+ {% endif %}
29
29
 
30
30
  ----
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "asciidoctor/standoc/base_structured_text_preprocessor"
4
+
5
+ module Asciidoctor
6
+ module Standoc
7
+ class Yaml2TextPreprocessor < BaseStructuredTextPreprocessor
8
+ # search document for block `yaml2text`
9
+ # after that take template from block and read file into this template
10
+ # example:
11
+ # [yaml2text,foobar.yaml]
12
+ # ----
13
+ # === {item.name}
14
+ # {item.desc}
15
+ #
16
+ # {item.symbol}:: {item.symbol_def}
17
+ # ----
18
+ #
19
+ # with content of `foobar.yaml` file equal to:
20
+ # - name: spaghetti
21
+ # desc: wheat noodles of 9mm diameter
22
+ # symbol: SPAG
23
+ # symbol_def: the situation is message like spaghetti at a kid's
24
+ #
25
+ # will produce:
26
+ # === spaghetti
27
+ # wheat noodles of 9mm diameter
28
+ #
29
+ # SPAG:: the situation is message like spaghetti at a kid's meal
30
+
31
+ def initialize(config = {})
32
+ super
33
+ @config[:block_name] = "yaml2text"
34
+ end
35
+
36
+ protected
37
+
38
+ def content_from_file(document, file_path)
39
+ YAML.safe_load(
40
+ File.read(relative_file_path(document, file_path),
41
+ encoding: "UTF-8"),
42
+ [Date, Time])
43
+ end
44
+ end
45
+ end
46
+ end
@@ -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,7 @@
1
+ module Liquid
2
+ module CustomFilters
3
+ def values(list)
4
+ list.values
5
+ end
6
+ end
7
+ end
@@ -1,11 +1,6 @@
1
1
  require_relative "./standoc/processor"
2
- require_relative "./standoc/requirement"
3
- require_relative "./standoc/latexml_requirement"
4
2
 
5
3
  module Metanorma
6
4
  module Standoc
7
- Requirements = {
8
- latexml: LatexmlRequirement.new
9
- }
10
5
  end
11
6
  end
@@ -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
- VERSION = "1.4.4".freeze
22
+ VERSION = "1.6.0".freeze
4
23
  end
5
24
  end
@@ -28,15 +28,17 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "asciidoctor", "~> 2.0.0"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "isodoc", "~> 1.1.0"
31
+ spec.add_dependency "isodoc", "~> 1.2.0"
32
32
  spec.add_dependency "iev", "~> 0.2.1"
33
- spec.add_dependency "relaton", "~> 1.2.0"
33
+ # relaton-cli not just relaton, to avoid circular reference in metanorma
34
+ spec.add_dependency "relaton-cli", "~> 1.4.0"
34
35
  spec.add_dependency "relaton-iev", "~> 1.0.0"
35
36
  spec.add_dependency "sterile", "~> 1.0.14"
36
37
  spec.add_dependency "concurrent-ruby"
37
38
  spec.add_dependency "unicode2latex", "~> 0.0.1"
38
39
  spec.add_dependency "mimemagic"
39
40
  spec.add_dependency "mathml2asciimath"
41
+ spec.add_dependency "latexmath"
40
42
 
41
43
  spec.add_development_dependency "byebug"
42
44
  spec.add_development_dependency "sassc", "2.4.0"
@@ -50,7 +52,4 @@ Gem::Specification.new do |spec|
50
52
  spec.add_development_dependency "timecop", "~> 0.9"
51
53
  spec.add_development_dependency "vcr", "~> 5.0.0"
52
54
  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
55
  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 default metadata" do
35
+ it "processes publisher abbreviations" do
36
+ mock_org_abbrevs
36
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='1.5.3'>
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
+
128
+ it "processes default metadata" do
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
@@ -102,13 +195,14 @@ RSpec.describe Asciidoctor::Standoc do
102
195
  :email_2: barney@rockhead.example.com
103
196
  :phone_2: 789
104
197
  :fax_2: 012
105
- :publisher: Hanna Barbera, Cartoon Network
198
+ :publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc."
199
+ :copyright-holder: "Ribose, Inc.", Hanna Barbera
106
200
  :part-of: ABC
107
201
  :translated-from: DEF,GHI;JKL MNO,PQR
108
202
  :keywords: a, b, c
109
203
  INPUT
110
204
  <?xml version="1.0" encoding="UTF-8"?>
111
- <standard-document xmlns="https://www.metanorma.org/ns/standoc">
205
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
112
206
  <bibdata type="standard">
113
207
  <title language="en" format="text/plain">Main Title — Title</title>
114
208
  <docidentifier>1000-1</docidentifier>
@@ -155,6 +249,12 @@ RSpec.describe Asciidoctor::Standoc do
155
249
  <date type="Jack">
156
250
  <on>1010-01-01</on>
157
251
  </date>
252
+ <contributor>
253
+ <role type="author"/>
254
+ <organization>
255
+ <name>Ribose, Inc.</name>
256
+ </organization>
257
+ </contributor>
158
258
  <contributor>
159
259
  <role type="author"/>
160
260
  <organization>
@@ -221,6 +321,12 @@ RSpec.describe Asciidoctor::Standoc do
221
321
  <name>Cartoon Network</name>
222
322
  </organization>
223
323
  </contributor>
324
+ <contributor>
325
+ <role type="publisher"/>
326
+ <organization>
327
+ <name>Ribose, Inc.</name>
328
+ </organization>
329
+ </contributor>
224
330
  <edition>2</edition>
225
331
  <version>
226
332
  <revision-date>2000-01-01</revision-date>
@@ -237,7 +343,7 @@ RSpec.describe Asciidoctor::Standoc do
237
343
  <from>2001</from>
238
344
  <owner>
239
345
  <organization>
240
- <name>Hanna Barbera</name>
346
+ <name>Ribose, Inc.</name>
241
347
  </organization>
242
348
  </owner>
243
349
  </copyright>
@@ -245,7 +351,7 @@ RSpec.describe Asciidoctor::Standoc do
245
351
  <from>2001</from>
246
352
  <owner>
247
353
  <organization>
248
- <name>Cartoon Network</name>
354
+ <name>Hanna Barbera</name>
249
355
  </organization>
250
356
  </owner>
251
357
  </copyright>
@@ -314,6 +420,7 @@ RSpec.describe Asciidoctor::Standoc do
314
420
  :doc-uri: E
315
421
  :relaton-uri: F
316
422
  :title-eo: Dokumenttitolo
423
+ :doctype: This is a DocType
317
424
 
318
425
  [abstract]
319
426
  == Abstract
@@ -325,7 +432,7 @@ RSpec.describe Asciidoctor::Standoc do
325
432
  == Clause 1
326
433
  INPUT
327
434
  <?xml version="1.0" encoding="UTF-8"?>
328
- <standard-document xmlns="https://www.metanorma.org/ns/standoc">
435
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
329
436
  <bibdata type="standard">
330
437
  <title language="en" format="text/plain">Document title</title>
331
438
  <title language="eo" format="text/plain">Dokumenttitolo</title>
@@ -409,11 +516,12 @@ RSpec.describe Asciidoctor::Standoc do
409
516
  </owner>
410
517
  </copyright>
411
518
  <ext>
412
- <doctype>article</doctype>
519
+ <doctype>this-is-a-doctype</doctype>
413
520
  </ext>
414
521
  </bibdata>
415
522
  <preface>
416
523
  <abstract id='_'>
524
+ <title>Abstract</title>
417
525
  <p id='_'>This is the abstract of the document</p>
418
526
  <p id='_'>This is the second paragraph of the abstract of the document.</p>
419
527
  </abstract>
@@ -511,6 +619,31 @@ QU1FOiB0ZXN0Cgo=
511
619
  ])
512
620
  end
513
621
 
622
+ it "test submitting-organizations with delimiter in end" do
623
+ FileUtils.rm_f "test.doc"
624
+ Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
625
+ = Document title
626
+ Author
627
+ :docfile: test.adoc
628
+ :doctype: standard
629
+ :encoding: utf-8
630
+ :lang: en
631
+ :submitting-organizations: Organization One; Organization Two;
632
+ :publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc.",
633
+ INPUT
634
+ expect(File.exist?("test.doc")).to be true
635
+ end
636
+
637
+ private
638
+
639
+ def mock_org_abbrevs
640
+ allow_any_instance_of(::Asciidoctor::Standoc::Front).to receive(:org_abbrev).and_return(
641
+ { "International Standards Organization" => "ISO",
642
+ "International Electrotechnical Commission" => "IEC" }
643
+ )
644
+ end
645
+
646
+
514
647
 
515
648
  end
516
649
 
@@ -86,172 +86,149 @@ RSpec.describe Asciidoctor::Standoc do
86
86
 
87
87
  INPUT
88
88
  #{BLANK_HDR}
89
- <sections>
90
- <formula id="ABC" inequality="true" number="3" keep-with-next="true" keep-lines-together="true">
91
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
92
- </formula>
93
-
94
- <formula id="_" unnumbered="true">
95
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
96
- </formula>
97
- <formula id="_" subsequence="A">
98
- <stem type="MathML">
99
- <math xmlns="http://www.w3.org/1998/Math/MathML">
100
- <mrow>
101
- <mi>M</mi>
102
- <mo>=</mo>
103
- <mrow>
104
- <mo>[</mo>
105
- <mtable columnspacing="5pt" displaystyle="true" rowspacing="0pt">
106
- <mtr>
107
- <mtd columnalign="center">
89
+ <sections>
90
+ <formula id='ABC' number='3' keep-with-next='true' keep-lines-together='true' inequality='true'>
91
+ <stem type='MathML'>
92
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
93
+ <mi>r</mi>
94
+ <mo>=</mo>
95
+ <mn>1</mn>
96
+ <mi>%</mi>
97
+ <mi>r</mi>
98
+ <mo>=</mo>
99
+ <mn>1</mn>
100
+ <mi>%</mi>
101
+ </math>
102
+ </stem>
103
+ </formula>
104
+ <formula id='_' unnumbered='true'>
105
+ <stem type='MathML'>
106
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
107
+ <msub>
108
108
  <mrow>
109
- <mo>-</mo>
110
109
  <mrow>
111
- <mi>sin</mi>
112
- <mo>⁡</mo>
113
- <msub>
114
- <mi>λ</mi>
115
- <mn>0</mn>
116
- </msub>
110
+ <mi mathvariant='bold-italic'>F</mi>
117
111
  </mrow>
118
112
  </mrow>
119
- </mtd>
120
- <mtd columnalign="center">
121
113
  <mrow>
122
- <mi>cos</mi>
123
- <mo>⁡</mo>
124
- <msub>
125
- <mi>λ</mi>
126
- <mn>0</mn>
127
- </msub>
128
- </mrow>
129
- </mtd>
130
- <mtd columnalign="center">
131
- <mn>0</mn>
132
- </mtd>
133
- </mtr>
134
- <mtr>
135
- <mtd columnalign="center">
136
- <mrow>
137
- <mo>-</mo>
138
114
  <mrow>
139
- <mrow>
140
- <mi>sin</mi>
141
- <mo>⁡</mo>
115
+ <mi mathvariant='bold-italic'>Α</mi>
116
+ </mrow>
117
+ </mrow>
118
+ </msub>
119
+ </math>
120
+ </stem>
121
+ </formula>
122
+ <formula id='_' subsequence='A'>
123
+ <stem type='MathML'>
124
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
125
+ <mrow>
126
+ <mi>M</mi>
127
+ <mo>=</mo>
128
+ <mo>[</mo>
129
+ <mtable>
130
+ <mtr>
131
+ <mtd>
132
+ <mrow>
133
+ <mo>−</mo>
134
+ <mi>sin</mi>
135
+ </mrow>
136
+ <msub>
137
+ <mi>λ</mi>
138
+ <mn>0</mn>
139
+ </msub>
140
+ </mtd>
141
+ <mtd>
142
+ <mi>cos</mi>
143
+ <msub>
144
+ <mi>λ</mi>
145
+ <mn>0</mn>
146
+ </msub>
147
+ </mtd>
148
+ <mtd>
149
+ <mn>0</mn>
150
+ </mtd>
151
+ </mtr>
152
+ <mtr>
153
+ <mtd>
154
+ <mrow>
155
+ <mo>−</mo>
156
+ <mi>sin</mi>
157
+ </mrow>
142
158
  <msub>
143
159
  <mi>φ</mi>
144
160
  <mn>0</mn>
145
161
  </msub>
146
- </mrow>
147
- <mo>⁢</mo>
148
- <mrow>
149
162
  <mi>cos</mi>
150
- <mo>⁡</mo>
151
163
  <msub>
152
164
  <mi>λ</mi>
153
165
  <mn>0</mn>
154
166
  </msub>
155
- </mrow>
156
- </mrow>
157
- </mrow>
158
- </mtd>
159
- <mtd columnalign="center">
160
- <mrow>
161
- <mo>-</mo>
162
- <mrow>
163
- <mrow>
167
+ </mtd>
168
+ <mtd>
169
+ <mrow>
170
+ <mo>−</mo>
171
+ <mi>sin</mi>
172
+ </mrow>
173
+ <msub>
174
+ <mi>φ</mi>
175
+ <mn>0</mn>
176
+ </msub>
164
177
  <mi>sin</mi>
165
- <mo>⁡</mo>
178
+ <msub>
179
+ <mi>λ</mi>
180
+ <mn>0</mn>
181
+ </msub>
182
+ </mtd>
183
+ <mtd>
184
+ <mi>cos</mi>
185
+ <msub>
186
+ <mi>φ</mi>
187
+ <mn>0</mn>
188
+ </msub>
189
+ </mtd>
190
+ </mtr>
191
+ <mtr>
192
+ <mtd>
193
+ <mi>cos</mi>
194
+ <msub>
195
+ <mi>φ</mi>
196
+ <mn>0</mn>
197
+ </msub>
198
+ <mi>cos</mi>
199
+ <msub>
200
+ <mi>λ</mi>
201
+ <mn>0</mn>
202
+ </msub>
203
+ </mtd>
204
+ <mtd>
205
+ <mi>cos</mi>
166
206
  <msub>
167
207
  <mi>φ</mi>
168
208
  <mn>0</mn>
169
209
  </msub>
170
- </mrow>
171
- <mo>⁢</mo>
172
- <mrow>
173
210
  <mi>sin</mi>
174
- <mo>⁡</mo>
175
211
  <msub>
176
212
  <mi>λ</mi>
177
213
  <mn>0</mn>
178
214
  </msub>
179
- </mrow>
180
- </mrow>
181
- </mrow>
182
- </mtd>
183
- <mtd columnalign="center">
184
- <mrow>
185
- <mi>cos</mi>
186
- <mo>⁡</mo>
187
- <msub>
188
- <mi>φ</mi>
189
- <mn>0</mn>
190
- </msub>
191
- </mrow>
192
- </mtd>
193
- </mtr>
194
- <mtr>
195
- <mtd columnalign="center">
196
- <mrow>
197
- <mrow>
198
- <mi>cos</mi>
199
- <mo>⁡</mo>
200
- <msub>
201
- <mi>φ</mi>
202
- <mn>0</mn>
203
- </msub>
204
- </mrow>
205
- <mo>⁢</mo>
206
- <mrow>
207
- <mi>cos</mi>
208
- <mo>⁡</mo>
209
- <msub>
210
- <mi>λ</mi>
211
- <mn>0</mn>
212
- </msub>
213
- </mrow>
214
- </mrow>
215
- </mtd>
216
- <mtd columnalign="center">
217
- <mrow>
218
- <mrow>
219
- <mi>cos</mi>
220
- <mo>⁡</mo>
221
- <msub>
222
- <mi>φ</mi>
223
- <mn>0</mn>
224
- </msub>
225
- </mrow>
226
- <mo>⁢</mo>
227
- <mrow>
228
- <mi>sin</mi>
229
- <mo>⁡</mo>
230
- <msub>
231
- <mi>λ</mi>
232
- <mn>0</mn>
233
- </msub>
234
- </mrow>
235
- </mrow>
236
- </mtd>
237
- <mtd columnalign="center">
238
- <mrow>
239
- <mi>sin</mi>
240
- <mo>⁡</mo>
241
- <msub>
242
- <mi>φ</mi>
243
- <mn>0</mn>
244
- </msub>
245
- </mrow>
246
- </mtd>
247
- </mtr>
248
- </mtable>
249
- <mo>]</mo>
250
- </mrow>
251
- </mrow>
252
- </math></stem>
253
- </formula>
254
- </sections></standard-document>
215
+ </mtd>
216
+ <mtd>
217
+ <mi>sin</mi>
218
+ <msub>
219
+ <mi>φ</mi>
220
+ <mn>0</mn>
221
+ </msub>
222
+ </mtd>
223
+ </mtr>
224
+ </mtable>
225
+ <mo>]</mo>
226
+ </mrow>
227
+ </math>
228
+ </stem>
229
+ </formula>
230
+ </sections>
231
+ </standard-document>
255
232
  OUTPUT
256
233
  end
257
234
 
@@ -296,7 +273,7 @@ RSpec.describe Asciidoctor::Standoc do
296
273
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
297
274
  ****
298
275
  INPUT
299
- <standard-document xmlns="https://www.metanorma.org/ns/standoc">
276
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
300
277
  <bibdata type="standard">
301
278
  <title language="en" format="text/plain">Document title</title>
302
279
 
@@ -361,6 +338,10 @@ RSpec.describe Asciidoctor::Standoc do
361
338
  #{ASCIIDOC_BLANK_HDR}
362
339
  == Terms and Definitions
363
340
 
341
+ NOTE: This is not a termnote
342
+
343
+ EXAMPLE: This is not a termexample
344
+
364
345
  [.nonterm]
365
346
  === Term1
366
347
 
@@ -371,6 +352,9 @@ RSpec.describe Asciidoctor::Standoc do
371
352
  <terms id="_" obligation="normative">
372
353
  <title>Terms and definitions</title>
373
354
  <p id="_">No terms and definitions are listed in this document.</p>
355
+ <note id='_'>
356
+ <p id='_'>This is not a termnote</p>
357
+ </note>
374
358
  <clause id="_" inline-header="false" obligation="normative">
375
359
  <title>Term1</title>
376
360
  <note id="_">
@@ -397,12 +381,12 @@ RSpec.describe Asciidoctor::Standoc do
397
381
  INPUT
398
382
  #{BLANK_HDR}
399
383
  <sections>
400
- <terms id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
384
+ <terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
401
385
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
402
386
  <term id="_">
403
387
  <preferred>Term1</preferred>
404
388
  </term>
405
- <definitions id="_">
389
+ <definitions id="_" obligation="normative" type="symbols">
406
390
  <title>Symbols</title>
407
391
  <note id="_">
408
392
  <p id="_">This is a note</p>
@@ -598,11 +582,11 @@ RSpec.describe Asciidoctor::Standoc do
598
582
  INPUT
599
583
  #{BLANK_HDR}
600
584
  <sections>
601
- <terms id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
585
+ <terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
602
586
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p><term id="_">
603
587
  <preferred>Term1</preferred>
604
588
  </term>
605
- <definitions id="_">
589
+ <definitions id="_" obligation="normative" type="symbols">
606
590
  <title>Symbols</title>
607
591
  <example id="_">
608
592
  <p id="_">This is an example</p>
@@ -679,7 +663,7 @@ RSpec.describe Asciidoctor::Standoc do
679
663
  INPUT
680
664
  #{BLANK_HDR}
681
665
  <preface><foreword id="_" obligation="informative">
682
- <title>Preamble</title>
666
+ <title>Foreword</title>
683
667
  <p id="_">This is a preamble</p>
684
668
  </foreword></preface><sections>
685
669
  <clause id="_" inline-header="false" obligation="normative">
@@ -1246,9 +1230,16 @@ RSpec.describe Asciidoctor::Standoc do
1246
1230
  <recommendation id="ABC" obligation="permission,recommendation" filename="reqt1.rq"><label>/ogc/recommendation/wfs/2</label><subject>user</subject>
1247
1231
  <classification><tag>control-class</tag><value>Technical</value></classification><classification><tag>priority</tag><value>P0</value></classification><classification><tag>family</tag><value>System &amp; Communications Protection</value></classification><classification><tag>family</tag><value>System and Communications Protocols</value></classification>
1248
1232
  <description><p id="_">I recommend <em>this</em>.</p>
1249
- </description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td align="left">Object</td> <td align="left">Value</td> </tr> <tr> <td align="left">Mission</td> <td align="left">Accomplished</td> </tr> </tbody></table></specification><description>
1233
+ </description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td valign="top" align="left">Object</td> <td valign="top" align="left">Value</td> </tr> <tr> <td valign="top" align="left">Mission</td> <td valign="top" align="left">Accomplished</td> </tr> </tbody></table></specification><description>
1250
1234
  <p id="_">As for the measurement targets,</p>
1251
- </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mi>r</mi><mn>1</mn></mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1235
+ </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1236
+ <mrow>
1237
+ <mi>r</mi>
1238
+ </mrow>
1239
+ <mrow>
1240
+ <mn>1</mn>
1241
+ </mrow>
1242
+ </mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1252
1243
  <verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
1253
1244
  if (success)
1254
1245
  recommendation(label: success-response)
@@ -1261,4 +1252,139 @@ end</sourcecode></verification>
1261
1252
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
1262
1253
  end
1263
1254
 
1255
+ it "processes delete change clauses" do
1256
+ input = <<~"INPUT"
1257
+ #{ASCIIDOC_BLANK_HDR}
1258
+ [change="modify",locality="page=27",path="//table[2]",path_end="//table[2]/following-sibling:example[1]",title="Change"]
1259
+ ==== Change Clause
1260
+ _This table contains information on polygon cells which are not included in ISO 10303-52. Remove table 2 completely and replace with:_
1261
+ INPUT
1262
+ output = <<~"OUTPUT"
1263
+ #{BLANK_HDR}
1264
+ <sections>
1265
+ <clause id='_' inline-header='false' obligation='normative'>
1266
+ <title>Change Clause</title>
1267
+ <amend id='_' change='modify' path='//table[2]' path_end='//table[2]/following-sibling:example[1]' title='Change'>
1268
+ <description>
1269
+ <p id='_'>
1270
+ <em>
1271
+ This table contains information on polygon cells which are not
1272
+ included in ISO 10303-52. Remove table 2 completely and replace
1273
+ with:
1274
+ </em>
1275
+ </p>
1276
+ </description>
1277
+ </amend>
1278
+ </clause>
1279
+ </sections>
1280
+ </standard-document>
1281
+ OUTPUT
1282
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
1283
+
1284
+ end
1285
+
1286
+ it "processes modify change clauses" do
1287
+ input = <<~"INPUT"
1288
+ #{ASCIIDOC_BLANK_HDR}
1289
+ [change="modify",locality="page=27",path="//table[2]",path_end="//table[2]/following-sibling:example[1]",title="Change"]
1290
+ ==== Change Clause
1291
+
1292
+ autonumber:table[2]
1293
+ autonumber:note[7]
1294
+
1295
+ _This table contains information on polygon cells which are not included in ISO 10303-52. Remove table 2 completely and replace with:_
1296
+
1297
+ ____
1298
+ .Edges of triangle and quadrilateral cells
1299
+ |===
1300
+ 2+^.^h| triangle 2+^.^h| quadrilateral
1301
+ ^.^| edge ^.^| vertices ^.^| edge ^.^| vertices
1302
+ ^.^| 1 ^.^| 1, 2 ^.^| 1 ^.^| 1, 2
1303
+ ^.^| 2 ^.^| 2, 3 ^.^| 2 ^.^| 2, 3
1304
+ ^.^| 3 ^.^| 3, 1 ^.^| 3 ^.^| 3, 4
1305
+ | | ^.^| 4 ^.^| 4, 1
1306
+ |===
1307
+
1308
+ ====
1309
+ This is not generalised further.
1310
+ ====
1311
+
1312
+ ____
1313
+
1314
+ Any further exceptions can be ignored.
1315
+ INPUT
1316
+
1317
+ output = <<~"OUTPUT"
1318
+ #{BLANK_HDR}
1319
+ <sections>
1320
+ <clause id='_' inline-header='false' obligation='normative'>
1321
+ <title>Change Clause</title>
1322
+ <amend id='_' change='modify' path='//table[2]' path_end='//table[2]/following-sibling:example[1]' title='Change'>
1323
+ <autonumber type='table'>2</autonumber>
1324
+ <autonumber type='note'>7</autonumber>
1325
+ <description>
1326
+ <p id='_'>
1327
+ <em>
1328
+ This table contains information on polygon cells which are not
1329
+ included in ISO 10303-52. Remove table 2 completely and replace
1330
+ with:
1331
+ </em>
1332
+ </p>
1333
+ </description>
1334
+ <newcontent id='_'>
1335
+ <table id='_'>
1336
+ <name>Edges of triangle and quadrilateral cells</name>
1337
+ <tbody>
1338
+ <tr>
1339
+ <th colspan='2' valign='middle' align='center'>triangle</th>
1340
+ <th colspan='2' valign='middle' align='center'>quadrilateral</th>
1341
+ </tr>
1342
+ <tr>
1343
+ <td valign='middle' align='center'>edge</td>
1344
+ <td valign='middle' align='center'>vertices</td>
1345
+ <td valign='middle' align='center'>edge</td>
1346
+ <td valign='middle' align='center'>vertices</td>
1347
+ </tr>
1348
+ <tr>
1349
+ <td valign='middle' align='center'>1</td>
1350
+ <td valign='middle' align='center'>1, 2</td>
1351
+ <td valign='middle' align='center'>1</td>
1352
+ <td valign='middle' align='center'>1, 2</td>
1353
+ </tr>
1354
+ <tr>
1355
+ <td valign='middle' align='center'>2</td>
1356
+ <td valign='middle' align='center'>2, 3</td>
1357
+ <td valign='middle' align='center'>2</td>
1358
+ <td valign='middle' align='center'>2, 3</td>
1359
+ </tr>
1360
+ <tr>
1361
+ <td valign='middle' align='center'>3</td>
1362
+ <td valign='middle' align='center'>3, 1</td>
1363
+ <td valign='middle' align='center'>3</td>
1364
+ <td valign='middle' align='center'>3, 4</td>
1365
+ </tr>
1366
+ <tr>
1367
+ <td valign='top' align='left'/>
1368
+ <td valign='top' align='left'/>
1369
+ <td valign='middle' align='center'>4</td>
1370
+ <td valign='middle' align='center'>4, 1</td>
1371
+ </tr>
1372
+ </tbody>
1373
+ </table>
1374
+ <example id='_'>
1375
+ <p id='_'>This is not generalised further.</p>
1376
+ </example>
1377
+ </newcontent>
1378
+ <description>
1379
+ <p id='_'>Any further exceptions can be ignored.</p>
1380
+ </description>
1381
+ </amend>
1382
+ </clause>
1383
+ </sections>
1384
+ </standard-document>
1385
+ OUTPUT
1386
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(output)
1387
+ end
1388
+
1389
+
1264
1390
  end