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
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Metanorma::Standoc do
|
4
4
|
it "processes sections" do
|
5
5
|
input = <<~INPUT
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -686,6 +686,36 @@ RSpec.describe Asciidoctor::Standoc do
|
|
686
686
|
.to be_equivalent_to xmlpp(output)
|
687
687
|
end
|
688
688
|
|
689
|
+
it "tag and multilingual processing attributes on term" do
|
690
|
+
input = <<~INPUT
|
691
|
+
#{ASCIIDOC_BLANK_HDR}
|
692
|
+
[heading="terms, definitions, symbols and abbreviated terms"]
|
693
|
+
== Terms, Definitions, Symbols Section
|
694
|
+
|
695
|
+
[language=en,tag=x123,multilingual-rendering=all-columns]
|
696
|
+
=== Term
|
697
|
+
INPUT
|
698
|
+
output = <<~OUTPUT
|
699
|
+
#{BLANK_HDR}
|
700
|
+
<sections>
|
701
|
+
<terms id='_' obligation='normative'>
|
702
|
+
<title>Terms and definitions</title>
|
703
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
704
|
+
<term id='term-term' language='en' tag='x123' multilingual-rendering='all-columns'>
|
705
|
+
<preferred>
|
706
|
+
<expression>
|
707
|
+
<name>Term</name>
|
708
|
+
</expression>
|
709
|
+
</preferred>
|
710
|
+
</term>
|
711
|
+
</terms>
|
712
|
+
</sections>
|
713
|
+
</standard-document>
|
714
|
+
OUTPUT
|
715
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
716
|
+
.to be_equivalent_to xmlpp(output)
|
717
|
+
end
|
718
|
+
|
689
719
|
it "varies terms & symbols title" do
|
690
720
|
input = <<~INPUT
|
691
721
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -1137,7 +1167,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1137
1167
|
<title>Basic concepts</title>
|
1138
1168
|
<term id='term-date'>
|
1139
1169
|
<preferred><expression><name>date</name></expression></preferred>
|
1140
|
-
<definition><
|
1170
|
+
<definition><verbal-definition>
|
1141
1171
|
<p id='_'>
|
1142
1172
|
<em>time</em>
|
1143
1173
|
(
|
@@ -1152,7 +1182,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1152
1182
|
<xref target='term-time-scale'/>
|
1153
1183
|
)
|
1154
1184
|
</p>
|
1155
|
-
</
|
1185
|
+
</verbal-definition></definition>
|
1156
1186
|
</term>
|
1157
1187
|
</terms>
|
1158
1188
|
</clause>
|
@@ -1230,4 +1260,61 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1230
1260
|
.to be_equivalent_to xmlpp(output)
|
1231
1261
|
end
|
1232
1262
|
|
1263
|
+
it "handles floating titles" do
|
1264
|
+
input = <<~INPUT
|
1265
|
+
#{ASCIIDOC_BLANK_HDR}
|
1266
|
+
|
1267
|
+
ABC
|
1268
|
+
|
1269
|
+
[discrete]
|
1270
|
+
== I am a top-level _floating_ title
|
1271
|
+
|
1272
|
+
== Clause 1
|
1273
|
+
|
1274
|
+
[discrete]
|
1275
|
+
=== I am a _floating_ title
|
1276
|
+
|
1277
|
+
=== Clause 1.2
|
1278
|
+
|
1279
|
+
[discrete]
|
1280
|
+
== Another top-level floating title
|
1281
|
+
|
1282
|
+
== Clause 2
|
1283
|
+
|
1284
|
+
INPUT
|
1285
|
+
output = <<~OUTPUT
|
1286
|
+
#{BLANK_HDR}
|
1287
|
+
<preface>
|
1288
|
+
<foreword id='_' obligation='informative'>
|
1289
|
+
<title>Foreword</title>
|
1290
|
+
<p id='_'>ABC</p>
|
1291
|
+
</foreword>
|
1292
|
+
</preface>
|
1293
|
+
<sections>
|
1294
|
+
<floating-title id='_' depth='1' type='floating-title'>
|
1295
|
+
I am a top-level
|
1296
|
+
<em>floating</em>
|
1297
|
+
title
|
1298
|
+
</floating-title>
|
1299
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1300
|
+
<title>Clause 1</title>
|
1301
|
+
<floating-title id='_' depth='2' type='floating-title'>
|
1302
|
+
I am a
|
1303
|
+
<em>floating</em>
|
1304
|
+
title
|
1305
|
+
</floating-title>
|
1306
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1307
|
+
<title>Clause 1.2</title>
|
1308
|
+
</clause>
|
1309
|
+
</clause>
|
1310
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
1311
|
+
<title>Clause 2</title>
|
1312
|
+
</clause>
|
1313
|
+
<floating-title id='_' depth='1' type='floating-title'>Another top-level floating title</floating-title>
|
1314
|
+
</sections>
|
1315
|
+
</standard-document>
|
1316
|
+
OUTPUT
|
1317
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1318
|
+
.to be_equivalent_to xmlpp(output)
|
1319
|
+
end
|
1233
1320
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Metanorma::Standoc do
|
4
4
|
it "processes basic tables" do
|
5
5
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -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 "generates error file" do
|
7
7
|
FileUtils.rm_f "spec/assets/xref_error.err"
|
8
8
|
Asciidoctor.convert_file "spec/assets/xref_error.adoc",
|
@@ -334,7 +334,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
334
334
|
end
|
335
335
|
|
336
336
|
# it "No warning if attributes on formatted strong or stem extraneous to Metanomra XML" do
|
337
|
-
# expect {
|
337
|
+
# expect { Metanorma::Standoc::Converter.new(nil,nil).validate(Nokogiri::XML(<<~INPUT)) }.not_to output('found attribute "close", but no attributes allowed here').to_stderr
|
338
338
|
# <standard-document>
|
339
339
|
# <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="(" close=")"><mi>r</mi></mfenced></stem>
|
340
340
|
# </standard-document>
|