metanorma-standoc 1.11.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -31
- data/.gitignore +23 -0
- data/Gemfile +2 -0
- data/lib/asciidoctor/standoc/base.rb +2 -241
- data/lib/asciidoctor/standoc/blocks.rb +2 -238
- data/lib/asciidoctor/standoc/blocks_notes.rb +2 -100
- data/lib/asciidoctor/standoc/cleanup.rb +2 -207
- data/lib/asciidoctor/standoc/cleanup_amend.rb +2 -53
- data/lib/asciidoctor/standoc/cleanup_block.rb +2 -173
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -204
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +2 -108
- data/lib/asciidoctor/standoc/cleanup_image.rb +2 -69
- data/lib/asciidoctor/standoc/cleanup_inline.rb +2 -179
- data/lib/asciidoctor/standoc/cleanup_maths.rb +2 -221
- data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -169
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +2 -93
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -110
- data/lib/asciidoctor/standoc/cleanup_section.rb +2 -184
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -91
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +2 -47
- data/lib/asciidoctor/standoc/cleanup_table.rb +2 -67
- data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -113
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +2 -161
- data/lib/asciidoctor/standoc/cleanup_text.rb +2 -95
- data/lib/asciidoctor/standoc/cleanup_toc.rb +3 -0
- data/lib/asciidoctor/standoc/cleanup_xref.rb +2 -106
- data/lib/asciidoctor/standoc/converter.rb +2 -123
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +2 -56
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +2 -102
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +3 -404
- data/lib/asciidoctor/standoc/deprecated.rb +5 -0
- data/lib/asciidoctor/standoc/front.rb +2 -219
- data/lib/asciidoctor/standoc/front_contributor.rb +2 -191
- data/lib/asciidoctor/standoc/inline.rb +2 -229
- data/lib/asciidoctor/standoc/lists.rb +2 -119
- data/lib/asciidoctor/standoc/macros.rb +2 -203
- data/lib/asciidoctor/standoc/macros_form.rb +2 -62
- data/lib/asciidoctor/standoc/macros_note.rb +2 -44
- data/lib/asciidoctor/standoc/macros_plantuml.rb +2 -112
- data/lib/asciidoctor/standoc/macros_terms.rb +2 -180
- data/lib/asciidoctor/standoc/ref.rb +2 -225
- data/lib/asciidoctor/standoc/ref_sect.rb +2 -143
- data/lib/asciidoctor/standoc/ref_utility.rb +2 -0
- data/lib/asciidoctor/standoc/render.rb +3 -0
- data/lib/asciidoctor/standoc/reqt.rb +2 -89
- data/lib/asciidoctor/standoc/section.rb +2 -190
- data/lib/asciidoctor/standoc/table.rb +2 -84
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +2 -178
- data/lib/asciidoctor/standoc/terms.rb +2 -153
- data/lib/asciidoctor/standoc/utils.rb +2 -116
- data/lib/asciidoctor/standoc/validate.rb +2 -157
- data/lib/asciidoctor/standoc/validate_section.rb +2 -54
- data/lib/isodoc/html/htmlstyle.css +20 -11
- data/lib/isodoc/html/htmlstyle.scss +11 -11
- data/lib/metanorma/standoc/base.rb +149 -0
- data/lib/{asciidoctor → metanorma}/standoc/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/standoc/biblio.rng +0 -0
- data/lib/metanorma/standoc/blocks.rb +239 -0
- data/lib/metanorma/standoc/blocks_notes.rb +101 -0
- data/lib/metanorma/standoc/cleanup.rb +146 -0
- data/lib/metanorma/standoc/cleanup_amend.rb +54 -0
- data/lib/metanorma/standoc/cleanup_block.rb +173 -0
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +213 -0
- data/lib/metanorma/standoc/cleanup_footnotes.rb +109 -0
- data/lib/metanorma/standoc/cleanup_image.rb +70 -0
- data/lib/metanorma/standoc/cleanup_inline.rb +190 -0
- data/lib/metanorma/standoc/cleanup_maths.rb +222 -0
- data/lib/metanorma/standoc/cleanup_ref.rb +170 -0
- data/lib/metanorma/standoc/cleanup_ref_dl.rb +104 -0
- data/lib/metanorma/standoc/cleanup_reqt.rb +111 -0
- data/lib/metanorma/standoc/cleanup_section.rb +212 -0
- data/lib/metanorma/standoc/cleanup_section_names.rb +92 -0
- data/lib/metanorma/standoc/cleanup_symbols.rb +48 -0
- data/lib/metanorma/standoc/cleanup_table.rb +68 -0
- data/lib/metanorma/standoc/cleanup_terms.rb +140 -0
- data/lib/metanorma/standoc/cleanup_terms_designations.rb +199 -0
- data/lib/metanorma/standoc/cleanup_text.rb +96 -0
- data/lib/metanorma/standoc/cleanup_toc.rb +98 -0
- data/lib/metanorma/standoc/cleanup_xref.rb +107 -0
- data/lib/metanorma/standoc/converter.rb +124 -0
- data/lib/metanorma/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
- data/lib/metanorma/standoc/datamodel/diagram_preprocessor.rb +103 -0
- data/lib/metanorma/standoc/datamodel/plantuml_renderer.rb +409 -0
- data/lib/metanorma/standoc/front.rb +224 -0
- data/lib/metanorma/standoc/front_contributor.rb +192 -0
- data/lib/metanorma/standoc/inline.rb +232 -0
- data/lib/{asciidoctor → metanorma}/standoc/isodoc.rng +90 -18
- data/lib/metanorma/standoc/lists.rb +120 -0
- data/lib/metanorma/standoc/macros.rb +204 -0
- data/lib/metanorma/standoc/macros_form.rb +63 -0
- data/lib/metanorma/standoc/macros_note.rb +45 -0
- data/lib/metanorma/standoc/macros_plantuml.rb +113 -0
- data/lib/metanorma/standoc/macros_terms.rb +181 -0
- data/lib/metanorma/standoc/ref.rb +243 -0
- data/lib/metanorma/standoc/ref_sect.rb +153 -0
- data/lib/metanorma/standoc/ref_utility.rb +129 -0
- data/lib/metanorma/standoc/render.rb +115 -0
- data/lib/metanorma/standoc/reqt.rb +90 -0
- data/lib/{asciidoctor → metanorma}/standoc/reqt.rng +0 -0
- data/lib/metanorma/standoc/section.rb +209 -0
- data/lib/metanorma/standoc/table.rb +85 -0
- data/lib/metanorma/standoc/term_lookup_cleanup.rb +179 -0
- data/lib/metanorma/standoc/terms.rb +160 -0
- data/lib/metanorma/standoc/utils.rb +101 -0
- data/lib/metanorma/standoc/validate.rb +158 -0
- data/lib/metanorma/standoc/validate_section.rb +55 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/model_representation.adoc.erb +0 -0
- data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -0
- data/lib/metanorma-standoc.rb +1 -1
- data/metanorma-standoc.gemspec +4 -4
- data/spec/{asciidoctor → metanorma}/base_spec.rb +73 -8
- data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/blocks_spec.rb +49 -20
- data/spec/{asciidoctor → metanorma}/cleanup_blocks_spec.rb +25 -1
- data/spec/{asciidoctor → metanorma}/cleanup_sections_spec.rb +2 -2
- data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +9 -9
- data/spec/{asciidoctor → metanorma}/cleanup_terms_spec.rb +528 -91
- data/spec/{asciidoctor → metanorma}/datamodel/attributes_table_preprocessor_spec.rb +22 -22
- data/spec/{asciidoctor → metanorma}/datamodel/diagram_preprocessor_spec.rb +17 -17
- data/spec/{asciidoctor → metanorma}/inline_spec.rb +175 -6
- data/spec/{asciidoctor → metanorma}/isobib_cache_spec.rb +5 -9
- data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/macros_json2text_spec.rb +0 -0
- data/spec/{asciidoctor → metanorma}/macros_plantuml_spec.rb +3 -3
- data/spec/{asciidoctor → metanorma}/macros_spec.rb +8 -8
- data/spec/{asciidoctor → metanorma}/macros_yaml2text_spec.rb +0 -0
- data/spec/metanorma/refs_dl_spec.rb +863 -0
- data/spec/{asciidoctor → metanorma}/refs_spec.rb +1277 -687
- data/spec/{asciidoctor → metanorma}/section_spec.rb +90 -3
- data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/validate_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -1
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +179 -179
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +98 -98
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +111 -111
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_124.yml +14 -14
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
- metadata +89 -38
- data/lib/asciidoctor/standoc/ref_date_id.rb +0 -62
- data/spec/asciidoctor/refs_dl_spec.rb +0 -864
data/metanorma-standoc.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
30
|
-
spec.add_dependency "iev", "~> 0.
|
31
|
-
spec.add_dependency "isodoc", "~>
|
30
|
+
spec.add_dependency "iev", "~> 0.3.0"
|
31
|
+
spec.add_dependency "isodoc", "~> 2.0.0"
|
32
32
|
spec.add_dependency "metanorma-plugin-datastruct"
|
33
33
|
spec.add_dependency "metanorma-plugin-lutaml"
|
34
34
|
spec.add_dependency "ruby-jing"
|
@@ -37,12 +37,12 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency "concurrent-ruby"
|
38
38
|
spec.add_dependency "latexmath"
|
39
39
|
spec.add_dependency "mathml2asciimath"
|
40
|
-
spec.add_dependency "metanorma-utils", "~> 1.2.
|
40
|
+
spec.add_dependency "metanorma-utils", "~> 1.2.8"
|
41
41
|
spec.add_dependency "relaton-cli", "~> 1.9.0"
|
42
42
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
43
43
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
44
44
|
|
45
|
-
spec.add_development_dependency "
|
45
|
+
spec.add_development_dependency "debug"
|
46
46
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
47
47
|
spec.add_development_dependency "guard", "~> 2.14"
|
48
48
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "fileutils"
|
3
3
|
|
4
|
-
RSpec.describe
|
4
|
+
RSpec.describe Metanorma::Standoc do
|
5
5
|
it "has a version number" do
|
6
6
|
expect(Metanorma::Standoc::VERSION).not_to be nil
|
7
7
|
end
|
@@ -26,7 +26,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
26
26
|
<stage>published</stage>
|
27
27
|
</status>
|
28
28
|
<copyright>
|
29
|
-
<from
|
29
|
+
<from>#{Time.now.year}</from>
|
30
30
|
</copyright>
|
31
31
|
<ext>
|
32
32
|
<doctype>article</doctype>
|
@@ -222,6 +222,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
222
222
|
:isbn: ISBN-13
|
223
223
|
:isbn10: ISBN-10
|
224
224
|
:classification: a:b, c
|
225
|
+
:toclevels: 2
|
226
|
+
:doctoclevels: 3
|
227
|
+
:htmltoclevels: 4
|
225
228
|
INPUT
|
226
229
|
output = <<~OUTPUT
|
227
230
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -481,6 +484,20 @@ RSpec.describe Asciidoctor::Standoc do
|
|
481
484
|
</ics>
|
482
485
|
</ext>
|
483
486
|
</bibdata>
|
487
|
+
<misc-container>
|
488
|
+
<presentation-metadata>
|
489
|
+
<name>TOC Heading Levels</name>
|
490
|
+
<value>2</value>
|
491
|
+
</presentation-metadata>
|
492
|
+
<presentation-metadata>
|
493
|
+
<name>TOC Heading Levels</name>
|
494
|
+
<value>2</value>
|
495
|
+
</presentation-metadata>
|
496
|
+
<presentation-metadata>
|
497
|
+
<name>TOC Heading Levels</name>
|
498
|
+
<value>2</value>
|
499
|
+
</presentation-metadata>
|
500
|
+
</misc-container>
|
484
501
|
<sections/>
|
485
502
|
</standard-document>
|
486
503
|
OUTPUT
|
@@ -742,7 +759,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
742
759
|
<stage>published</stage>
|
743
760
|
</status>
|
744
761
|
<copyright>
|
745
|
-
<from
|
762
|
+
<from>#{Time.now.year}</from>
|
746
763
|
</copyright>
|
747
764
|
<ext>
|
748
765
|
<doctype>article</doctype>
|
@@ -849,6 +866,47 @@ RSpec.describe Asciidoctor::Standoc do
|
|
849
866
|
.to be_equivalent_to xmlpp(output)
|
850
867
|
end
|
851
868
|
|
869
|
+
it "processes document relations by description" do
|
870
|
+
mock_relaton_relation_descriptions
|
871
|
+
input = <<~INPUT
|
872
|
+
= Document title
|
873
|
+
Author
|
874
|
+
:docfile: test.adoc
|
875
|
+
:nodoc:
|
876
|
+
:novalid:
|
877
|
+
:normatively-cited-in: ABC
|
878
|
+
|
879
|
+
INPUT
|
880
|
+
output = <<~OUTPUT
|
881
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
882
|
+
<bibdata type='standard'>
|
883
|
+
<title language='en' format='text/plain'>Document title</title>
|
884
|
+
<language>en</language>
|
885
|
+
<script>Latn</script>
|
886
|
+
<status>
|
887
|
+
<stage>published</stage>
|
888
|
+
</status>
|
889
|
+
<copyright>
|
890
|
+
<from>#{Time.now.year}</from>
|
891
|
+
</copyright>
|
892
|
+
<relation type='isCitedIn'>
|
893
|
+
<description>normatively cited in</description>
|
894
|
+
<bibitem>
|
895
|
+
<title>--</title>
|
896
|
+
<docidentifier>ABC</docidentifier>
|
897
|
+
</bibitem>
|
898
|
+
</relation>
|
899
|
+
<ext>
|
900
|
+
<doctype>article</doctype>
|
901
|
+
</ext>
|
902
|
+
</bibdata>
|
903
|
+
<sections> </sections>
|
904
|
+
</standard-document>
|
905
|
+
OUTPUT
|
906
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
907
|
+
.to be_equivalent_to xmlpp(output)
|
908
|
+
end
|
909
|
+
|
852
910
|
it "reads scripts into blank HTML document" do
|
853
911
|
FileUtils.rm_f "test.html"
|
854
912
|
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
@@ -959,21 +1017,21 @@ QU1FOiB0ZXN0Cgo=
|
|
959
1017
|
|
960
1018
|
it "process mn2pdf attributes" do
|
961
1019
|
node = Nokogiri::XML("<fake/>").at("fake")
|
962
|
-
node[
|
1020
|
+
node[Metanorma::Standoc::Base::FONTS_MANIFEST] =
|
963
1021
|
"passed/as/font/manifest/to/mn2pdf.jar"
|
964
1022
|
|
965
|
-
options =
|
1023
|
+
options = Metanorma::Standoc::Converter
|
966
1024
|
.new(:standoc, header_footer: true)
|
967
1025
|
.doc_extract_attributes(node)
|
968
1026
|
|
969
1027
|
expect(options.dig(:mn2pdf, :font_manifest))
|
970
|
-
.to eq(node[
|
1028
|
+
.to eq(node[Metanorma::Standoc::Base::FONTS_MANIFEST])
|
971
1029
|
end
|
972
1030
|
|
973
1031
|
private
|
974
1032
|
|
975
1033
|
def mock_org_abbrevs
|
976
|
-
allow_any_instance_of(::
|
1034
|
+
allow_any_instance_of(::Metanorma::Standoc::Front)
|
977
1035
|
.to receive(:org_abbrev).and_return(
|
978
1036
|
{ "International Standards Organization" => "ISO",
|
979
1037
|
"International Electrotechnical Commission" => "IEC" },
|
@@ -981,9 +1039,16 @@ QU1FOiB0ZXN0Cgo=
|
|
981
1039
|
end
|
982
1040
|
|
983
1041
|
def mock_default_publisher
|
984
|
-
allow_any_instance_of(::
|
1042
|
+
allow_any_instance_of(::Metanorma::Standoc::Front)
|
985
1043
|
.to receive(:default_publisher).and_return(
|
986
1044
|
"International Standards Organization",
|
987
1045
|
)
|
988
1046
|
end
|
1047
|
+
|
1048
|
+
def mock_relaton_relation_descriptions
|
1049
|
+
allow_any_instance_of(::Metanorma::Standoc::Front)
|
1050
|
+
.to receive(:relaton_relation_descriptions).and_return(
|
1051
|
+
"normatively-cited-in" => "isCitedIn",
|
1052
|
+
)
|
1053
|
+
end
|
989
1054
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "open3"
|
3
3
|
|
4
|
-
RSpec.describe
|
4
|
+
RSpec.describe Metanorma::Standoc do
|
5
5
|
it "processes format-specific pass blocks" do
|
6
6
|
input = <<~INPUT
|
7
7
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -355,7 +355,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
355
355
|
<term id='term-term1'>
|
356
356
|
<preferred><expression><name>Term1</name></expression></preferred>
|
357
357
|
<definition>
|
358
|
-
<
|
358
|
+
<verbal-definition>
|
359
359
|
<p id='_'>first definition</p>
|
360
360
|
<termsource status='identical' type="authoritative">
|
361
361
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
@@ -366,10 +366,10 @@ RSpec.describe Asciidoctor::Standoc do
|
|
366
366
|
</localityStack>
|
367
367
|
</origin>
|
368
368
|
</termsource>
|
369
|
-
</
|
369
|
+
</verbal-definition>
|
370
370
|
</definition>
|
371
371
|
<definition>
|
372
|
-
<
|
372
|
+
<verbal-definition>
|
373
373
|
<p id='_'>second definition</p>
|
374
374
|
<termsource status='identical' type="authoritative">
|
375
375
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
@@ -380,7 +380,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
380
380
|
</localityStack>
|
381
381
|
</origin>
|
382
382
|
</termsource>
|
383
|
-
</
|
383
|
+
</verbal-definition>
|
384
384
|
</definition>
|
385
385
|
<termnote id='_'>
|
386
386
|
<p id='_'>This is a note</p>
|
@@ -550,9 +550,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
550
550
|
</expression>
|
551
551
|
</preferred>
|
552
552
|
<definition>
|
553
|
-
<
|
553
|
+
<verbal-definition>
|
554
554
|
<p id='_'>definition2</p>
|
555
|
-
</
|
555
|
+
</verbal-definition>
|
556
556
|
</definition>
|
557
557
|
<termnote id='_'>
|
558
558
|
<p id='_'>Note 2</p>
|
@@ -1254,7 +1254,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1254
1254
|
the following terms and definitions apply.</p>
|
1255
1255
|
<term id="term-term1">
|
1256
1256
|
<preferred><expression><name>Term1</name></expression></preferred>
|
1257
|
-
<definition><
|
1257
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1258
1258
|
<termsource status="identical" type="authoritative">
|
1259
1259
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1260
1260
|
<localityStack>
|
@@ -1273,9 +1273,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1273
1273
|
<term id='term-term2'>
|
1274
1274
|
<preferred><expression><name>Term2</name></expression></preferred>
|
1275
1275
|
<definition>
|
1276
|
-
<
|
1276
|
+
<verbal-definition>
|
1277
1277
|
<p id='_'>Definition</p>
|
1278
|
-
</
|
1278
|
+
</verbal-definition>
|
1279
1279
|
</definition>
|
1280
1280
|
<termsource status='identical' type="authoritative">
|
1281
1281
|
<origin citeas=''>
|
@@ -1329,7 +1329,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1329
1329
|
the following terms and definitions apply.</p>
|
1330
1330
|
<term id="term-term1">
|
1331
1331
|
<preferred><expression><name>Term1</name></expression></preferred>
|
1332
|
-
<definition><
|
1332
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1333
1333
|
<termsource status="modified" type="authoritative">
|
1334
1334
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1335
1335
|
<localityStack>
|
@@ -1343,9 +1343,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1343
1343
|
</term>
|
1344
1344
|
<term id='term-term2'>
|
1345
1345
|
<preferred><expression><name>Term2</name></expression></preferred>
|
1346
|
-
<definition><
|
1346
|
+
<definition><verbal-definition>
|
1347
1347
|
<p id='_'>Definition</p>
|
1348
|
-
</
|
1348
|
+
</verbal-definition></definition>
|
1349
1349
|
<termsource status='modified' type="authoritative">
|
1350
1350
|
<origin citeas=''>
|
1351
1351
|
<termref base='IEV' target='xyz'/>
|
@@ -1395,7 +1395,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1395
1395
|
<name>Term1</name>
|
1396
1396
|
</expression>
|
1397
1397
|
</preferred>
|
1398
|
-
<definition><
|
1398
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1399
1399
|
<termsource status='generalisation' type='authoritative'>
|
1400
1400
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
1401
1401
|
<localityStack>
|
@@ -1415,9 +1415,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1415
1415
|
<name>Term2</name>
|
1416
1416
|
</expression>
|
1417
1417
|
</preferred>
|
1418
|
-
<definition><
|
1418
|
+
<definition><verbal-definition>
|
1419
1419
|
<p id='_'>Definition</p>
|
1420
|
-
</
|
1420
|
+
</verbal-definition></definition>
|
1421
1421
|
<termsource status='modified' type='lineage'>
|
1422
1422
|
<origin citeas=''>
|
1423
1423
|
<termref base='IEV' target='xyz'/>
|
@@ -1444,7 +1444,7 @@ OUTPUT
|
|
1444
1444
|
====
|
1445
1445
|
INPUT
|
1446
1446
|
output = <<~"OUTPUT"
|
1447
|
-
|
1447
|
+
#{BLANK_HDR}
|
1448
1448
|
<sections>
|
1449
1449
|
<recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
|
1450
1450
|
<label>/ogc/recommendation/wfs/2</label>
|
@@ -1452,7 +1452,8 @@ OUTPUT
|
|
1452
1452
|
<subject>developer, implementer</subject>
|
1453
1453
|
<inherit>/ss/584/2015/level/1</inherit>
|
1454
1454
|
<inherit>/ss/584/2015/level/2</inherit>
|
1455
|
-
<description><p id="_">I recommend this</p
|
1455
|
+
<description><p id="_">I recommend this</p>
|
1456
|
+
</description>
|
1456
1457
|
</recommendation>
|
1457
1458
|
</sections>
|
1458
1459
|
</standard-document>
|
@@ -1470,6 +1471,9 @@ OUTPUT
|
|
1470
1471
|
.Title
|
1471
1472
|
====
|
1472
1473
|
I recommend this
|
1474
|
+
|
1475
|
+
. http://www.example.com[]
|
1476
|
+
. <<ABC>>
|
1473
1477
|
====
|
1474
1478
|
INPUT
|
1475
1479
|
output = <<~OUTPUT
|
@@ -1478,7 +1482,20 @@ OUTPUT
|
|
1478
1482
|
<requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1479
1483
|
<title>Title</title>
|
1480
1484
|
<inherit>/ss/584/2015/level/1 & /ss/584/2015/level/2</inherit>
|
1481
|
-
<description><p id="_">I recommend this</p
|
1485
|
+
<description><p id="_">I recommend this</p>
|
1486
|
+
<ol id='_' type='arabic'>
|
1487
|
+
<li>
|
1488
|
+
<p id='_'>
|
1489
|
+
<link target='http://www.example.com'/>
|
1490
|
+
</p>
|
1491
|
+
</li>
|
1492
|
+
<li>
|
1493
|
+
<p id='_'>
|
1494
|
+
<xref target='ABC'/>
|
1495
|
+
</p>
|
1496
|
+
</li>
|
1497
|
+
</ol>
|
1498
|
+
</description>
|
1482
1499
|
</requirement>
|
1483
1500
|
</sections>
|
1484
1501
|
</standard-document>
|
@@ -1526,6 +1543,9 @@ OUTPUT
|
|
1526
1543
|
[.permission]
|
1527
1544
|
=====
|
1528
1545
|
I also permit this
|
1546
|
+
|
1547
|
+
. List
|
1548
|
+
. List
|
1529
1549
|
=====
|
1530
1550
|
|
1531
1551
|
[requirement,type="general",label="/req/core/quantities-uom"]
|
@@ -1541,7 +1561,16 @@ OUTPUT
|
|
1541
1561
|
<p id="_">Example 2</p>
|
1542
1562
|
</example></description>
|
1543
1563
|
<permission id="_">
|
1544
|
-
<description><p id="_">I also permit this</p
|
1564
|
+
<description><p id="_">I also permit this</p>
|
1565
|
+
<ol id='_' type='arabic'>
|
1566
|
+
<li>
|
1567
|
+
<p id='_'>List</p>
|
1568
|
+
</li>
|
1569
|
+
<li>
|
1570
|
+
<p id='_'>List</p>
|
1571
|
+
</li>
|
1572
|
+
</ol>
|
1573
|
+
</description>
|
1545
1574
|
</permission>
|
1546
1575
|
<requirement id='_' type='general'>
|
1547
1576
|
<label>/req/core/quantities-uom</label>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "fileutils"
|
3
3
|
|
4
|
-
RSpec.describe
|
4
|
+
RSpec.describe Metanorma::Standoc do
|
5
5
|
it "processes svgmap" do
|
6
6
|
FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
|
7
7
|
"action_schemaexpg1.svg"
|
@@ -1015,4 +1015,28 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1015
1015
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1016
1016
|
.to be_equivalent_to xmlpp(output)
|
1017
1017
|
end
|
1018
|
+
|
1019
|
+
it "updates anchor reference along with anchor to match content" do
|
1020
|
+
input = <<~INPUT
|
1021
|
+
#{ASCIIDOC_BLANK_HDR}
|
1022
|
+
|
1023
|
+
[[samplecode]]
|
1024
|
+
.Sample Code
|
1025
|
+
====
|
1026
|
+
|
1027
|
+
[source,ruby]
|
1028
|
+
--
|
1029
|
+
puts "Hello, world."
|
1030
|
+
%w{a b c}.each do |x| <1>
|
1031
|
+
puts x
|
1032
|
+
end
|
1033
|
+
--
|
1034
|
+
<1> This is an annotation
|
1035
|
+
====
|
1036
|
+
INPUT
|
1037
|
+
output = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
|
1038
|
+
callout_id = output.at("//xmlns:callout/@target").text
|
1039
|
+
annotation_id = output.at("//xmlns:annotation/@id").text
|
1040
|
+
expect(callout_id).to eq(annotation_id)
|
1041
|
+
end
|
1018
1042
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
require "relaton_iec"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Metanorma::Standoc do
|
6
6
|
it "appends any initial user-supplied text to boilerplate in terms and definitions" do
|
7
7
|
input = <<~INPUT
|
8
8
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -29,7 +29,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
29
29
|
</ul>
|
30
30
|
<term id="term-time">
|
31
31
|
<preferred><expression><name>Time</name></expression></preferred>
|
32
|
-
<definition><
|
32
|
+
<definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
|
33
33
|
</term></terms>
|
34
34
|
</sections>
|
35
35
|
</standard-document>
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
require "relaton_iec"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Metanorma::Standoc do
|
6
6
|
it "applies smartquotes by default" do
|
7
7
|
input = <<~INPUT
|
8
8
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -426,7 +426,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
426
426
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
427
427
|
<term id="term-term1">
|
428
428
|
<preferred><expression><name>Term1</name></expression></preferred>
|
429
|
-
<definition><
|
429
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
430
430
|
<termsource status="identical" type="authoritative">
|
431
431
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
432
432
|
<localityStack>
|
@@ -545,7 +545,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
545
545
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
546
546
|
<term id="term-automation1">
|
547
547
|
<preferred><expression><name>Automation1</name></expression></preferred>
|
548
|
-
<definition><
|
548
|
+
<definition><verbal-definition><p id='_'>Definition 1</p></verbal-definition></definition>
|
549
549
|
<termsource status="identical" type="authoritative">
|
550
550
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
551
551
|
<localityStack>
|
@@ -556,7 +556,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
556
556
|
</term>
|
557
557
|
<term id="term-automation2">
|
558
558
|
<preferred><expression><name>Automation2</name></expression></preferred>
|
559
|
-
<definition><
|
559
|
+
<definition><verbal-definition><p id='_'>Definition 2</p></verbal-definition></definition>
|
560
560
|
<termsource status="identical" type="authoritative">
|
561
561
|
<origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
|
562
562
|
<localityStack>
|
@@ -567,7 +567,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
567
567
|
</term>
|
568
568
|
<term id="term-automation3">
|
569
569
|
<preferred><expression><name>Automation3</name></expression></preferred>
|
570
|
-
<definition><
|
570
|
+
<definition><verbal-definition><p id='_'>Definition 3</p></verbal-definition></definition>
|
571
571
|
<termsource status="identical" type="authoritative">
|
572
572
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
573
573
|
<localityStack>
|
@@ -778,7 +778,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
778
778
|
</sections>
|
779
779
|
</standard-document>
|
780
780
|
OUTPUT
|
781
|
-
expect(
|
781
|
+
expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
|
782
782
|
.cleanup(Nokogiri::XML(input)).to_xml)
|
783
783
|
.to be_equivalent_to xmlpp(output)
|
784
784
|
end
|
@@ -836,7 +836,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
836
836
|
</bibliography>
|
837
837
|
</standard-document>
|
838
838
|
OUTPUT
|
839
|
-
expect(
|
839
|
+
expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
|
840
840
|
.cleanup(Nokogiri::XML(input)).to_xml)
|
841
841
|
.to be_equivalent_to xmlpp(output)
|
842
842
|
end
|
@@ -1822,7 +1822,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1822
1822
|
<stage>published</stage>
|
1823
1823
|
</status>
|
1824
1824
|
<copyright>
|
1825
|
-
<from
|
1825
|
+
<from>#{Time.now.year}</from>
|
1826
1826
|
</copyright>
|
1827
1827
|
<ext>
|
1828
1828
|
<doctype>article</doctype>
|
@@ -1865,7 +1865,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1865
1865
|
private
|
1866
1866
|
|
1867
1867
|
def mock_mathml_italicise(string)
|
1868
|
-
allow_any_instance_of(::
|
1868
|
+
allow_any_instance_of(::Metanorma::Standoc::Cleanup)
|
1869
1869
|
.to receive(:mathml_mi_italics).and_return(string)
|
1870
1870
|
end
|
1871
1871
|
|