metanorma-standoc 1.10.8 → 1.11.2
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.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/asciidoctor/standoc/base.rb +5 -4
- data/lib/asciidoctor/standoc/blocks.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup.rb +20 -11
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
- data/lib/asciidoctor/standoc/cleanup_inline.rb +20 -7
- data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -21
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +54 -79
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +179 -0
- data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
- data/lib/asciidoctor/standoc/converter.rb +2 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
- data/lib/asciidoctor/standoc/inline.rb +20 -16
- data/lib/asciidoctor/standoc/isodoc.rng +254 -27
- data/lib/asciidoctor/standoc/lists.rb +1 -3
- data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
- data/lib/asciidoctor/standoc/macros_terms.rb +49 -5
- data/lib/asciidoctor/standoc/ref.rb +101 -75
- data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
- data/lib/asciidoctor/standoc/ref_sect.rb +42 -24
- data/lib/asciidoctor/standoc/reqt.rb +1 -1
- data/lib/asciidoctor/standoc/section.rb +14 -13
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
- data/lib/asciidoctor/standoc/terms.rb +12 -2
- data/lib/asciidoctor/standoc/utils.rb +36 -23
- data/lib/asciidoctor/standoc/validate.rb +25 -16
- data/lib/isodoc/html/htmlstyle.css +1 -1
- data/lib/isodoc/html/htmlstyle.scss +1 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +3 -3
- data/spec/asciidoctor/base_spec.rb +4 -3
- data/spec/asciidoctor/blocks_spec.rb +202 -21
- data/spec/asciidoctor/cleanup_sections_spec.rb +7 -7
- data/spec/asciidoctor/cleanup_spec.rb +23 -197
- data/spec/asciidoctor/cleanup_terms_spec.rb +1205 -0
- data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
- data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
- data/spec/asciidoctor/inline_spec.rb +7 -7
- data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
- data/spec/asciidoctor/macros_plantuml_spec.rb +36 -1
- data/spec/asciidoctor/macros_spec.rb +189 -112
- data/spec/asciidoctor/refs_dl_spec.rb +4 -4
- data/spec/asciidoctor/refs_spec.rb +860 -522
- data/spec/asciidoctor/section_spec.rb +18 -18
- data/spec/asciidoctor/validate_spec.rb +59 -2
- data/spec/spec_helper.rb +3 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +180 -180
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -65
- metadata +11 -8
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
|
6
|
-
describe
|
7
|
-
context
|
6
|
+
describe "#process" do
|
7
|
+
context "when simple models without relations" do
|
8
8
|
let(:datamodel_file) do
|
9
|
-
examples_path(
|
9
|
+
examples_path("datamodel/address_class_profile.adoc")
|
10
10
|
end
|
11
11
|
let(:result_file) do
|
12
|
-
examples_path(
|
12
|
+
examples_path("datamodel/address_class_profile.xml")
|
13
13
|
end
|
14
14
|
let(:output) do
|
15
15
|
[
|
16
16
|
BLANK_HDR,
|
17
|
-
File.read(fixtures_path(
|
17
|
+
File.read(fixtures_path("macros_datamodel/address_class_profile.xml")),
|
18
18
|
]
|
19
19
|
.join
|
20
20
|
end
|
@@ -27,7 +27,7 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it "correctly renders input" do
|
31
31
|
Asciidoctor.convert_file(datamodel_file,
|
32
32
|
backend: :standoc,
|
33
33
|
safe: :safe,
|
@@ -37,18 +37,18 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
context
|
40
|
+
context "when complex relations" do
|
41
41
|
let(:datamodel_file) do
|
42
|
-
examples_path(
|
42
|
+
examples_path("datamodel/address_component_profile.adoc")
|
43
43
|
end
|
44
44
|
let(:result_file) do
|
45
|
-
examples_path(
|
45
|
+
examples_path("datamodel/address_component_profile.xml")
|
46
46
|
end
|
47
47
|
let(:output) do
|
48
|
-
path = fixtures_path(
|
48
|
+
path = fixtures_path("macros_datamodel/address_component_profile.xml")
|
49
49
|
[
|
50
50
|
BLANK_HDR,
|
51
|
-
File.read(path)
|
51
|
+
File.read(path),
|
52
52
|
]
|
53
53
|
.join("\n")
|
54
54
|
end
|
@@ -56,14 +56,14 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
|
|
56
56
|
after do
|
57
57
|
%w[doc html xml err].each do |extention|
|
58
58
|
path = examples_path(
|
59
|
-
"datamodel/address_component_profile.#{extention}"
|
59
|
+
"datamodel/address_component_profile.#{extention}",
|
60
60
|
)
|
61
61
|
FileUtils.rm_f(path)
|
62
62
|
FileUtils.rm_f("address_component_profile.#{extention}")
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it "correctly renders input" do
|
67
67
|
Asciidoctor.convert_file(datamodel_file,
|
68
68
|
backend: :standoc,
|
69
69
|
safe: :safe,
|
@@ -73,32 +73,32 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
context
|
76
|
+
context "when missing definition" do
|
77
77
|
let(:datamodel_file) do
|
78
|
-
examples_path(
|
78
|
+
examples_path("datamodel/blank_definition_profile.adoc")
|
79
79
|
end
|
80
80
|
let(:result_file) do
|
81
|
-
examples_path(
|
81
|
+
examples_path("datamodel/blank_definition_profile.xml")
|
82
82
|
end
|
83
83
|
let(:output) do
|
84
|
-
path = fixtures_path(
|
84
|
+
path = fixtures_path("macros_datamodel/blank_definition_profile.xml")
|
85
85
|
[
|
86
86
|
BLANK_HDR,
|
87
|
-
File.read(path)
|
87
|
+
File.read(path),
|
88
88
|
].join("\n")
|
89
89
|
end
|
90
90
|
|
91
91
|
after do
|
92
92
|
%w[doc html xml err].each do |extention|
|
93
93
|
path = examples_path(
|
94
|
-
"datamodel/blank_definition_profile.#{extention}"
|
94
|
+
"datamodel/blank_definition_profile.#{extention}",
|
95
95
|
)
|
96
96
|
FileUtils.rm_f(path)
|
97
97
|
FileUtils.rm_f("blank_definition_profile.#{extention}")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
it
|
101
|
+
it "correctly renders input" do
|
102
102
|
Asciidoctor.convert_file(datamodel_file,
|
103
103
|
backend: :standoc,
|
104
104
|
safe: :safe,
|
@@ -1,22 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
|
6
|
-
describe
|
7
|
-
context
|
6
|
+
describe "#process" do
|
7
|
+
context "when simple models without relations" do
|
8
8
|
let(:datamodel_file) do
|
9
|
-
examples_path(
|
9
|
+
examples_path("datamodel/common_models_diagram.adoc")
|
10
10
|
end
|
11
11
|
let(:result_file) do
|
12
|
-
examples_path(
|
12
|
+
examples_path("datamodel/common_models_diagram.xml")
|
13
13
|
end
|
14
14
|
let(:output) do
|
15
15
|
[
|
16
16
|
BLANK_HDR,
|
17
17
|
File.read(
|
18
|
-
fixtures_path(
|
19
|
-
)
|
18
|
+
fixtures_path("macros_datamodel/common_models_diagram.xml"),
|
19
|
+
),
|
20
20
|
].join
|
21
21
|
end
|
22
22
|
|
@@ -26,10 +26,10 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
|
|
26
26
|
FileUtils.rm_f(path)
|
27
27
|
FileUtils.rm_f("common_models_diagram.#{extention}")
|
28
28
|
end
|
29
|
-
FileUtils.rm_rf(
|
29
|
+
FileUtils.rm_rf("common_models_diagram_htmlimages")
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it "correctly renders input" do
|
33
33
|
Asciidoctor.convert_file(datamodel_file,
|
34
34
|
backend: :standoc,
|
35
35
|
safe: :safe,
|
@@ -39,13 +39,13 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
context
|
43
|
-
let(:datamodel_file) { examples_path(
|
44
|
-
let(:result_file) { examples_path(
|
42
|
+
context "when complex relations" do
|
43
|
+
let(:datamodel_file) { examples_path("datamodel/top_down_diagram.adoc") }
|
44
|
+
let(:result_file) { examples_path("datamodel/top_down_diagram.xml") }
|
45
45
|
let(:output) do
|
46
46
|
[
|
47
47
|
BLANK_HDR,
|
48
|
-
File.read(fixtures_path(
|
48
|
+
File.read(fixtures_path("macros_datamodel/top_down_diagram.xml")),
|
49
49
|
].join("\n")
|
50
50
|
end
|
51
51
|
|
@@ -55,11 +55,11 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
|
|
55
55
|
FileUtils.rm_f(path)
|
56
56
|
FileUtils.rm_f("top_down_diagram.#{extention}")
|
57
57
|
end
|
58
|
-
FileUtils.rm_rf(examples_path(
|
59
|
-
FileUtils.rm_rf(
|
58
|
+
FileUtils.rm_rf(examples_path("datamodel/plantuml"))
|
59
|
+
FileUtils.rm_rf("top_down_diagram_htmlimages")
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
62
|
+
it "correctly renders input" do
|
63
63
|
Asciidoctor.convert_file(datamodel_file,
|
64
64
|
backend: :standoc,
|
65
65
|
safe: :safe,
|
@@ -73,8 +73,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
73
73
|
sub<sub><em>scr</em>ipt</sub>
|
74
74
|
<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>
|
75
75
|
mark
|
76
|
-
<admitted>alt</admitted>
|
77
|
-
<deprecates>deprecated</deprecates>
|
76
|
+
<admitted><expression><name>alt</name></expression></admitted>
|
77
|
+
<deprecates><expression><name>deprecated</name></expression></deprecates>
|
78
78
|
<domain>domain</domain>
|
79
79
|
<strike>strike</strike>
|
80
80
|
<underline>underline</underline>
|
@@ -294,9 +294,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
294
294
|
http://example.com[Link]
|
295
295
|
http://example.com[Link,title="tip"]
|
296
296
|
link:++https://asciidoctor.org/now_this__link_works.html++[]
|
297
|
-
http://example.com[Link,
|
297
|
+
http://example.com[Link,update-type=true]
|
298
298
|
link:../example[updatetype=true]
|
299
|
-
link:../example[Link,
|
299
|
+
link:../example[Link,update-type=true]
|
300
300
|
INPUT
|
301
301
|
output = <<~OUTPUT
|
302
302
|
#{BLANK_HDR}
|
@@ -306,9 +306,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
306
306
|
<link target="http://example.com">Link</link>
|
307
307
|
<link target="http://example.com" alt="tip">Link</link>
|
308
308
|
<link target='https://asciidoctor.org/now_this__link_works.html'/>
|
309
|
-
<link target="http://example.com"
|
310
|
-
<link target="../example"
|
311
|
-
<link target="../example"
|
309
|
+
<link target="http://example.com" update-type="true">Link</link>
|
310
|
+
<link target="../example" update-type="true"/>
|
311
|
+
<link target="../example" update-type="true">Link</link></p>
|
312
312
|
</p>
|
313
313
|
</sections>
|
314
314
|
</standard-document>
|
@@ -716,29 +716,25 @@ RSpec.describe Asciidoctor::Standoc do
|
|
716
716
|
|
717
717
|
def mock_isobib_get_123
|
718
718
|
expect(RelatonIso::IsoBibliography).to receive(:get)
|
719
|
-
.with("ISO 123", "2001",
|
720
|
-
{ lang: "en", title: "<em>Standard</em>", usrlbl: nil })
|
719
|
+
.with("ISO 123", "2001", anything)
|
721
720
|
.and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
|
722
721
|
end
|
723
722
|
|
724
723
|
def mock_isobib_get_123_undated
|
725
724
|
expect(RelatonIso::IsoBibliography).to receive(:get)
|
726
|
-
.with("ISO 123", nil,
|
727
|
-
{ lang: "en", title: "<em>Standard</em>", usrlbl: nil })
|
725
|
+
.with("ISO 123", nil, anything)
|
728
726
|
.and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
|
729
727
|
end
|
730
728
|
|
731
729
|
def mock_isobib_get_124
|
732
730
|
expect(RelatonIso::IsoBibliography).to receive(:get)
|
733
|
-
.with("ISO 124", "2014",
|
734
|
-
{ lang: "en", title: "<em>Standard</em>", usrlbl: nil })
|
731
|
+
.with("ISO 124", "2014", anything)
|
735
732
|
.and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
|
736
733
|
end
|
737
734
|
|
738
735
|
def mock_ietfbib_get_123
|
739
736
|
expect(RelatonIetf::IetfBibliography).to receive(:get)
|
740
|
-
.with("RFC 123", nil,
|
741
|
-
{ lang: "en", title: "<em>Standard</em>", usrlbl: nil })
|
737
|
+
.with("RFC 123", nil, anything)
|
742
738
|
.and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
|
743
739
|
end
|
744
740
|
end
|
@@ -64,6 +64,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
64
64
|
:novalid:
|
65
65
|
:no-isobib:
|
66
66
|
:imagesdir: spec/assets
|
67
|
+
:data-uri-image: false
|
67
68
|
|
68
69
|
[plantuml]
|
69
70
|
....
|
@@ -100,6 +101,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
100
101
|
:novalid:
|
101
102
|
:no-isobib:
|
102
103
|
:imagesdir: spec/assets
|
104
|
+
:data-uri-image: false
|
103
105
|
|
104
106
|
[lutaml_diagram]
|
105
107
|
....
|
@@ -135,7 +137,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
135
137
|
end
|
136
138
|
|
137
139
|
context "when inline macro, path supplied as the second arg" do
|
138
|
-
let(:example_file) { fixtures_path(
|
140
|
+
let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
|
139
141
|
let(:input) do
|
140
142
|
<<~TEXT
|
141
143
|
= Document title
|
@@ -145,6 +147,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
145
147
|
:novalid:
|
146
148
|
:no-isobib:
|
147
149
|
:imagesdir: spec/assets
|
150
|
+
:data-uri-image: false
|
148
151
|
|
149
152
|
lutaml_diagram::#{example_file}[]
|
150
153
|
|
@@ -345,6 +348,38 @@ RSpec.describe Asciidoctor::Standoc do
|
|
345
348
|
.to be_equivalent_to xmlpp(output)
|
346
349
|
end
|
347
350
|
|
351
|
+
it "processes the PlantUML macro with mismatched delimiters" do
|
352
|
+
input = <<~INPUT
|
353
|
+
#{ASCIIDOC_BLANK_HDR}
|
354
|
+
|
355
|
+
[plantuml]
|
356
|
+
....
|
357
|
+
@startuml
|
358
|
+
Alice -> Bob: Authentication Request
|
359
|
+
Bob --> Alice: Authentication Response
|
360
|
+
|
361
|
+
Alice -> Bob: Another authentication Request
|
362
|
+
Alice <-- Bob: another authentication Response
|
363
|
+
....
|
364
|
+
INPUT
|
365
|
+
expect { Asciidoctor.convert(input, *OPTIONS) }
|
366
|
+
.to output(%r{@startuml without matching @enduml in PlantUML!}).to_stderr
|
367
|
+
output = <<~OUTPUT
|
368
|
+
#{BLANK_HDR}
|
369
|
+
<sections>
|
370
|
+
<sourcecode id="_" lang="plantuml">@startuml
|
371
|
+
Alice -> Bob: Authentication Request
|
372
|
+
Bob --> Alice: Authentication Response
|
373
|
+
|
374
|
+
Alice -> Bob: Another authentication Request
|
375
|
+
Alice <-- Bob: another authentication Response</sourcecode>
|
376
|
+
</sections>
|
377
|
+
</standard-document>
|
378
|
+
OUTPUT
|
379
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
380
|
+
.to be_equivalent_to xmlpp(output)
|
381
|
+
end
|
382
|
+
|
348
383
|
private
|
349
384
|
|
350
385
|
def mock_plantuml_disabled
|