metanorma-iso 1.8.6 → 1.9.0
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/lib/asciidoctor/iso/cleanup.rb +0 -1
- data/lib/asciidoctor/iso/isodoc.rng +32 -7
- data/lib/asciidoctor/iso/isostandard.rng +7 -3
- data/lib/asciidoctor/iso/section.rb +3 -0
- data/lib/asciidoctor/iso/validate.rb +4 -17
- data/lib/asciidoctor/iso/validate_section.rb +50 -34
- data/lib/asciidoctor/iso/validate_style.rb +3 -3
- data/lib/isodoc/iso/base_convert.rb +31 -6
- data/lib/isodoc/iso/iso.amendment.xsl +122 -84
- data/lib/isodoc/iso/iso.international-standard.xsl +122 -84
- data/lib/isodoc/iso/isosts_convert.rb +12 -13
- data/lib/isodoc/iso/presentation_xml_convert.rb +51 -7
- data/lib/isodoc/iso/sts_convert.rb +4 -5
- data/lib/isodoc/iso/xref.rb +17 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor/section_spec.rb +128 -7
- data/spec/asciidoctor/validate_spec.rb +15 -15
- data/spec/isodoc/amd_spec.rb +2 -2
- data/spec/isodoc/inline_spec.rb +312 -122
- data/spec/isodoc/section_spec.rb +194 -71
- metadata +3 -3
@@ -2099,88 +2099,6 @@
|
|
2099
2099
|
<xsl:text>iVBORw0KGgoAAAANSUhEUgAAAFEAAABHCAIAAADwYjznAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAA66SURBVHhezZt5sM/VG8fNVH7JruxkSZKQ3TAYS7aGajKpFBnRxBjjkhrLrRgmYwm59hrGjC0miSmmIgoVZYu00GJtxkyMkV2/1+fzPh7nfr7fe33v/X6/9/d7/3HmOc/nLM/7PM95zjnfS6F//xc4f/786dOnXaXAUdCcjx071rt373vvvbdChQrNmzdfuXKl+1CAKFDOR44cqVWrVqF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9UjA5aJH9qzQRYH/fvn3hAiN4Ebncfy5duuQ4Dx48mLyibzRq0aLFDz/8QAIE7I28Ik+9btk4fzYAOO/bt6927dpyNYA299OAM3ncfySTvXiOjh49msvw8OHDrYxUTekj0tLgV5FVNcFgelV9+J/iNrOqfR02bNibb77JrhY1uZN3yPnz5wsdOHDA/uYmQJvPNAUSIlXBlw1xlSBux5wa+6CN38yqEoD0Bl+JAC/YQUruROYxV+jPP//UHzhDN7vbguQIctJHELdZrDIRDUhwUpBTS/T6BP8SJUrwjA32M9cj/d/zILuFV3MTBKua0qomhOoAvtJgn0yQbBogpcFpQ5jG9BEhUvpVARmO7dq141QOOF++fJk0Vq5cOb5pVf5PoLBMHvDiFtShQwf9EuzOZ3D06NFNmzbpfKI0KPUDyVZK8GUrfZjeBCsFk4MWubYJPnswvSFSFVBu3ryZJ5fj+e+//wVuVmgt0lkFPgAAAABJRU5ErkJggg==</xsl:text>
|
2100
2100
|
</xsl:variable>
|
2101
2101
|
|
2102
|
-
<xsl:template name="number-to-words">
|
2103
|
-
<xsl:param name="number"/>
|
2104
|
-
<xsl:variable name="words">
|
2105
|
-
<words>
|
2106
|
-
<word cardinal="1">One-</word>
|
2107
|
-
<word ordinal="1">First </word>
|
2108
|
-
<word cardinal="2">Two-</word>
|
2109
|
-
<word ordinal="2">Second </word>
|
2110
|
-
<word cardinal="3">Three-</word>
|
2111
|
-
<word ordinal="3">Third </word>
|
2112
|
-
<word cardinal="4">Four-</word>
|
2113
|
-
<word ordinal="4">Fourth </word>
|
2114
|
-
<word cardinal="5">Five-</word>
|
2115
|
-
<word ordinal="5">Fifth </word>
|
2116
|
-
<word cardinal="6">Six-</word>
|
2117
|
-
<word ordinal="6">Sixth </word>
|
2118
|
-
<word cardinal="7">Seven-</word>
|
2119
|
-
<word ordinal="7">Seventh </word>
|
2120
|
-
<word cardinal="8">Eight-</word>
|
2121
|
-
<word ordinal="8">Eighth </word>
|
2122
|
-
<word cardinal="9">Nine-</word>
|
2123
|
-
<word ordinal="9">Ninth </word>
|
2124
|
-
<word ordinal="10">Tenth </word>
|
2125
|
-
<word ordinal="11">Eleventh </word>
|
2126
|
-
<word ordinal="12">Twelfth </word>
|
2127
|
-
<word ordinal="13">Thirteenth </word>
|
2128
|
-
<word ordinal="14">Fourteenth </word>
|
2129
|
-
<word ordinal="15">Fifteenth </word>
|
2130
|
-
<word ordinal="16">Sixteenth </word>
|
2131
|
-
<word ordinal="17">Seventeenth </word>
|
2132
|
-
<word ordinal="18">Eighteenth </word>
|
2133
|
-
<word ordinal="19">Nineteenth </word>
|
2134
|
-
<word cardinal="20">Twenty-</word>
|
2135
|
-
<word ordinal="20">Twentieth </word>
|
2136
|
-
<word cardinal="30">Thirty-</word>
|
2137
|
-
<word ordinal="30">Thirtieth </word>
|
2138
|
-
<word cardinal="40">Forty-</word>
|
2139
|
-
<word ordinal="40">Fortieth </word>
|
2140
|
-
<word cardinal="50">Fifty-</word>
|
2141
|
-
<word ordinal="50">Fiftieth </word>
|
2142
|
-
<word cardinal="60">Sixty-</word>
|
2143
|
-
<word ordinal="60">Sixtieth </word>
|
2144
|
-
<word cardinal="70">Seventy-</word>
|
2145
|
-
<word ordinal="70">Seventieth </word>
|
2146
|
-
<word cardinal="80">Eighty-</word>
|
2147
|
-
<word ordinal="80">Eightieth </word>
|
2148
|
-
<word cardinal="90">Ninety-</word>
|
2149
|
-
<word ordinal="90">Ninetieth </word>
|
2150
|
-
<word cardinal="100">Hundred-</word>
|
2151
|
-
<word ordinal="100">Hundredth </word>
|
2152
|
-
</words>
|
2153
|
-
</xsl:variable>
|
2154
|
-
|
2155
|
-
<xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
|
2156
|
-
|
2157
|
-
<xsl:choose>
|
2158
|
-
<xsl:when test="$ordinal != ''">
|
2159
|
-
<xsl:value-of select="$ordinal"/>
|
2160
|
-
</xsl:when>
|
2161
|
-
<xsl:otherwise>
|
2162
|
-
<xsl:choose>
|
2163
|
-
<xsl:when test="$number < 100">
|
2164
|
-
<xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
|
2165
|
-
<xsl:variable name="digit" select="substring($number,2)"/>
|
2166
|
-
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
|
2167
|
-
<xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
|
2168
|
-
</xsl:when>
|
2169
|
-
<xsl:otherwise>
|
2170
|
-
<!-- more 100 -->
|
2171
|
-
<xsl:variable name="hundred" select="substring($number,1,1)"/>
|
2172
|
-
<xsl:variable name="digits" select="number(substring($number,2))"/>
|
2173
|
-
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
|
2174
|
-
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
|
2175
|
-
<xsl:call-template name="number-to-words">
|
2176
|
-
<xsl:with-param name="number" select="$digits"/>
|
2177
|
-
</xsl:call-template>
|
2178
|
-
</xsl:otherwise>
|
2179
|
-
</xsl:choose>
|
2180
|
-
</xsl:otherwise>
|
2181
|
-
</xsl:choose>
|
2182
|
-
</xsl:template>
|
2183
|
-
|
2184
2102
|
<xsl:template name="printEdition">
|
2185
2103
|
<xsl:variable name="edition" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:edition)"/>
|
2186
2104
|
<xsl:text> </xsl:text>
|
@@ -3424,6 +3342,7 @@
|
|
3424
3342
|
<fo:table-row>
|
3425
3343
|
<fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
|
3426
3344
|
|
3345
|
+
|
3427
3346
|
<xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
|
3428
3347
|
|
3429
3348
|
|
@@ -3436,6 +3355,10 @@
|
|
3436
3355
|
|
3437
3356
|
|
3438
3357
|
|
3358
|
+
|
3359
|
+
<!-- for BSI (not PAS) display Notes before footnotes -->
|
3360
|
+
|
3361
|
+
|
3439
3362
|
<!-- except gb -->
|
3440
3363
|
|
3441
3364
|
<xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
|
@@ -3461,6 +3384,10 @@
|
|
3461
3384
|
<!-- fn processing -->
|
3462
3385
|
<xsl:call-template name="fn_display"/>
|
3463
3386
|
|
3387
|
+
|
3388
|
+
<!-- for PAS display Notes after footnotes -->
|
3389
|
+
|
3390
|
+
|
3464
3391
|
</fo:table-cell>
|
3465
3392
|
</fo:table-row>
|
3466
3393
|
</fo:table-body>
|
@@ -3569,6 +3496,7 @@
|
|
3569
3496
|
</xsl:if>
|
3570
3497
|
<xsl:if test="$parent-name = 'tfoot'">
|
3571
3498
|
|
3499
|
+
|
3572
3500
|
<xsl:attribute name="font-size">9pt</xsl:attribute>
|
3573
3501
|
<xsl:attribute name="border-left">solid black 1pt</xsl:attribute>
|
3574
3502
|
<xsl:attribute name="border-right">solid black 1pt</xsl:attribute>
|
@@ -3704,6 +3632,7 @@
|
|
3704
3632
|
|
3705
3633
|
<fo:block font-size="10pt" margin-bottom="12pt">
|
3706
3634
|
|
3635
|
+
|
3707
3636
|
<xsl:attribute name="font-size">9pt</xsl:attribute>
|
3708
3637
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
3709
3638
|
|
@@ -3713,8 +3642,12 @@
|
|
3713
3642
|
|
3714
3643
|
|
3715
3644
|
|
3645
|
+
<!-- Table's note name (NOTE, for example) -->
|
3646
|
+
|
3716
3647
|
<fo:inline padding-right="2mm">
|
3717
3648
|
|
3649
|
+
|
3650
|
+
|
3718
3651
|
|
3719
3652
|
|
3720
3653
|
|
@@ -3722,6 +3655,8 @@
|
|
3722
3655
|
|
3723
3656
|
</fo:inline>
|
3724
3657
|
|
3658
|
+
|
3659
|
+
|
3725
3660
|
<xsl:apply-templates mode="process"/>
|
3726
3661
|
</fo:block>
|
3727
3662
|
|
@@ -3741,6 +3676,8 @@
|
|
3741
3676
|
<xsl:variable name="reference" select="@reference"/>
|
3742
3677
|
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
3743
3678
|
<fo:block margin-bottom="12pt">
|
3679
|
+
|
3680
|
+
|
3744
3681
|
|
3745
3682
|
<xsl:attribute name="font-size">9pt</xsl:attribute>
|
3746
3683
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
@@ -3763,6 +3700,7 @@
|
|
3763
3700
|
<xsl:value-of select="@reference"/>
|
3764
3701
|
|
3765
3702
|
|
3703
|
+
|
3766
3704
|
</fo:inline>
|
3767
3705
|
<fo:inline>
|
3768
3706
|
|
@@ -3918,6 +3856,7 @@
|
|
3918
3856
|
|
3919
3857
|
<xsl:value-of select="@reference"/>
|
3920
3858
|
|
3859
|
+
|
3921
3860
|
</fo:basic-link>
|
3922
3861
|
</fo:inline>
|
3923
3862
|
</xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
|
@@ -4944,6 +4883,7 @@
|
|
4944
4883
|
|
4945
4884
|
|
4946
4885
|
|
4886
|
+
|
4947
4887
|
<fo:block-container margin-left="0mm">
|
4948
4888
|
|
4949
4889
|
|
@@ -6151,9 +6091,10 @@
|
|
6151
6091
|
|
6152
6092
|
|
6153
6093
|
</xsl:if>
|
6154
|
-
|
6094
|
+
|
6095
|
+
|
6096
|
+
|
6155
6097
|
<fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
|
6156
|
-
|
6157
6098
|
<xsl:if test="normalize-space(@citeas) = ''">
|
6158
6099
|
<xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
|
6159
6100
|
</xsl:if>
|
@@ -6161,6 +6102,7 @@
|
|
6161
6102
|
|
6162
6103
|
|
6163
6104
|
|
6105
|
+
|
6164
6106
|
</xsl:if>
|
6165
6107
|
|
6166
6108
|
<xsl:apply-templates/>
|
@@ -7105,4 +7047,100 @@
|
|
7105
7047
|
<xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
|
7106
7048
|
</xsl:choose>
|
7107
7049
|
</xsl:attribute>
|
7050
|
+
</xsl:template><xsl:template name="number-to-words">
|
7051
|
+
<xsl:param name="number"/>
|
7052
|
+
<xsl:param name="first"/>
|
7053
|
+
<xsl:if test="$number != ''">
|
7054
|
+
<xsl:variable name="words">
|
7055
|
+
<words>
|
7056
|
+
<word cardinal="1">One-</word>
|
7057
|
+
<word ordinal="1">First </word>
|
7058
|
+
<word cardinal="2">Two-</word>
|
7059
|
+
<word ordinal="2">Second </word>
|
7060
|
+
<word cardinal="3">Three-</word>
|
7061
|
+
<word ordinal="3">Third </word>
|
7062
|
+
<word cardinal="4">Four-</word>
|
7063
|
+
<word ordinal="4">Fourth </word>
|
7064
|
+
<word cardinal="5">Five-</word>
|
7065
|
+
<word ordinal="5">Fifth </word>
|
7066
|
+
<word cardinal="6">Six-</word>
|
7067
|
+
<word ordinal="6">Sixth </word>
|
7068
|
+
<word cardinal="7">Seven-</word>
|
7069
|
+
<word ordinal="7">Seventh </word>
|
7070
|
+
<word cardinal="8">Eight-</word>
|
7071
|
+
<word ordinal="8">Eighth </word>
|
7072
|
+
<word cardinal="9">Nine-</word>
|
7073
|
+
<word ordinal="9">Ninth </word>
|
7074
|
+
<word ordinal="10">Tenth </word>
|
7075
|
+
<word ordinal="11">Eleventh </word>
|
7076
|
+
<word ordinal="12">Twelfth </word>
|
7077
|
+
<word ordinal="13">Thirteenth </word>
|
7078
|
+
<word ordinal="14">Fourteenth </word>
|
7079
|
+
<word ordinal="15">Fifteenth </word>
|
7080
|
+
<word ordinal="16">Sixteenth </word>
|
7081
|
+
<word ordinal="17">Seventeenth </word>
|
7082
|
+
<word ordinal="18">Eighteenth </word>
|
7083
|
+
<word ordinal="19">Nineteenth </word>
|
7084
|
+
<word cardinal="20">Twenty-</word>
|
7085
|
+
<word ordinal="20">Twentieth </word>
|
7086
|
+
<word cardinal="30">Thirty-</word>
|
7087
|
+
<word ordinal="30">Thirtieth </word>
|
7088
|
+
<word cardinal="40">Forty-</word>
|
7089
|
+
<word ordinal="40">Fortieth </word>
|
7090
|
+
<word cardinal="50">Fifty-</word>
|
7091
|
+
<word ordinal="50">Fiftieth </word>
|
7092
|
+
<word cardinal="60">Sixty-</word>
|
7093
|
+
<word ordinal="60">Sixtieth </word>
|
7094
|
+
<word cardinal="70">Seventy-</word>
|
7095
|
+
<word ordinal="70">Seventieth </word>
|
7096
|
+
<word cardinal="80">Eighty-</word>
|
7097
|
+
<word ordinal="80">Eightieth </word>
|
7098
|
+
<word cardinal="90">Ninety-</word>
|
7099
|
+
<word ordinal="90">Ninetieth </word>
|
7100
|
+
<word cardinal="100">Hundred-</word>
|
7101
|
+
<word ordinal="100">Hundredth </word>
|
7102
|
+
</words>
|
7103
|
+
</xsl:variable>
|
7104
|
+
|
7105
|
+
<xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
|
7106
|
+
|
7107
|
+
<xsl:variable name="value">
|
7108
|
+
<xsl:choose>
|
7109
|
+
<xsl:when test="$ordinal != ''">
|
7110
|
+
<xsl:value-of select="$ordinal"/>
|
7111
|
+
</xsl:when>
|
7112
|
+
<xsl:otherwise>
|
7113
|
+
<xsl:choose>
|
7114
|
+
<xsl:when test="$number < 100">
|
7115
|
+
<xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
|
7116
|
+
<xsl:variable name="digit" select="substring($number,2)"/>
|
7117
|
+
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
|
7118
|
+
<xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
|
7119
|
+
</xsl:when>
|
7120
|
+
<xsl:otherwise>
|
7121
|
+
<!-- more 100 -->
|
7122
|
+
<xsl:variable name="hundred" select="substring($number,1,1)"/>
|
7123
|
+
<xsl:variable name="digits" select="number(substring($number,2))"/>
|
7124
|
+
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
|
7125
|
+
<xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
|
7126
|
+
<xsl:call-template name="number-to-words">
|
7127
|
+
<xsl:with-param name="number" select="$digits"/>
|
7128
|
+
</xsl:call-template>
|
7129
|
+
</xsl:otherwise>
|
7130
|
+
</xsl:choose>
|
7131
|
+
</xsl:otherwise>
|
7132
|
+
</xsl:choose>
|
7133
|
+
</xsl:variable>
|
7134
|
+
<xsl:choose>
|
7135
|
+
<xsl:when test="$first = 'true'">
|
7136
|
+
<xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
|
7137
|
+
<xsl:call-template name="capitalize">
|
7138
|
+
<xsl:with-param name="str" select="$value_lc"/>
|
7139
|
+
</xsl:call-template>
|
7140
|
+
</xsl:when>
|
7141
|
+
<xsl:otherwise>
|
7142
|
+
<xsl:value-of select="$value"/>
|
7143
|
+
</xsl:otherwise>
|
7144
|
+
</xsl:choose>
|
7145
|
+
</xsl:if>
|
7108
7146
|
</xsl:template></xsl:stylesheet>
|
@@ -1,31 +1,30 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require "
|
2
|
+
require "mnconvert"
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iso
|
6
|
-
|
7
6
|
# A {Converter} implementation that generates HTML output, and a document
|
8
7
|
# schema encapsulation of the document for validation
|
9
8
|
#
|
10
9
|
class IsoStsConvert < IsoDoc::XslfoPdfConvert
|
11
|
-
def initialize(
|
10
|
+
def initialize(_options)
|
12
11
|
@libdir = File.dirname(__FILE__)
|
13
12
|
@format = :isosts
|
14
13
|
@suffix = "isosts.xml"
|
15
14
|
end
|
16
15
|
|
17
|
-
def convert(
|
18
|
-
file = File.read(
|
19
|
-
|
20
|
-
/\.xml$/.match(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def convert(input_fname, file = nil, debug = false, output_fname = nil)
|
17
|
+
file = File.read(input_fname, encoding: "utf-8") if file.nil?
|
18
|
+
_, fname, dir = convert_init(file, input_fname, debug)
|
19
|
+
/\.xml$/.match(input_fname) or
|
20
|
+
input_fname = Tempfile.open([fname, ".xml"], encoding: "utf-8") do |f|
|
21
|
+
f.write file
|
22
|
+
f.path
|
23
|
+
end
|
25
24
|
FileUtils.rm_rf dir
|
26
|
-
|
25
|
+
MnConvert.convert(input_fname, output_fname || "#{fname}.#{@suffix}",
|
26
|
+
MnConvert::InputFormat::MN, { output_format: :iso })
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
@@ -112,14 +112,58 @@ module IsoDoc
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def concept(docxml)
|
116
|
+
docxml.xpath(ns("//terms//concept")).each_with_object({}) do |f, m|
|
117
|
+
concept_term(f, m)
|
118
|
+
end
|
119
|
+
docxml.xpath(ns("//concept")).each do |node|
|
120
|
+
concept_render(node, node["ital"] || "false", node["ref"] || "false")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def concept_term(node, seen)
|
125
|
+
term = node&.at(ns("./refterm"))&.to_xml
|
126
|
+
if term && seen[term]
|
127
|
+
concept_render(node, node["ital"] || "false", node["ref"] || "false")
|
128
|
+
else concept_render(node, node["ital"] || "true", node["ref"] || "true")
|
129
|
+
end
|
130
|
+
seen[term] = true if term
|
131
|
+
seen
|
132
|
+
end
|
133
|
+
|
134
|
+
def concept1_ref(node, ref)
|
135
|
+
if r = node.at(ns("./xref | ./eref | ./termref"))
|
136
|
+
return r.remove if ref == "false"
|
137
|
+
|
138
|
+
r.name == "termref" and
|
139
|
+
r.replace(@i18n.term_defined_in.sub(/%/, r.to_xml)) or
|
140
|
+
r.replace("(#{r.to_xml})")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
115
144
|
def concept1(node)
|
116
|
-
node&.at(ns("./
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
145
|
+
node.replace(node&.at(ns("./renderterm"))&.children ||
|
146
|
+
node&.at(ns("./refterm"))&.children ||
|
147
|
+
node.children)
|
148
|
+
end
|
149
|
+
|
150
|
+
# we're assuming terms and clauses in the right place for display,
|
151
|
+
# to cope with multiple terms sections
|
152
|
+
|
153
|
+
def display_order(docxml)
|
154
|
+
i = 0
|
155
|
+
i = display_order_xpath(docxml, "//preface/*", i)
|
156
|
+
i = display_order_at(docxml, "//clause[@type = 'scope']", i)
|
157
|
+
i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
|
158
|
+
# i = display_order_at(docxml, "//sections/terms | "\
|
159
|
+
# "//sections/clause[descendant::terms]", i)
|
160
|
+
# i = display_order_at(docxml, "//sections/definitions", i)
|
161
|
+
# i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
|
162
|
+
i = display_order_xpath(docxml, "//sections/clause[not(@type = 'scope')] | "\
|
163
|
+
"//sections/terms | //sections/definitions", i)
|
164
|
+
i = display_order_xpath(docxml, "//annex", i)
|
165
|
+
i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
|
166
|
+
display_order_xpath(docxml, "//indexsect", i)
|
123
167
|
end
|
124
168
|
|
125
169
|
include Init
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require "
|
2
|
+
require "mnconvert"
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iso
|
6
|
-
|
7
6
|
class StsConvert < IsoDoc::XslfoPdfConvert
|
8
7
|
def initialize(_options) # rubocop:disable Lint/MissingSuper
|
9
8
|
@libdir = File.dirname(__FILE__)
|
@@ -14,14 +13,14 @@ module IsoDoc
|
|
14
13
|
def convert(in_fname, file = nil, debug = false, out_fname = nil)
|
15
14
|
file = File.read(in_fname, encoding: "utf-8") if file.nil?
|
16
15
|
_docxml, filename, dir = convert_init(file, in_fname, debug)
|
17
|
-
|
16
|
+
/\.xml$/.match?(in_fname) or
|
18
17
|
in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
19
18
|
f.write file
|
20
19
|
f.path
|
21
20
|
end
|
22
|
-
end
|
23
21
|
FileUtils.rm_rf dir
|
24
|
-
|
22
|
+
Mnconvert.convert(in_fname, out_fname || "#{filename}.#{@suffix}",
|
23
|
+
MnConvert::InputFormat::MN)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -8,7 +8,7 @@ module IsoDoc
|
|
8
8
|
if @klass.amd(doc)
|
9
9
|
initial_anchor_names_amd(doc)
|
10
10
|
else
|
11
|
-
|
11
|
+
initial_anchor_names1(doc)
|
12
12
|
end
|
13
13
|
introduction_names(doc.at(ns("//introduction")))
|
14
14
|
end
|
@@ -26,6 +26,22 @@ module IsoDoc
|
|
26
26
|
termexample_anchor_names(doc)
|
27
27
|
end
|
28
28
|
|
29
|
+
def initial_anchor_names1(doc)
|
30
|
+
doc.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
|
31
|
+
# potentially overridden in middle_section_asset_names()
|
32
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
33
|
+
n = Counter.new
|
34
|
+
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
35
|
+
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
36
|
+
doc.xpath(ns("//sections/clause[not(@type = 'scope')] | "\
|
37
|
+
"//sections/terms | //sections/definitions")).each do |c|
|
38
|
+
n = section_names(c, n, 1)
|
39
|
+
end
|
40
|
+
middle_section_asset_names(doc)
|
41
|
+
termnote_anchor_names(doc)
|
42
|
+
termexample_anchor_names(doc)
|
43
|
+
end
|
44
|
+
|
29
45
|
# we can reference 0-number clauses in introduction
|
30
46
|
def introduction_names(clause)
|
31
47
|
return if clause.nil?
|