metanorma-standoc 1.10.6 → 1.11.0.1
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/README.adoc +19 -23
- data/Rakefile +1 -1
- data/lib/asciidoctor/standoc/base.rb +10 -17
- data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
- data/lib/asciidoctor/standoc/blocks.rb +23 -23
- data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
- data/lib/asciidoctor/standoc/cleanup.rb +46 -12
- data/lib/asciidoctor/standoc/cleanup_block.rb +3 -71
- data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
- data/lib/asciidoctor/standoc/cleanup_inline.rb +42 -106
- data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
- data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +5 -24
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +5 -5
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
- data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +37 -77
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +162 -0
- data/lib/asciidoctor/standoc/cleanup_text.rb +5 -2
- data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
- data/lib/asciidoctor/standoc/converter.rb +14 -0
- data/lib/asciidoctor/standoc/inline.rb +7 -5
- data/lib/asciidoctor/standoc/isodoc.rng +419 -77
- data/lib/asciidoctor/standoc/lists.rb +15 -15
- data/lib/asciidoctor/standoc/macros.rb +14 -43
- data/lib/asciidoctor/standoc/macros_note.rb +45 -0
- data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
- data/lib/asciidoctor/standoc/macros_terms.rb +55 -8
- data/lib/asciidoctor/standoc/ref_sect.rb +26 -18
- data/lib/asciidoctor/standoc/reqt.rng +23 -2
- 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 +45 -27
- data/lib/asciidoctor/standoc/validate_section.rb +5 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor/base_spec.rb +4 -36
- data/spec/asciidoctor/blank_spec.rb +37 -0
- data/spec/asciidoctor/blocks_spec.rb +208 -49
- data/spec/asciidoctor/cleanup_sections_spec.rb +153 -12
- data/spec/asciidoctor/cleanup_spec.rb +104 -285
- data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
- data/spec/asciidoctor/inline_spec.rb +38 -2
- data/spec/asciidoctor/lists_spec.rb +6 -6
- data/spec/asciidoctor/macros_plantuml_spec.rb +37 -2
- data/spec/asciidoctor/macros_spec.rb +191 -114
- data/spec/asciidoctor/refs_spec.rb +12 -30
- data/spec/asciidoctor/section_spec.rb +18 -18
- data/spec/asciidoctor/validate_spec.rb +87 -2
- data/spec/fixtures/datamodel_description_sections_tree.xml +3 -2
- data/spec/spec_helper.rb +6 -7
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -49
- metadata +12 -5
@@ -213,141 +213,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
213
213
|
.to be_equivalent_to xmlpp(output)
|
214
214
|
end
|
215
215
|
|
216
|
-
it "processes stem-only terms as admitted" do
|
217
|
-
input = <<~INPUT
|
218
|
-
#{ASCIIDOC_BLANK_HDR}
|
219
|
-
== Terms and Definitions
|
220
|
-
|
221
|
-
=== stem:[t_90]
|
222
|
-
|
223
|
-
stem:[t_91]
|
224
|
-
|
225
|
-
Time
|
226
|
-
INPUT
|
227
|
-
output = <<~OUTPUT
|
228
|
-
#{BLANK_HDR}
|
229
|
-
<sections>
|
230
|
-
<terms id="_" obligation="normative">
|
231
|
-
<title>Terms and definitions</title>
|
232
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
233
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
234
|
-
<mrow>
|
235
|
-
<mi>t</mi>
|
236
|
-
</mrow>
|
237
|
-
<mrow>
|
238
|
-
<mn>90</mn>
|
239
|
-
</mrow>
|
240
|
-
</msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
241
|
-
<mrow>
|
242
|
-
<mi>t</mi>
|
243
|
-
</mrow>
|
244
|
-
<mrow>
|
245
|
-
<mn>91</mn>
|
246
|
-
</mrow>
|
247
|
-
</msub></math></stem></admitted>
|
248
|
-
<definition><p id="_">Time</p></definition></term>
|
249
|
-
</terms>
|
250
|
-
</sections>
|
251
|
-
</standard-document>
|
252
|
-
OUTPUT
|
253
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
254
|
-
.to be_equivalent_to xmlpp(output)
|
255
|
-
end
|
256
|
-
|
257
|
-
it "moves term domains out of the term definition paragraph" do
|
258
|
-
input = <<~INPUT
|
259
|
-
#{ASCIIDOC_BLANK_HDR}
|
260
|
-
== Terms and Definitions
|
261
|
-
|
262
|
-
=== Tempus
|
263
|
-
|
264
|
-
domain:[relativity] Time
|
265
|
-
|
266
|
-
=== Tempus1
|
267
|
-
|
268
|
-
Time2
|
269
|
-
|
270
|
-
domain:[relativity2]
|
271
|
-
INPUT
|
272
|
-
output = <<~OUTPUT
|
273
|
-
#{BLANK_HDR}
|
274
|
-
<sections>
|
275
|
-
<terms id="_" obligation="normative">
|
276
|
-
<title>Terms and definitions</title>
|
277
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
278
|
-
<term id="term-tempus">
|
279
|
-
<preferred>Tempus</preferred>
|
280
|
-
<domain>relativity</domain><definition><p id="_"> Time</p></definition>
|
281
|
-
</term>
|
282
|
-
<term id='term-tempus1'>
|
283
|
-
<preferred>Tempus1</preferred>
|
284
|
-
<domain>relativity2</domain>
|
285
|
-
<definition>
|
286
|
-
<p id='_'>Time2</p>
|
287
|
-
<p id='_'> </p>
|
288
|
-
</definition>
|
289
|
-
</term>
|
290
|
-
</terms>
|
291
|
-
</sections>
|
292
|
-
</standard-document>
|
293
|
-
OUTPUT
|
294
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
295
|
-
.to be_equivalent_to xmlpp(output)
|
296
|
-
end
|
297
|
-
|
298
|
-
it "permits multiple blocks in term definition paragraph" do
|
299
|
-
input = <<~INPUT
|
300
|
-
= Document title
|
301
|
-
Author
|
302
|
-
:docfile: test.adoc
|
303
|
-
:nodoc:
|
304
|
-
:novalid:
|
305
|
-
:stem:
|
306
|
-
|
307
|
-
== Terms and Definitions
|
308
|
-
|
309
|
-
=== stem:[t_90]
|
310
|
-
|
311
|
-
[stem]
|
312
|
-
++++
|
313
|
-
t_A
|
314
|
-
++++
|
315
|
-
|
316
|
-
This paragraph is extraneous
|
317
|
-
INPUT
|
318
|
-
output = <<~OUTPUT
|
319
|
-
#{BLANK_HDR}
|
320
|
-
<sections>
|
321
|
-
<terms id="_" obligation="normative">
|
322
|
-
<title>Terms and definitions</title>
|
323
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
324
|
-
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
325
|
-
<mrow>
|
326
|
-
<mi>t</mi>
|
327
|
-
</mrow>
|
328
|
-
<mrow>
|
329
|
-
<mn>90</mn>
|
330
|
-
</mrow>
|
331
|
-
</msub></math></stem></preferred><definition><formula id="_">
|
332
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
333
|
-
<mrow>
|
334
|
-
<mi>t</mi>
|
335
|
-
</mrow>
|
336
|
-
<mrow>
|
337
|
-
<mi>A</mi>
|
338
|
-
</mrow>
|
339
|
-
</msub></math></stem>
|
340
|
-
</formula>
|
341
|
-
<p id="_">This paragraph is extraneous</p></definition>
|
342
|
-
</term>
|
343
|
-
</terms>
|
344
|
-
</sections>
|
345
|
-
</standard-document>
|
346
|
-
OUTPUT
|
347
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
348
|
-
.to be_equivalent_to xmlpp(output)
|
349
|
-
end
|
350
|
-
|
351
216
|
it "converts xrefs to references into erefs" do
|
352
217
|
input = <<~INPUT
|
353
218
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -548,6 +413,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
548
413
|
|
549
414
|
=== Term1
|
550
415
|
|
416
|
+
Definition 0
|
417
|
+
|
551
418
|
[.source]
|
552
419
|
<<ISO2191,section=1>>
|
553
420
|
INPUT
|
@@ -558,8 +425,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
558
425
|
<title>Terms and definitions</title>
|
559
426
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
560
427
|
<term id="term-term1">
|
561
|
-
<preferred>Term1</preferred>
|
562
|
-
<
|
428
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
429
|
+
<definition><verbaldefinition><p id='_'>Definition 0</p></verbaldefinition></definition>
|
430
|
+
<termsource status="identical" type="authoritative">
|
563
431
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
564
432
|
<localityStack>
|
565
433
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -630,57 +498,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
630
498
|
.to be_equivalent_to xmlpp(output)
|
631
499
|
end
|
632
500
|
|
633
|
-
it "rearranges term note, term example, term source" do
|
634
|
-
input = <<~INPUT
|
635
|
-
#{ASCIIDOC_BLANK_HDR}
|
636
|
-
|
637
|
-
== Terms and definitions
|
638
|
-
|
639
|
-
=== Term
|
640
|
-
|
641
|
-
[.source]
|
642
|
-
<<ISO2191,section=1>>
|
643
|
-
|
644
|
-
NOTE: Note
|
645
|
-
|
646
|
-
[example]
|
647
|
-
Example 1
|
648
|
-
|
649
|
-
NOTE: Note 2
|
650
|
-
|
651
|
-
[example]
|
652
|
-
Example 2
|
653
|
-
INPUT
|
654
|
-
output = <<~OUTPUT
|
655
|
-
#{BLANK_HDR}
|
656
|
-
<sections>
|
657
|
-
<terms id="_" obligation="normative">
|
658
|
-
<title>Terms and definitions</title>
|
659
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
660
|
-
<term id="term-term"><preferred>Term</preferred>
|
661
|
-
<termnote id="_">
|
662
|
-
<p id="_">Note</p>
|
663
|
-
</termnote><termnote id="_">
|
664
|
-
<p id="_">Note 2</p>
|
665
|
-
</termnote><termexample id="_">
|
666
|
-
<p id="_">Example 1</p>
|
667
|
-
</termexample><termexample id="_">
|
668
|
-
<p id="_">Example 2</p>
|
669
|
-
</termexample><termsource status="identical">
|
670
|
-
<origin bibitemid="ISO2191" type="inline" citeas="">
|
671
|
-
<localityStack>
|
672
|
-
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
673
|
-
</localityStack>
|
674
|
-
</origin>
|
675
|
-
</termsource></term>
|
676
|
-
</terms>
|
677
|
-
</sections>
|
678
|
-
</standard-document>
|
679
|
-
OUTPUT
|
680
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
681
|
-
.to be_equivalent_to xmlpp(output)
|
682
|
-
end
|
683
|
-
|
684
501
|
it "separates IEV citations by top-level clause" do
|
685
502
|
FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
|
686
503
|
FileUtils.mv File.expand_path("~/.relaton/cache"),
|
@@ -690,8 +507,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
690
507
|
File.expand_path("~/.iev.pstore1"), force: true
|
691
508
|
FileUtils.rm_rf "relaton/cache"
|
692
509
|
FileUtils.rm_rf "test.iev.pstore"
|
693
|
-
# mock_iecbib_get_iec60050_102_01
|
694
|
-
# mock_iecbib_get_iec60050_103_01
|
695
510
|
# mock_iev
|
696
511
|
VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
|
697
512
|
input = <<~INPUT
|
@@ -704,16 +519,22 @@ RSpec.describe Asciidoctor::Standoc do
|
|
704
519
|
== Terms and definitions
|
705
520
|
=== Automation1
|
706
521
|
|
522
|
+
Definition 1
|
523
|
+
|
707
524
|
[.source]
|
708
525
|
<<iev,clause="103-01-02">>
|
709
526
|
|
710
527
|
=== Automation2
|
711
528
|
|
529
|
+
Definition 2
|
530
|
+
|
712
531
|
[.source]
|
713
532
|
<<iev,clause="102-01-02">>
|
714
533
|
|
715
534
|
=== Automation3
|
716
535
|
|
536
|
+
Definition 3
|
537
|
+
|
717
538
|
[.source]
|
718
539
|
<<iev,clause="103-01-02">>
|
719
540
|
INPUT
|
@@ -723,8 +544,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
723
544
|
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
724
545
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
725
546
|
<term id="term-automation1">
|
726
|
-
<preferred>Automation1</preferred>
|
727
|
-
<
|
547
|
+
<preferred><expression><name>Automation1</name></expression></preferred>
|
548
|
+
<definition><verbaldefinition><p id='_'>Definition 1</p></verbaldefinition></definition>
|
549
|
+
<termsource status="identical" type="authoritative">
|
728
550
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
729
551
|
<localityStack>
|
730
552
|
<locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
|
@@ -733,8 +555,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
733
555
|
</termsource>
|
734
556
|
</term>
|
735
557
|
<term id="term-automation2">
|
736
|
-
<preferred>Automation2</preferred>
|
737
|
-
<
|
558
|
+
<preferred><expression><name>Automation2</name></expression></preferred>
|
559
|
+
<definition><verbaldefinition><p id='_'>Definition 2</p></verbaldefinition></definition>
|
560
|
+
<termsource status="identical" type="authoritative">
|
738
561
|
<origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
|
739
562
|
<localityStack>
|
740
563
|
<locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
|
@@ -743,8 +566,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
743
566
|
</termsource>
|
744
567
|
</term>
|
745
568
|
<term id="term-automation3">
|
746
|
-
<preferred>Automation3</preferred>
|
747
|
-
<
|
569
|
+
<preferred><expression><name>Automation3</name></expression></preferred>
|
570
|
+
<definition><verbaldefinition><p id='_'>Definition 3</p></verbaldefinition></definition>
|
571
|
+
<termsource status="identical" type="authoritative">
|
748
572
|
<origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
|
749
573
|
<localityStack>
|
750
574
|
<locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
|
@@ -819,7 +643,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
819
643
|
<abstract format="text/plain" language="en" script="Latn">IEC 60050-103:2009 gives the terminology relative to functions of one or more variables. Together with IEC 60050-102, it covers the mathematical terminology used in the fields of electricity, electronics and telecommunications. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Mathematical symbols are generally in accordance with IEC 60027-1 and ISO 80000-2. This standard cancels and replaces Sections 101-13, 101-14 and 101-15 of International Standard IEC 60050-101:1998. It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
|
820
644
|
<status>
|
821
645
|
<stage>60</stage>
|
822
|
-
<substage>
|
646
|
+
<substage>60</substage>
|
823
647
|
</status>
|
824
648
|
<copyright>
|
825
649
|
<from>2009</from>
|
@@ -962,23 +786,23 @@ RSpec.describe Asciidoctor::Standoc do
|
|
962
786
|
it "cleans up nested mathvariant instances" do
|
963
787
|
input = <<~INPUT
|
964
788
|
#{ASCIIDOC_BLANK_HDR}
|
965
|
-
|
789
|
+
|
966
790
|
stem:[sf "unitsml(cd)"]
|
967
791
|
INPUT
|
968
792
|
output = <<~OUTPUT
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
793
|
+
<sections>
|
794
|
+
<p id='_'>
|
795
|
+
<stem type='MathML'>
|
796
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
797
|
+
<mstyle mathvariant='sans-serif'>
|
798
|
+
<mrow xref='U_NISTu7'>
|
799
|
+
<mi mathvariant='sans-serif'>cd</mi>
|
800
|
+
</mrow>
|
801
|
+
</mstyle>
|
802
|
+
</math>
|
803
|
+
</stem>
|
804
|
+
</p>
|
805
|
+
</sections>
|
982
806
|
OUTPUT
|
983
807
|
expect(xmlpp(strip_guid(Nokogiri::XML(
|
984
808
|
Asciidoctor.convert(input, *OPTIONS),
|
@@ -1463,7 +1287,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1463
1287
|
<xref target='L__xf6_we'/>
|
1464
1288
|
<sourcecode id='L__xf6_we'>
|
1465
1289
|
<name>
|
1466
|
-
See
|
1290
|
+
See
|
1467
1291
|
<eref type='inline' bibitemid='L__xf6_wner2016' citeas='Löwner et al. 2016'/>
|
1468
1292
|
</name>
|
1469
1293
|
ABC
|
@@ -1965,89 +1789,84 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1965
1789
|
.to be_equivalent_to xmlpp(output)
|
1966
1790
|
end
|
1967
1791
|
|
1968
|
-
|
1792
|
+
it "creates content-based GUIDs" do
|
1793
|
+
input = <<~INPUT
|
1794
|
+
#{ASCIIDOC_BLANK_HDR}
|
1969
1795
|
|
1970
|
-
|
1971
|
-
|
1972
|
-
.to receive(:mathml_mi_italics).and_return(string)
|
1973
|
-
end
|
1796
|
+
.Foreword
|
1797
|
+
Foreword
|
1974
1798
|
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1799
|
+
[NOTE,beforeclauses=true]
|
1800
|
+
====
|
1801
|
+
Note which is very important <<a>>
|
1802
|
+
====
|
1803
|
+
|
1804
|
+
== Introduction
|
1805
|
+
Introduction
|
1806
|
+
|
1807
|
+
== Scope
|
1808
|
+
Scope statement
|
1809
|
+
|
1810
|
+
[IMPORTANT,beforeclauses=true]
|
1811
|
+
====
|
1812
|
+
Notice which is very important
|
1813
|
+
====
|
1814
|
+
INPUT
|
1815
|
+
output = <<~OUTPUT
|
1816
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version="#{Metanorma::Standoc::VERSION}">
|
1817
|
+
<bibdata type='standard'>
|
1818
|
+
<title language='en' format='text/plain'>Document title</title>
|
1993
1819
|
<language>en</language>
|
1994
|
-
<language>fr</language>
|
1995
1820
|
<script>Latn</script>
|
1996
1821
|
<status>
|
1997
|
-
<stage>
|
1822
|
+
<stage>published</stage>
|
1998
1823
|
</status>
|
1999
1824
|
<copyright>
|
2000
|
-
<from>
|
2001
|
-
<owner>
|
2002
|
-
<organization>
|
2003
|
-
<name>International Electrotechnical Commission</name>
|
2004
|
-
<abbreviation>IEC</abbreviation>
|
2005
|
-
<uri>www.iec.ch</uri>
|
2006
|
-
</organization>
|
2007
|
-
</owner>
|
1825
|
+
<from>2021</from>
|
2008
1826
|
</copyright>
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
1827
|
+
<ext>
|
1828
|
+
<doctype>article</doctype>
|
1829
|
+
</ext>
|
1830
|
+
</bibdata>
|
1831
|
+
<preface>
|
1832
|
+
<note id='_f91b621e-d8cb-30bf-eef6-7d0150204829'>
|
1833
|
+
<p id='_76d95913-a379-c60f-5144-1f09655cafa6'>
|
1834
|
+
Note which is very important
|
1835
|
+
<xref target='_76d95913-a379-c60f-5144-1f09655cafa6'/>
|
1836
|
+
</p>
|
1837
|
+
</note>
|
1838
|
+
<foreword id='_0826616f-13a4-0634-baee-5003c5534175' obligation='informative'>
|
1839
|
+
<title>Foreword</title>
|
1840
|
+
<p id='_d2f825bf-3e18-6143-8777-34e59928d48c'>Foreword</p>
|
1841
|
+
</foreword>
|
1842
|
+
<introduction id='_introduction' obligation='informative'>
|
1843
|
+
<title>Introduction</title>
|
1844
|
+
<p id='_272021ab-1bfa-78ae-e860-ed770e36f3d2'>Introduction</p>
|
1845
|
+
</introduction>
|
1846
|
+
</preface>
|
1847
|
+
<sections>
|
1848
|
+
<admonition id='_068def71-3ec8-0395-8853-0e2d3ef5b841' type='important'>
|
1849
|
+
<p id='_69ec375e-c992-5be3-76dd-a2311f9bb6cc'>Notice which is very important</p>
|
1850
|
+
</admonition>
|
1851
|
+
<clause id='_scope' type='scope' inline-header='false' obligation='normative'>
|
1852
|
+
<title>Scope</title>
|
1853
|
+
<p id='_fdcef9f1-c898-da99-eff6-f3e6abde7799'>Scope statement</p>
|
1854
|
+
</clause>
|
1855
|
+
</sections>
|
1856
|
+
</standard-document>
|
1857
|
+
OUTPUT
|
1858
|
+
input1 = xmlpp(Asciidoctor.convert(input, *OPTIONS))
|
1859
|
+
.sub(/<p id='([^']+)'>(\s+)Note which is very important(\s+)<xref target='a'/,
|
1860
|
+
"<p id='\\1'>\\2Note which is very important\\3<xref target='\\1'")
|
1861
|
+
expect(input1)
|
1862
|
+
.to be_equivalent_to xmlpp(output)
|
2012
1863
|
end
|
2013
1864
|
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
|
2020
|
-
<docidentifier>IEC 60050-102:2007</docidentifier>
|
2021
|
-
<date type="published">
|
2022
|
-
<on>2007</on>
|
2023
|
-
</date>
|
2024
|
-
<contributor>
|
2025
|
-
<role type="publisher"/>
|
2026
|
-
<organization>
|
2027
|
-
<name>International Electrotechnical Commission</name>
|
2028
|
-
<abbreviation>IEC</abbreviation>
|
2029
|
-
<uri>www.iec.ch</uri>
|
2030
|
-
</organization>
|
2031
|
-
</contributor>
|
2032
|
-
<language>en</language>
|
2033
|
-
<language>fr</language>
|
2034
|
-
<script>Latn</script>
|
2035
|
-
<status>
|
2036
|
-
<stage>60</stage>
|
2037
|
-
</status>
|
2038
|
-
<copyright>
|
2039
|
-
<from>2018</from>
|
2040
|
-
<owner>
|
2041
|
-
<organization>
|
2042
|
-
<name>International Electrotechnical Commission</name>
|
2043
|
-
<abbreviation>IEC</abbreviation>
|
2044
|
-
<uri>www.iec.ch</uri>
|
2045
|
-
</organization>
|
2046
|
-
</owner>
|
2047
|
-
</copyright>
|
2048
|
-
</bibitem>
|
2049
|
-
OUTPUT
|
2050
|
-
end
|
1865
|
+
private
|
1866
|
+
|
1867
|
+
def mock_mathml_italicise(string)
|
1868
|
+
allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
|
1869
|
+
.to receive(:mathml_mi_italics).and_return(string)
|
2051
1870
|
end
|
2052
1871
|
|
2053
1872
|
def mock_iev
|