isodoc 1.7.6 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/class_utils.rb +23 -0
- data/lib/isodoc/convert.rb +9 -0
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/function/inline.rb +2 -4
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/html_function/postprocess.rb +4 -6
- data/lib/isodoc/metadata_date.rb +13 -11
- data/lib/isodoc/presentation_function/bibdata.rb +2 -2
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +14 -11
- data/lib/isodoc/presentation_function/terms.rb +179 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +24 -14
- data/lib/isodoc/word_function/comments.rb +0 -4
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xref/xref_gen.rb +18 -22
- data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +11 -7
- data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
- data/lib/isodoc-yaml/i18n-de.yaml +20 -0
- data/lib/isodoc-yaml/i18n-en.yaml +20 -0
- data/lib/isodoc-yaml/i18n-es.yaml +20 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/assets/i18n.yaml +3 -1
- data/spec/isodoc/blocks_spec.rb +14 -8
- data/spec/isodoc/i18n_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +200 -6
- data/spec/isodoc/lists_spec.rb +344 -222
- data/spec/isodoc/section_spec.rb +11 -10
- data/spec/isodoc/table_spec.rb +71 -73
- data/spec/isodoc/terms_spec.rb +354 -34
- data/spec/isodoc/xref_numbering_spec.rb +347 -0
- data/spec/isodoc/xref_spec.rb +271 -350
- data/spec/isodoc/xslfo_convert_spec.rb +34 -9
- metadata +7 -6
- data/lib/isodoc/presentation_function/concept.rb +0 -68
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -24,7 +24,7 @@ RSpec.describe IsoDoc do
|
|
24
24
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
25
25
|
<title>Normal Terms</title>
|
26
26
|
<term id="J">
|
27
|
-
<preferred>Term2</preferred>
|
27
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
28
28
|
</term>
|
29
29
|
</terms>
|
30
30
|
<definitions id="K">
|
@@ -233,7 +233,7 @@ RSpec.describe IsoDoc do
|
|
233
233
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
234
234
|
<title>Normal Terms</title>
|
235
235
|
<term id="J">
|
236
|
-
<preferred>Term2</preferred>
|
236
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
237
237
|
</term>
|
238
238
|
</terms>
|
239
239
|
<definitions id="K">
|
@@ -361,7 +361,7 @@ RSpec.describe IsoDoc do
|
|
361
361
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
362
362
|
<title>Normal Terms</title>
|
363
363
|
<term id="J">
|
364
|
-
<preferred>Term2</preferred>
|
364
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
365
365
|
</term>
|
366
366
|
</terms>
|
367
367
|
<definitions id="K">
|
@@ -570,7 +570,7 @@ RSpec.describe IsoDoc do
|
|
570
570
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
571
571
|
<title>Normal Terms</title>
|
572
572
|
<term id="J">
|
573
|
-
<preferred>Term2</preferred>
|
573
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
574
574
|
</term>
|
575
575
|
</terms>
|
576
576
|
<definitions id="K">
|
@@ -812,7 +812,7 @@ RSpec.describe IsoDoc do
|
|
812
812
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
813
813
|
<title>Normal Terms</title>
|
814
814
|
<term id="J">
|
815
|
-
<preferred>Term2</preferred>
|
815
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
816
816
|
</term>
|
817
817
|
</terms>
|
818
818
|
<definitions id="K">
|
@@ -877,7 +877,7 @@ RSpec.describe IsoDoc do
|
|
877
877
|
<ext>
|
878
878
|
<doctype language="">brochure</doctype><doctype language="eo">broŝuro</doctype>
|
879
879
|
</ext>
|
880
|
-
</bibdata><localized-strings><localized-string key="foreword" language="eo">Antaŭparolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">klaŭzo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo">
|
880
|
+
</bibdata><localized-strings><localized-string key="foreword" language="eo">Antaŭparolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">klaŭzo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo"><strong>aldono</strong></localized-string><localized-string key="normref" language="eo">Normaj citaĵoj</localized-string><localized-string key="bibliography" language="eo">Bibliografio</localized-string><localized-string key="inform_annex" language="eo">informa</localized-string><localized-string key="all_parts" language="eo">ĉiuj partoj</localized-string><localized-string key="norm_annex" language="eo">normative</localized-string><localized-string key='figure' language='eo'>figur-etikedo duvorta</localized-string><localized-string key='example' language='eo'>Ekzempl-etikedo Duvorta</localized-string><localized-string key="note" language="eo">NOTO</localized-string><localized-string key="locality.table" language="eo">Tabelo</localized-string><localized-string key="doctype_dict.brochure" language="eo">broŝuro</localized-string><localized-string key="doctype_dict.conference_proceedings" language="eo">konferencaktoj</localized-string><localized-string key="stage_dict.published" language="eo">publikigita</localized-string><localized-string key="substage_dict.withdrawn" language="eo">fortirita</localized-string><localized-string key="array.0" language="eo">elem1</localized-string><localized-string key="array.1" language="eo">elem2</localized-string><localized-string key="array.2.elem3" language="eo">elem4</localized-string><localized-string key="array.2.elem5" language="eo">elem6</localized-string><localized-string key="language" language="eo">eo</localized-string><localized-string key="script" language="eo">Latn</localized-string></localized-strings>
|
881
881
|
<preface>
|
882
882
|
<foreword obligation="informative" displayorder="1">
|
883
883
|
<title>Foreword</title>
|
@@ -920,7 +920,7 @@ RSpec.describe IsoDoc do
|
|
920
920
|
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
921
921
|
</clause></clause>
|
922
922
|
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
923
|
-
<title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
923
|
+
<title><strong><strong>Aldono</strong> A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
924
924
|
<clause id="Q" inline-header="false" obligation="normative">
|
925
925
|
<title depth="2">A.1.<tab/>Annex A.1</title>
|
926
926
|
<clause id="Q1" inline-header="false" obligation="normative">
|
@@ -1041,7 +1041,7 @@ RSpec.describe IsoDoc do
|
|
1041
1041
|
<br/>
|
1042
1042
|
<div id='P' class='Section3'>
|
1043
1043
|
<h1 class='Annex'>
|
1044
|
-
<b>Aldono A</b>
|
1044
|
+
<b><b>Aldono</b> A</b>
|
1045
1045
|
<br/>
|
1046
1046
|
(normative)
|
1047
1047
|
<br/>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -625,6 +625,84 @@ RSpec.describe IsoDoc do
|
|
625
625
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
626
626
|
end
|
627
627
|
|
628
|
+
it "processes related terms" do
|
629
|
+
input = <<~INPUT
|
630
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
631
|
+
<sections>
|
632
|
+
<terms id='A' obligation='normative'>
|
633
|
+
<title>Terms and definitions</title>
|
634
|
+
<term id='second'>
|
635
|
+
<preferred>
|
636
|
+
<expression>
|
637
|
+
<name>Second Term</name>
|
638
|
+
</expression>
|
639
|
+
</preferred>
|
640
|
+
<usageinfo>
|
641
|
+
<p id='B'>Usage Info 1.</p>
|
642
|
+
</usageinfo>
|
643
|
+
<definition><verbaldefinition>Definition 1</verbaldefinition></definition>
|
644
|
+
</term>
|
645
|
+
<term id="C">
|
646
|
+
<preferred language='fr' script='Latn' type='prefix'>
|
647
|
+
<expression>
|
648
|
+
<name>First Designation</name>
|
649
|
+
</expression></preferred>
|
650
|
+
<related type='contrast'>
|
651
|
+
<preferred>
|
652
|
+
<expression>
|
653
|
+
<name>Fifth Designation</name>
|
654
|
+
<grammar>
|
655
|
+
<gender>neuter</gender>
|
656
|
+
</grammar>
|
657
|
+
</expression>
|
658
|
+
</preferred>
|
659
|
+
<xref target='second'/>
|
660
|
+
</related>
|
661
|
+
<definition><verbaldefinition>Definition 2</verbaldefinition></definition>
|
662
|
+
</term>
|
663
|
+
</terms>
|
664
|
+
</sections>
|
665
|
+
</iso-standard>
|
666
|
+
INPUT
|
667
|
+
output = <<~OUTPUT
|
668
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
669
|
+
<sections>
|
670
|
+
<terms id='A' obligation='normative' displayorder='1'>
|
671
|
+
<title depth='1'>
|
672
|
+
1.
|
673
|
+
<tab/>
|
674
|
+
Terms and definitions
|
675
|
+
</title>
|
676
|
+
<term id='second'>
|
677
|
+
<name>1.1.</name>
|
678
|
+
<preferred>Second Term</preferred>
|
679
|
+
<usageinfo>
|
680
|
+
<p id='B'>Usage Info 1.</p>
|
681
|
+
</usageinfo>
|
682
|
+
<definition>Definition 1</definition>
|
683
|
+
</term>
|
684
|
+
<term id='C'>
|
685
|
+
<name>1.2.</name>
|
686
|
+
<preferred language='fr' script='Latn' type='prefix'>First Designation</preferred>
|
687
|
+
<p>
|
688
|
+
<strong>CONTRAST:</strong>
|
689
|
+
<em>
|
690
|
+
<preferred>Fifth Designation neut</preferred>
|
691
|
+
</em>
|
692
|
+
(
|
693
|
+
<xref target='second'>Clause 1.1</xref>
|
694
|
+
)
|
695
|
+
</p>
|
696
|
+
<definition>Definition 2</definition>
|
697
|
+
</term>
|
698
|
+
</terms>
|
699
|
+
</sections>
|
700
|
+
</iso-standard>
|
701
|
+
OUTPUT
|
702
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
703
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
704
|
+
end
|
705
|
+
|
628
706
|
it "processes embedded inline formatting" do
|
629
707
|
input = <<~INPUT
|
630
708
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -1505,6 +1583,122 @@ RSpec.describe IsoDoc do
|
|
1505
1583
|
end
|
1506
1584
|
|
1507
1585
|
it "cases xrefs" do
|
1586
|
+
input = <<~INPUT
|
1587
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1588
|
+
<preface>
|
1589
|
+
<clause id="CC"><title>Introduction</title></clause>
|
1590
|
+
<sections>
|
1591
|
+
<clause id="A">
|
1592
|
+
<table id="B">
|
1593
|
+
</table>
|
1594
|
+
<figure id="B1"/>
|
1595
|
+
<example id="B2"/>
|
1596
|
+
</clause>
|
1597
|
+
<clause id="C">
|
1598
|
+
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1599
|
+
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1600
|
+
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1601
|
+
Downcasing an xref affects only the first letter: <xref target="B2" case="lowercase"/>.
|
1602
|
+
Capitalising an xref affects only the first letter: <xref target="B1" case="capital"/>.
|
1603
|
+
<xref target="A"/> is clause <em>initial.</em><br/>
|
1604
|
+
<xref target="A"/> is too. </p>
|
1605
|
+
<p><xref target="A"/> is also.</p>
|
1606
|
+
<p>Annex has formatting, and crossreferences ignore it when determining casing. <xref target="AA"/>.</p>
|
1607
|
+
<p>Labels are not subject to casing: <xref target="CC" case="lowercase"/>
|
1608
|
+
</clause>
|
1609
|
+
<annex id="AA">
|
1610
|
+
<clause id="AA1"/>
|
1611
|
+
</annex>
|
1612
|
+
</sections>
|
1613
|
+
</iso-standard>
|
1614
|
+
INPUT
|
1615
|
+
output = <<~OUTPUT
|
1616
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1617
|
+
<preface>
|
1618
|
+
<clause id='CC' displayorder='1'>
|
1619
|
+
<title depth='1'>Introduction</title>
|
1620
|
+
</clause>
|
1621
|
+
<sections displayorder='2'>
|
1622
|
+
<clause id='A' displayorder='3'>
|
1623
|
+
<title>1.</title>
|
1624
|
+
<table id='B'>
|
1625
|
+
<name>Tabelo 1</name>
|
1626
|
+
</table>
|
1627
|
+
<figure id='B1'>
|
1628
|
+
<name>Figur-etikedo duvorta 1</name>
|
1629
|
+
</figure>
|
1630
|
+
<example id='B2'>
|
1631
|
+
<name>Ekzempl-etikedo Duvorta</name>
|
1632
|
+
</example>
|
1633
|
+
</clause>
|
1634
|
+
<clause id='C' displayorder='4'>
|
1635
|
+
<title>2.</title>
|
1636
|
+
<p>
|
1637
|
+
This is
|
1638
|
+
<xref target='A'>klaŭzo 1</xref>
|
1639
|
+
and
|
1640
|
+
<xref target='B'>tabelo 1</xref>
|
1641
|
+
. This is
|
1642
|
+
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1643
|
+
and
|
1644
|
+
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1645
|
+
. This is
|
1646
|
+
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1647
|
+
and
|
1648
|
+
<xref target='B' case='capital'>Tabelo 1</xref>
|
1649
|
+
. Downcasing an xref affects only the first letter:
|
1650
|
+
<xref target='B2' case='lowercase'>klaŭzo 1, Example</xref>
|
1651
|
+
. Capitalising an xref affects only the first letter:
|
1652
|
+
<xref target='B1' case='capital'>Figur-etikedo duvorta 1</xref>
|
1653
|
+
.
|
1654
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1655
|
+
is clause
|
1656
|
+
<em>initial.</em>
|
1657
|
+
<br/>
|
1658
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1659
|
+
is too.
|
1660
|
+
</p>
|
1661
|
+
<p>
|
1662
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1663
|
+
is also.
|
1664
|
+
</p>
|
1665
|
+
<p>
|
1666
|
+
Annex has formatting, and crossreferences ignore it when determining
|
1667
|
+
casing.
|
1668
|
+
<xref target='AA'>
|
1669
|
+
<strong>Aldono</strong>
|
1670
|
+
A
|
1671
|
+
</xref>
|
1672
|
+
.
|
1673
|
+
</p>
|
1674
|
+
<p>
|
1675
|
+
Labels are not subject to casing:
|
1676
|
+
<xref target='CC' case='lowercase'>Introduction</xref>
|
1677
|
+
</p>
|
1678
|
+
<annex id='AA' displayorder='5'>
|
1679
|
+
<title>
|
1680
|
+
<strong>
|
1681
|
+
<strong>Aldono</strong>
|
1682
|
+
A
|
1683
|
+
</strong>
|
1684
|
+
<br/>
|
1685
|
+
(informa)
|
1686
|
+
</title>
|
1687
|
+
<clause id='AA1'>
|
1688
|
+
<title>A.1.</title>
|
1689
|
+
</clause>
|
1690
|
+
</annex>
|
1691
|
+
</clause>
|
1692
|
+
</sections>
|
1693
|
+
</preface>
|
1694
|
+
</iso-standard>
|
1695
|
+
OUTPUT
|
1696
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1697
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1698
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1699
|
+
end
|
1700
|
+
|
1701
|
+
it "ignores casing of xrefs in unicameral scripts" do
|
1508
1702
|
input = <<~INPUT
|
1509
1703
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1510
1704
|
<sections>
|
@@ -1541,23 +1735,23 @@ RSpec.describe IsoDoc do
|
|
1541
1735
|
and
|
1542
1736
|
<xref target='B'>tabelo 1</xref>
|
1543
1737
|
. This is
|
1544
|
-
<xref target='A' case='capital'>
|
1738
|
+
<xref target='A' case='capital'>klaŭzo 1</xref>
|
1545
1739
|
and
|
1546
1740
|
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1547
1741
|
. This is
|
1548
1742
|
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1549
1743
|
and
|
1550
|
-
<xref target='B' case='capital'>
|
1744
|
+
<xref target='B' case='capital'>tabelo 1</xref>
|
1551
1745
|
.
|
1552
|
-
<xref target='A'>
|
1746
|
+
<xref target='A'>klaŭzo 1</xref>
|
1553
1747
|
is clause
|
1554
1748
|
<em>initial.</em>
|
1555
1749
|
<br/>
|
1556
|
-
<xref target='A'>
|
1750
|
+
<xref target='A'>klaŭzo 1</xref>
|
1557
1751
|
is too.
|
1558
1752
|
</p>
|
1559
1753
|
<p>
|
1560
|
-
<xref target='A'>
|
1754
|
+
<xref target='A'>klaŭzo 1</xref>
|
1561
1755
|
is also.
|
1562
1756
|
</p>
|
1563
1757
|
</clause>
|
@@ -1565,7 +1759,7 @@ RSpec.describe IsoDoc do
|
|
1565
1759
|
</iso-standard>
|
1566
1760
|
OUTPUT
|
1567
1761
|
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1568
|
-
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1762
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml", script: "Hans" })
|
1569
1763
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1570
1764
|
end
|
1571
1765
|
|