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/xref_spec.rb
CHANGED
@@ -1831,11 +1831,11 @@ RSpec.describe IsoDoc do
|
|
1831
1831
|
<clause id="scope" type="scope"><title>Scope</title>
|
1832
1832
|
</clause>
|
1833
1833
|
<terms id="terms">
|
1834
|
-
<term id="_waxy_rice"><preferred>waxy rice</preferred>
|
1834
|
+
<term id="_waxy_rice"><preferred><expression><name>waxy rice</name></expression></preferred>
|
1835
1835
|
<termnote id="note1">
|
1836
1836
|
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
1837
1837
|
</termnote></term>
|
1838
|
-
<term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
|
1838
|
+
<term id="_nonwaxy_rice"><preferred><expression><name>nonwaxy rice</name></expression></preferred>
|
1839
1839
|
<termnote id="note2">
|
1840
1840
|
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
1841
1841
|
</termnote>
|
@@ -1904,6 +1904,271 @@ RSpec.describe IsoDoc do
|
|
1904
1904
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1905
1905
|
end
|
1906
1906
|
|
1907
|
+
it "cross-references nested term notes" do
|
1908
|
+
input = <<~INPUT
|
1909
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1910
|
+
<preface>
|
1911
|
+
<foreword>
|
1912
|
+
<p>
|
1913
|
+
<xref target="note1"/>
|
1914
|
+
<xref target="note2"/>
|
1915
|
+
<xref target="note3"/>
|
1916
|
+
</p>
|
1917
|
+
</foreword>
|
1918
|
+
</preface>
|
1919
|
+
<sections>
|
1920
|
+
<clause id="scope" type="scope"><title>Scope</title>
|
1921
|
+
</clause>
|
1922
|
+
<terms id="terms">
|
1923
|
+
<term id="_waxy_rice"><preferred><expression><name>waxy rice</name></expression></preferred>
|
1924
|
+
<termnote id="note1">
|
1925
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
1926
|
+
</termnote>
|
1927
|
+
<term id="_nonwaxy_rice"><preferred><expression><name>nonwaxy rice</name></expression></preferred>
|
1928
|
+
<termnote id="note2">
|
1929
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
1930
|
+
</termnote>
|
1931
|
+
<termnote id="note3">
|
1932
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
1933
|
+
</termnote></term></term>
|
1934
|
+
</terms>
|
1935
|
+
</iso-standard>
|
1936
|
+
INPUT
|
1937
|
+
output = <<~OUTPUT
|
1938
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1939
|
+
<preface>
|
1940
|
+
<foreword displayorder='1'>
|
1941
|
+
<p>
|
1942
|
+
<xref target='note1'>Clause 2.1, Note 1</xref>
|
1943
|
+
<xref target='note2'>Clause 2.1.1, Note 1</xref>
|
1944
|
+
<xref target='note3'>Clause 2.1.1, Note 2</xref>
|
1945
|
+
</p>
|
1946
|
+
</foreword>
|
1947
|
+
</preface>
|
1948
|
+
<sections>
|
1949
|
+
<clause id='scope' type='scope' displayorder='2'>
|
1950
|
+
<title depth='1'>
|
1951
|
+
1.
|
1952
|
+
<tab/>
|
1953
|
+
Scope
|
1954
|
+
</title>
|
1955
|
+
</clause>
|
1956
|
+
<terms id='terms' displayorder='3'>
|
1957
|
+
<title>2.</title>
|
1958
|
+
<term id='_waxy_rice'>
|
1959
|
+
<name>2.1.</name>
|
1960
|
+
<preferred>waxy rice</preferred>
|
1961
|
+
<termnote id='note1'>
|
1962
|
+
<name>Note 1 to entry</name>
|
1963
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
1964
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
1965
|
+
kernels have a tendency to stick together after cooking.
|
1966
|
+
</p>
|
1967
|
+
</termnote>
|
1968
|
+
<term id='_nonwaxy_rice'>
|
1969
|
+
<name>2.1.1.</name>
|
1970
|
+
<preferred>nonwaxy rice</preferred>
|
1971
|
+
<termnote id='note2'>
|
1972
|
+
<name>Note 1 to entry</name>
|
1973
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
1974
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
1975
|
+
The kernels have a tendency to stick together after cooking.
|
1976
|
+
</p>
|
1977
|
+
</termnote>
|
1978
|
+
<termnote id='note3'>
|
1979
|
+
<name>Note 2 to entry</name>
|
1980
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
1981
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
1982
|
+
The kernels have a tendency to stick together after cooking.
|
1983
|
+
</p>
|
1984
|
+
</termnote>
|
1985
|
+
</term>
|
1986
|
+
</term>
|
1987
|
+
</terms>
|
1988
|
+
</sections>
|
1989
|
+
</iso-standard>
|
1990
|
+
OUTPUT
|
1991
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1992
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1993
|
+
end
|
1994
|
+
|
1995
|
+
it "cross-references term examples" do
|
1996
|
+
input = <<~INPUT
|
1997
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1998
|
+
<preface>
|
1999
|
+
<foreword>
|
2000
|
+
<p>
|
2001
|
+
<xref target="note1"/>
|
2002
|
+
<xref target="note2"/>
|
2003
|
+
<xref target="note3"/>
|
2004
|
+
</p>
|
2005
|
+
</foreword>
|
2006
|
+
</preface>
|
2007
|
+
<sections>
|
2008
|
+
<clause id="scope" type="scope"><title>Scope</title>
|
2009
|
+
</clause>
|
2010
|
+
<terms id="terms">
|
2011
|
+
<term id="_waxy_rice"><preferred><expression><name>waxy rice</name></expression></preferred>
|
2012
|
+
<termexample id="note1">
|
2013
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2014
|
+
</termexample></term>
|
2015
|
+
<term id="_nonwaxy_rice"><preferred><expression><name>nonwaxy rice</name></expression></preferred>
|
2016
|
+
<termexample id="note2">
|
2017
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2018
|
+
</termexample>
|
2019
|
+
<termexample id="note3">
|
2020
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2021
|
+
</termexample></term>
|
2022
|
+
</terms>
|
2023
|
+
</iso-standard>
|
2024
|
+
INPUT
|
2025
|
+
output = <<~OUTPUT
|
2026
|
+
<?xml version='1.0'?>
|
2027
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
2028
|
+
<preface>
|
2029
|
+
<foreword displayorder="1">
|
2030
|
+
<p>
|
2031
|
+
<xref target='note1'>Clause 2.1, Example</xref>
|
2032
|
+
<xref target='note2'>Clause 2.2, Example 1</xref>
|
2033
|
+
<xref target='note3'>Clause 2.2, Example 2</xref>
|
2034
|
+
</p>
|
2035
|
+
</foreword>
|
2036
|
+
</preface>
|
2037
|
+
<sections>
|
2038
|
+
<clause id='scope' type="scope" displayorder="2">
|
2039
|
+
<title depth='1'>
|
2040
|
+
1.
|
2041
|
+
<tab/>
|
2042
|
+
Scope
|
2043
|
+
</title>
|
2044
|
+
</clause>
|
2045
|
+
<terms id='terms'displayorder="3">
|
2046
|
+
<title>2.</title>
|
2047
|
+
<term id='_waxy_rice'>
|
2048
|
+
<name>2.1.</name>
|
2049
|
+
<preferred>waxy rice</preferred>
|
2050
|
+
<termexample id='note1'>
|
2051
|
+
<name>EXAMPLE</name>
|
2052
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2053
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
2054
|
+
kernels have a tendency to stick together after cooking.
|
2055
|
+
</p>
|
2056
|
+
</termexample>
|
2057
|
+
</term>
|
2058
|
+
<term id='_nonwaxy_rice'>
|
2059
|
+
<name>2.2.</name>
|
2060
|
+
<preferred>nonwaxy rice</preferred>
|
2061
|
+
<termexample id='note2'>
|
2062
|
+
<name>EXAMPLE 1</name>
|
2063
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2064
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
2065
|
+
kernels have a tendency to stick together after cooking.
|
2066
|
+
</p>
|
2067
|
+
</termexample>
|
2068
|
+
<termexample id='note3'>
|
2069
|
+
<name>EXAMPLE 2</name>
|
2070
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2071
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
2072
|
+
kernels have a tendency to stick together after cooking.
|
2073
|
+
</p>
|
2074
|
+
</termexample>
|
2075
|
+
</term>
|
2076
|
+
</terms>
|
2077
|
+
</sections>
|
2078
|
+
</iso-standard>
|
2079
|
+
OUTPUT
|
2080
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
2081
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
2082
|
+
end
|
2083
|
+
|
2084
|
+
it "cross-references nested term examples" do
|
2085
|
+
input = <<~INPUT
|
2086
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2087
|
+
<preface>
|
2088
|
+
<foreword>
|
2089
|
+
<p>
|
2090
|
+
<xref target="note1"/>
|
2091
|
+
<xref target="note2"/>
|
2092
|
+
<xref target="note3"/>
|
2093
|
+
</p>
|
2094
|
+
</foreword>
|
2095
|
+
</preface>
|
2096
|
+
<sections>
|
2097
|
+
<clause id="scope" type="scope"><title>Scope</title>
|
2098
|
+
</clause>
|
2099
|
+
<terms id="terms">
|
2100
|
+
<term id="_waxy_rice"><preferred><expression><name>waxy rice</name></expression></preferred>
|
2101
|
+
<termexample id="note1">
|
2102
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2103
|
+
</termexample>
|
2104
|
+
<term id="_nonwaxy_rice"><preferred><expression><name>nonwaxy rice</name></expression></preferred>
|
2105
|
+
<termexample id="note2">
|
2106
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2107
|
+
</termexample>
|
2108
|
+
<termexample id="note3">
|
2109
|
+
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
2110
|
+
</termexample></term></term>
|
2111
|
+
</terms>
|
2112
|
+
</iso-standard>
|
2113
|
+
INPUT
|
2114
|
+
output = <<~OUTPUT
|
2115
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
2116
|
+
<preface>
|
2117
|
+
<foreword displayorder='1'>
|
2118
|
+
<p>
|
2119
|
+
<xref target='note1'>Clause 2.1, Example</xref>
|
2120
|
+
<xref target='note2'>Clause 2.1.1, Example 1</xref>
|
2121
|
+
<xref target='note3'>Clause 2.1.1, Example 2</xref>
|
2122
|
+
</p>
|
2123
|
+
</foreword>
|
2124
|
+
</preface>
|
2125
|
+
<sections>
|
2126
|
+
<clause id='scope' type='scope' displayorder='2'>
|
2127
|
+
<title depth='1'>
|
2128
|
+
1.
|
2129
|
+
<tab/>
|
2130
|
+
Scope
|
2131
|
+
</title>
|
2132
|
+
</clause>
|
2133
|
+
<terms id='terms' displayorder='3'>
|
2134
|
+
<title>2.</title>
|
2135
|
+
<term id='_waxy_rice'>
|
2136
|
+
<name>2.1.</name>
|
2137
|
+
<preferred>waxy rice</preferred>
|
2138
|
+
<termexample id='note1'>
|
2139
|
+
<name>EXAMPLE</name>
|
2140
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2141
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
2142
|
+
kernels have a tendency to stick together after cooking.
|
2143
|
+
</p>
|
2144
|
+
</termexample>
|
2145
|
+
<term id='_nonwaxy_rice'>
|
2146
|
+
<name>2.1.1.</name>
|
2147
|
+
<preferred>nonwaxy rice</preferred>
|
2148
|
+
<termexample id='note2'>
|
2149
|
+
<name>EXAMPLE 1</name>
|
2150
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2151
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
2152
|
+
The kernels have a tendency to stick together after cooking.
|
2153
|
+
</p>
|
2154
|
+
</termexample>
|
2155
|
+
<termexample id='note3'>
|
2156
|
+
<name>EXAMPLE 2</name>
|
2157
|
+
<p id='_b0cb3dfd-78fc-47dd-a339-84070d947463'>
|
2158
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
2159
|
+
The kernels have a tendency to stick together after cooking.
|
2160
|
+
</p>
|
2161
|
+
</termexample>
|
2162
|
+
</term>
|
2163
|
+
</term>
|
2164
|
+
</terms>
|
2165
|
+
</sections>
|
2166
|
+
</iso-standard>
|
2167
|
+
OUTPUT
|
2168
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
2169
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
2170
|
+
end
|
2171
|
+
|
1907
2172
|
it "cross-references sections" do
|
1908
2173
|
input = <<~INPUT
|
1909
2174
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -1945,7 +2210,7 @@ RSpec.describe IsoDoc do
|
|
1945
2210
|
<terms id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
1946
2211
|
<title>Normal Terms</title>
|
1947
2212
|
<term id="J">
|
1948
|
-
<preferred>Term2</preferred>
|
2213
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
1949
2214
|
</term>
|
1950
2215
|
</terms>
|
1951
2216
|
<definitions id="K">
|
@@ -1999,7 +2264,7 @@ RSpec.describe IsoDoc do
|
|
1999
2264
|
<foreword obligation='informative' displayorder='1'>
|
2000
2265
|
<title>Foreword</title>
|
2001
2266
|
<p id='A'>
|
2002
|
-
This is a preamble
|
2267
|
+
This is a preamble
|
2003
2268
|
<xref target='C'>Introduction Subsection</xref>
|
2004
2269
|
<xref target='C1'>Introduction, 2</xref>
|
2005
2270
|
<xref target='D'>Clause 1</xref>
|
@@ -2453,7 +2718,7 @@ RSpec.describe IsoDoc do
|
|
2453
2718
|
.to be_equivalent_to xmlpp(output)
|
2454
2719
|
end
|
2455
2720
|
|
2456
|
-
|
2721
|
+
it "cross-references definition list terms" do
|
2457
2722
|
input = <<~INPUT
|
2458
2723
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2459
2724
|
<preface>
|
@@ -2533,7 +2798,7 @@ RSpec.describe IsoDoc do
|
|
2533
2798
|
.convert("test", input, true))
|
2534
2799
|
.at("//xmlns:foreword").to_xml))
|
2535
2800
|
.to be_equivalent_to xmlpp(output)
|
2536
|
-
|
2801
|
+
end
|
2537
2802
|
|
2538
2803
|
it "cross-references bookmarks" do
|
2539
2804
|
input = <<~INPUT
|
@@ -2617,348 +2882,4 @@ RSpec.describe IsoDoc do
|
|
2617
2882
|
.at("//xmlns:foreword").to_xml))
|
2618
2883
|
.to be_equivalent_to xmlpp(output)
|
2619
2884
|
end
|
2620
|
-
|
2621
|
-
it "realises subsequences" do
|
2622
|
-
input = <<~INPUT
|
2623
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2624
|
-
<preface>
|
2625
|
-
<foreword id="fwd">
|
2626
|
-
<p>
|
2627
|
-
<xref target="N1"/>
|
2628
|
-
<xref target="N2"/>
|
2629
|
-
<xref target="N3"/>
|
2630
|
-
<xref target="N4"/>
|
2631
|
-
<xref target="N5"/>
|
2632
|
-
<xref target="N6"/>
|
2633
|
-
<xref target="N7"/>
|
2634
|
-
<xref target="N8"/>
|
2635
|
-
</p>
|
2636
|
-
</foreword>
|
2637
|
-
<introduction id="intro">
|
2638
|
-
<figure id="N1"> <name>Split-it-right sample divider</name>
|
2639
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2640
|
-
</figure>
|
2641
|
-
<figure id="N2" subsequence="A"> <name>Split-it-right sample divider</name>
|
2642
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2643
|
-
</figure>
|
2644
|
-
<figure id="N3" subsequence="A"> <name>Split-it-right sample divider</name>
|
2645
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2646
|
-
</figure>
|
2647
|
-
<figure id="N4" subsequence="B"> <name>Split-it-right sample divider</name>
|
2648
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2649
|
-
</figure>
|
2650
|
-
<figure id="N5" subsequence="B"> <name>Split-it-right sample divider</name>
|
2651
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2652
|
-
</figure>
|
2653
|
-
<figure id="N6" subsequence="B"> <name>Split-it-right sample divider</name>
|
2654
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2655
|
-
</figure>
|
2656
|
-
<figure id="N7"> <name>Split-it-right sample divider</name>
|
2657
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2658
|
-
</figure>
|
2659
|
-
<figure id="N8"> <name>Split-it-right sample divider</name>
|
2660
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2661
|
-
</figure>
|
2662
|
-
</introduction>
|
2663
|
-
</iso-standard>
|
2664
|
-
INPUT
|
2665
|
-
output = <<~OUTPUT
|
2666
|
-
<foreword id='fwd' displayorder="1">
|
2667
|
-
<p>
|
2668
|
-
<xref target='N1'>Figure 1</xref>
|
2669
|
-
<xref target='N2'>Figure 2a</xref>
|
2670
|
-
<xref target='N3'>Figure 2b</xref>
|
2671
|
-
<xref target='N4'>Figure 3a</xref>
|
2672
|
-
<xref target='N5'>Figure 3b</xref>
|
2673
|
-
<xref target='N6'>Figure 3c</xref>
|
2674
|
-
<xref target='N7'>Figure 4</xref>
|
2675
|
-
<xref target='N8'>Figure 5</xref>
|
2676
|
-
</p>
|
2677
|
-
</foreword>
|
2678
|
-
OUTPUT
|
2679
|
-
expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
|
2680
|
-
.convert("test", input, true))
|
2681
|
-
.at("//xmlns:foreword").to_xml))
|
2682
|
-
.to be_equivalent_to xmlpp(output)
|
2683
|
-
end
|
2684
|
-
|
2685
|
-
it "realises numbering overrides" do
|
2686
|
-
input = <<~INPUT
|
2687
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2688
|
-
<preface>
|
2689
|
-
<foreword id="fwd">
|
2690
|
-
<p>
|
2691
|
-
<xref target="N1"/>
|
2692
|
-
<xref target="N2"/>
|
2693
|
-
<xref target="N3"/>
|
2694
|
-
<xref target="N4"/>
|
2695
|
-
<xref target="N5"/>
|
2696
|
-
<xref target="N6"/>
|
2697
|
-
<xref target="N7"/>
|
2698
|
-
<xref target="N8"/>
|
2699
|
-
<xref target="N9"/>
|
2700
|
-
<xref target="N10"/>
|
2701
|
-
<xref target="N11"/>
|
2702
|
-
<xref target="N12"/>
|
2703
|
-
<xref target="N13"/>
|
2704
|
-
</p>
|
2705
|
-
<p>
|
2706
|
-
<xref target="S1"/>
|
2707
|
-
<xref target="S2"/>
|
2708
|
-
<xref target="S3"/>
|
2709
|
-
<xref target="S4"/>
|
2710
|
-
<xref target="S12"/>
|
2711
|
-
<xref target="S13"/>
|
2712
|
-
<xref target="S14"/>
|
2713
|
-
<xref target="S15"/>
|
2714
|
-
<xref target="S16"/>
|
2715
|
-
<xref target="S17"/>
|
2716
|
-
<xref target="S18"/>
|
2717
|
-
<xref target="S19"/>
|
2718
|
-
<xref target="S20"/>
|
2719
|
-
<xref target="S21"/>
|
2720
|
-
<xref target="S22"/>
|
2721
|
-
<xref target="S23"/>
|
2722
|
-
<xref target="S24"/>
|
2723
|
-
<xref target="S25"/>
|
2724
|
-
<xref target="S26"/>
|
2725
|
-
<xref target="S27"/>
|
2726
|
-
<xref target="S28"/>
|
2727
|
-
<xref target="S29"/>
|
2728
|
-
<xref target="S30"/>
|
2729
|
-
</p>
|
2730
|
-
</foreword>
|
2731
|
-
<introduction id="intro">
|
2732
|
-
<figure id="N1"> <name>Split-it-right sample divider</name>
|
2733
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2734
|
-
</figure>
|
2735
|
-
<figure id="N2" number="A"> <name>Split-it-right sample divider</name>
|
2736
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2737
|
-
</figure>
|
2738
|
-
<figure id="N3"> <name>Split-it-right sample divider</name>
|
2739
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2740
|
-
</figure>
|
2741
|
-
<figure id="N4" number="7"> <name>Split-it-right sample divider</name>
|
2742
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2743
|
-
</figure>
|
2744
|
-
<figure id="N5"> <name>Split-it-right sample divider</name>
|
2745
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2746
|
-
</figure>
|
2747
|
-
<figure id="N6" subsequence="B"> <name>Split-it-right sample divider</name>
|
2748
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2749
|
-
</figure>
|
2750
|
-
<figure id="N7" subsequence="B" number="c"> <name>Split-it-right sample divider</name>
|
2751
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2752
|
-
</figure>
|
2753
|
-
<figure id="N8" subsequence="B"> <name>Split-it-right sample divider</name>
|
2754
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2755
|
-
</figure>
|
2756
|
-
<figure id="N9" subsequence="C" number="20f"> <name>Split-it-right sample divider</name>
|
2757
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2758
|
-
</figure>
|
2759
|
-
<figure id="N10" subsequence="C"> <name>Split-it-right sample divider</name>
|
2760
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2761
|
-
</figure>
|
2762
|
-
<figure id="N11" number="A.1"> <name>Split-it-right sample divider</name>
|
2763
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2764
|
-
</figure>
|
2765
|
-
<figure id="N12"> <name>Split-it-right sample divider</name>
|
2766
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2767
|
-
</figure>
|
2768
|
-
<figure id="N13" number="100"> <name>Split-it-right sample divider</name>
|
2769
|
-
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2770
|
-
</figure>
|
2771
|
-
</introduction>
|
2772
|
-
</preface>
|
2773
|
-
<sections>
|
2774
|
-
<clause id='S1' number='1bis' type='scope' inline-header='false' obligation='normative'>
|
2775
|
-
<title>Scope</title>
|
2776
|
-
<p id='_'>Text</p>
|
2777
|
-
</clause>
|
2778
|
-
<terms id='S3' number='3bis' obligation='normative'>
|
2779
|
-
<title>Terms and definitions</title>
|
2780
|
-
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
2781
|
-
<term id='S4' number='4bis'>
|
2782
|
-
<preferred>Term1</preferred>
|
2783
|
-
</term>
|
2784
|
-
</terms>
|
2785
|
-
<definitions id='S12' number='12bis' type='abbreviated_terms' obligation='normative'>
|
2786
|
-
<title>Abbreviated terms</title>
|
2787
|
-
</definitions>
|
2788
|
-
<clause id='S13' number='13bis' inline-header='false' obligation='normative'>
|
2789
|
-
<title>Clause 4</title>
|
2790
|
-
<clause id='S14' number='14bis' inline-header='false' obligation='normative'>
|
2791
|
-
<title>Introduction</title>
|
2792
|
-
</clause>
|
2793
|
-
<clause id='S15' inline-header='false' obligation='normative'>
|
2794
|
-
<title>Clause A</title>
|
2795
|
-
</clause>
|
2796
|
-
<clause id='S16' inline-header='false' obligation='normative'>
|
2797
|
-
<title>Clause B</title>
|
2798
|
-
</clause>
|
2799
|
-
<clause id='S17' number='0' inline-header='false' obligation='normative'>
|
2800
|
-
<title>Clause C</title>
|
2801
|
-
</clause>
|
2802
|
-
<clause id='S18' inline-header='false' obligation='normative'>
|
2803
|
-
<title>Clause D</title>
|
2804
|
-
</clause>
|
2805
|
-
<clause id='S19' inline-header='false' obligation='normative'>
|
2806
|
-
<title>Clause E</title>
|
2807
|
-
</clause>
|
2808
|
-
<clause id='S20' number='a' inline-header='false' obligation='normative'>
|
2809
|
-
<title>Clause F</title>
|
2810
|
-
</clause>
|
2811
|
-
<clause id='S21' inline-header='false' obligation='normative'>
|
2812
|
-
<title>Clause G</title>
|
2813
|
-
</clause>
|
2814
|
-
<clause id='S22' number='B' inline-header='false' obligation='normative'>
|
2815
|
-
<title>Clause H</title>
|
2816
|
-
</clause>
|
2817
|
-
<clause id='S23' inline-header='false' obligation='normative'>
|
2818
|
-
<title>Clause I</title>
|
2819
|
-
</clause>
|
2820
|
-
</clause>
|
2821
|
-
<clause id='S24' number='16bis' inline-header='false' obligation='normative'>
|
2822
|
-
<title>Terms and Definitions</title>
|
2823
|
-
</clause>
|
2824
|
-
</sections>
|
2825
|
-
<annex id='S25' obligation='normative'>
|
2826
|
-
<title>First Annex</title>
|
2827
|
-
</annex>
|
2828
|
-
<annex id='S26' number='17bis' inline-header='false' obligation='normative'>
|
2829
|
-
<title>Annex</title>
|
2830
|
-
<clause id='S27' number='18bis' inline-header='false' obligation='normative'>
|
2831
|
-
<title>Annex A.1</title>
|
2832
|
-
</clause>
|
2833
|
-
</annex>
|
2834
|
-
<annex id='S28' inline-header='false' obligation='normative'>
|
2835
|
-
<title>Another Annex</title>
|
2836
|
-
</annex>
|
2837
|
-
<bibliography>
|
2838
|
-
<references id='S2' number='2bis' normative='true' obligation='informative'>
|
2839
|
-
<title>Normative references</title>
|
2840
|
-
<p id='_'>There are no normative references in this document.</p>
|
2841
|
-
</references>
|
2842
|
-
<clause id='S29' number='19bis' obligation='informative'>
|
2843
|
-
<title>Bibliography</title>
|
2844
|
-
<references id='S30' number='20bis' normative='false' obligation='informative'>
|
2845
|
-
<title>Bibliography Subsection</title>
|
2846
|
-
</references>
|
2847
|
-
</clause>
|
2848
|
-
</bibliography>
|
2849
|
-
</iso-standard>
|
2850
|
-
INPUT
|
2851
|
-
output = <<~OUTPUT
|
2852
|
-
<foreword id='fwd' displayorder='1'>
|
2853
|
-
<p>
|
2854
|
-
<xref target='N1'>Figure 1</xref>
|
2855
|
-
<xref target='N2'>Figure A</xref>
|
2856
|
-
<xref target='N3'>Figure B</xref>
|
2857
|
-
<xref target='N4'>Figure 7</xref>
|
2858
|
-
<xref target='N5'>Figure 8</xref>
|
2859
|
-
<xref target='N6'>Figure 9a</xref>
|
2860
|
-
<xref target='N7'>Figure 9c</xref>
|
2861
|
-
<xref target='N8'>Figure 9d</xref>
|
2862
|
-
<xref target='N9'>Figure 20f</xref>
|
2863
|
-
<xref target='N10'>Figure 20g</xref>
|
2864
|
-
<xref target='N11'>Figure A.1</xref>
|
2865
|
-
<xref target='N12'>Figure A.2</xref>
|
2866
|
-
<xref target='N13'>Figure 100</xref>
|
2867
|
-
</p>
|
2868
|
-
<p>
|
2869
|
-
<xref target='S1'>Clause 1bis</xref>
|
2870
|
-
<xref target='S2'>Clause 2bis</xref>
|
2871
|
-
<xref target='S3'>Clause 3bis</xref>
|
2872
|
-
<xref target='S4'>Clause 3bis.4bis</xref>
|
2873
|
-
<xref target='S12'>Clause 12bis</xref>
|
2874
|
-
<xref target='S13'>Clause 13bis</xref>
|
2875
|
-
<xref target='S14'>Clause 13bis.14bis</xref>
|
2876
|
-
<xref target='S15'>Clause 13bis.14bit</xref>
|
2877
|
-
<xref target='S16'>Clause 13bis.14biu</xref>
|
2878
|
-
<xref target='S17'>Clause 13bis.0</xref>
|
2879
|
-
<xref target='S18'>Clause 13bis.1</xref>
|
2880
|
-
<xref target='S19'>Clause 13bis.2</xref>
|
2881
|
-
<xref target='S20'>Clause 13bis.a</xref>
|
2882
|
-
<xref target='S21'>Clause 13bis.b</xref>
|
2883
|
-
<xref target='S22'>Clause 13bis.B</xref>
|
2884
|
-
<xref target='S23'>Clause 13bis.C</xref>
|
2885
|
-
<xref target='S24'>Clause 16bis</xref>
|
2886
|
-
<xref target='S25'>Annex A</xref>
|
2887
|
-
<xref target='S26'>Annex 17bis</xref>
|
2888
|
-
<xref target='S27'>Annex 17bis.18bis</xref>
|
2889
|
-
<xref target='S28'>Annex 17bit</xref>
|
2890
|
-
<xref target='S29'>Bibliography</xref>
|
2891
|
-
<xref target='S30'>Bibliography Subsection</xref>
|
2892
|
-
</p>
|
2893
|
-
</foreword>
|
2894
|
-
OUTPUT
|
2895
|
-
expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
|
2896
|
-
.convert("test", input, true))
|
2897
|
-
.at("//xmlns:foreword").to_xml))
|
2898
|
-
.to be_equivalent_to xmlpp(output)
|
2899
|
-
end
|
2900
|
-
|
2901
|
-
it "realises roman counter for xrefs" do
|
2902
|
-
a = IsoDoc::XrefGen::Counter.new(0, numerals: :roman)
|
2903
|
-
a.increment({})
|
2904
|
-
expect(a.print).to eq "I"
|
2905
|
-
a.increment({})
|
2906
|
-
expect(a.print).to eq "II"
|
2907
|
-
a.increment({})
|
2908
|
-
expect(a.print).to eq "III"
|
2909
|
-
a.increment({})
|
2910
|
-
expect(a.print).to eq "IV"
|
2911
|
-
a.increment({})
|
2912
|
-
expect(a.print).to eq "V"
|
2913
|
-
end
|
2914
|
-
|
2915
|
-
it "skips I in counter for xrefs" do
|
2916
|
-
a = IsoDoc::XrefGen::Counter.new("@", skip_i: true)
|
2917
|
-
a.increment({})
|
2918
|
-
a.increment({})
|
2919
|
-
a.increment({})
|
2920
|
-
a.increment({})
|
2921
|
-
a.increment({})
|
2922
|
-
a.increment({})
|
2923
|
-
a.increment({})
|
2924
|
-
a.increment({})
|
2925
|
-
expect(a.print).to eq "H"
|
2926
|
-
a.increment({})
|
2927
|
-
expect(a.print).to eq "J"
|
2928
|
-
a = IsoDoc::XrefGen::Counter.new("@")
|
2929
|
-
a.increment({})
|
2930
|
-
a.increment({})
|
2931
|
-
a.increment({})
|
2932
|
-
a.increment({})
|
2933
|
-
a.increment({})
|
2934
|
-
a.increment({})
|
2935
|
-
a.increment({})
|
2936
|
-
a.increment({})
|
2937
|
-
expect(a.print).to eq "H"
|
2938
|
-
a.increment({})
|
2939
|
-
expect(a.print).to eq "I"
|
2940
|
-
end
|
2941
|
-
|
2942
|
-
it "increments counter past Z for xrefs" do
|
2943
|
-
a = IsoDoc::XrefGen::Counter.new("Z")
|
2944
|
-
a.increment({})
|
2945
|
-
expect(a.print).to eq "AA"
|
2946
|
-
a.increment({})
|
2947
|
-
expect(a.print).to eq "AB"
|
2948
|
-
a = IsoDoc::XrefGen::Counter.new("BZ")
|
2949
|
-
a.increment({})
|
2950
|
-
expect(a.print).to eq "CA"
|
2951
|
-
a.increment({})
|
2952
|
-
expect(a.print).to eq "CB"
|
2953
|
-
a = IsoDoc::XrefGen::Counter.new("z")
|
2954
|
-
a.increment({})
|
2955
|
-
expect(a.print).to eq "aa"
|
2956
|
-
a.increment({})
|
2957
|
-
expect(a.print).to eq "ab"
|
2958
|
-
a = IsoDoc::XrefGen::Counter.new("Az")
|
2959
|
-
a.increment({})
|
2960
|
-
expect(a.print).to eq "Ba"
|
2961
|
-
a.increment({})
|
2962
|
-
expect(a.print).to eq "Bb"
|
2963
|
-
end
|
2964
2885
|
end
|