metanorma-iso 1.8.0 → 1.8.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/lib/asciidoctor/iso/base.rb +13 -11
- data/lib/asciidoctor/iso/cleanup.rb +27 -23
- data/lib/asciidoctor/iso/front.rb +25 -15
- data/lib/asciidoctor/iso/validate.rb +22 -110
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +39 -20
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +2 -4
- data/lib/isodoc/iso/base_convert.rb +8 -2
- data/lib/isodoc/iso/iso.amendment.xsl +326 -61
- data/lib/isodoc/iso/iso.international-standard.xsl +326 -61
- data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
- data/lib/isodoc/iso/xref.rb +2 -2
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +36 -7
- data/spec/asciidoctor/validate_spec.rb +120 -65
- metadata +3 -2
@@ -54,14 +54,12 @@ module Asciidoctor
|
|
54
54
|
doctypes = /International\sStandard | Technical\sSpecification |
|
55
55
|
Publicly\sAvailable\sSpecification | Technical\sReport | Guide /xi
|
56
56
|
title_main_en = title_lang_part(root, "main", "en")
|
57
|
-
|
57
|
+
!title_main_en.nil? && doctypes.match(title_main_en.text) and
|
58
58
|
@log.add("Style", title_main_en, "Main Title may name document type")
|
59
|
-
end
|
60
59
|
title_intro_en = title_lang_part(root, "intro", "en")
|
61
|
-
|
60
|
+
!title_intro_en.nil? && doctypes.match(title_intro_en.text) and
|
62
61
|
@log.add("Style", title_intro_en,
|
63
62
|
"Title Intro may name document type")
|
64
|
-
end
|
65
63
|
end
|
66
64
|
|
67
65
|
# ISO/IEC DIR 2, 22.2
|
@@ -15,6 +15,7 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
def implicit_reference(b)
|
17
17
|
return true if b&.at(ns("./docidentifier"))&.text == "IEV"
|
18
|
+
|
18
19
|
super
|
19
20
|
end
|
20
21
|
|
@@ -27,8 +28,9 @@ module IsoDoc
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
def example_span_label(
|
31
|
+
def example_span_label(_node, div, name)
|
31
32
|
return if name.nil?
|
33
|
+
|
32
34
|
div.span **{ class: "example_label" } do |p|
|
33
35
|
name.children.each { |n| parse(n, div) }
|
34
36
|
end
|
@@ -56,6 +58,7 @@ module IsoDoc
|
|
56
58
|
node.elements.each do |e|
|
57
59
|
next if e.name == "name"
|
58
60
|
return true if e.name == "p"
|
61
|
+
|
59
62
|
return false
|
60
63
|
end
|
61
64
|
false
|
@@ -74,6 +77,7 @@ module IsoDoc
|
|
74
77
|
def insertall_after_here(node, insert, name)
|
75
78
|
node.children.each do |n|
|
76
79
|
next unless n.name == name
|
80
|
+
|
77
81
|
insert.next = n.remove
|
78
82
|
insert = n
|
79
83
|
end
|
@@ -83,6 +87,7 @@ module IsoDoc
|
|
83
87
|
def termexamples_before_termnotes(node)
|
84
88
|
return unless node.at(ns("./termnote")) && node.at(ns("./termexample"))
|
85
89
|
return unless insert = node.at(ns("./definition"))
|
90
|
+
|
86
91
|
insert = insertall_after_here(node, insert, "termexample")
|
87
92
|
insert = insertall_after_here(node, insert, "termnote")
|
88
93
|
end
|
@@ -110,6 +115,7 @@ module IsoDoc
|
|
110
115
|
return super unless (dl&.xpath(ns("./dt"))&.size == 1 &&
|
111
116
|
dl&.at(ns("./dd"))&.elements&.size == 1 &&
|
112
117
|
dl&.at(ns("./dd/p")))
|
118
|
+
|
113
119
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
114
120
|
s << "#{@i18n.where} "
|
115
121
|
dl.at(ns("./dt")).children.each { |n| parse(n, s) }
|
@@ -149,7 +155,7 @@ module IsoDoc
|
|
149
155
|
|
150
156
|
def figure_name_parse(node, div, name)
|
151
157
|
div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
|
152
|
-
name
|
158
|
+
name&.children&.each { |n| parse(n, div) }
|
153
159
|
end
|
154
160
|
end
|
155
161
|
|
@@ -948,22 +948,24 @@
|
|
948
948
|
/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@type, ' ',
|
949
949
|
/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@number)"/>
|
950
950
|
-->
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
<
|
955
|
-
<xsl:text
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
<xsl:
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
<xsl:
|
964
|
-
|
965
|
-
|
966
|
-
|
951
|
+
|
952
|
+
<xsl:if test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
|
953
|
+
<!-- ISO/TC 34/SC 4/WG 3 -->
|
954
|
+
<fo:block margin-bottom="12pt">
|
955
|
+
<xsl:text>ISO</xsl:text>
|
956
|
+
<xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != '']">
|
957
|
+
<xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
|
958
|
+
</xsl:for-each>
|
959
|
+
<xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != '']">
|
960
|
+
<xsl:text>/SC </xsl:text>
|
961
|
+
<xsl:value-of select="@number"/>
|
962
|
+
</xsl:for-each>
|
963
|
+
<xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
|
964
|
+
<xsl:text>/WG </xsl:text>
|
965
|
+
<xsl:value-of select="@number"/>
|
966
|
+
</xsl:for-each>
|
967
|
+
</fo:block>
|
968
|
+
</xsl:if>
|
967
969
|
<!-- Secretariat: AFNOR -->
|
968
970
|
|
969
971
|
<fo:block margin-bottom="100pt">
|
@@ -1025,7 +1027,15 @@
|
|
1025
1027
|
<fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
|
1026
1028
|
<fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
|
1027
1029
|
<xsl:variable name="stage-title" select="substring-after(substring-before($docidentifierISO, ' '), '/')"/>
|
1028
|
-
<
|
1030
|
+
<xsl:choose>
|
1031
|
+
<xsl:when test="normalize-space($stage-title) != ''">
|
1032
|
+
<fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
|
1033
|
+
</xsl:when>
|
1034
|
+
<xsl:otherwise>
|
1035
|
+
<xsl:attribute name="border">0pt solid white</xsl:attribute>
|
1036
|
+
<fo:block> </fo:block>
|
1037
|
+
</xsl:otherwise>
|
1038
|
+
</xsl:choose>
|
1029
1039
|
</fo:block-container>
|
1030
1040
|
<fo:block><xsl:value-of select="$linebreak"/></fo:block>
|
1031
1041
|
|
@@ -1806,7 +1816,7 @@
|
|
1806
1816
|
</xsl:for-each>
|
1807
1817
|
</xsl:template>
|
1808
1818
|
|
1809
|
-
<xsl:template match="iso:ul
|
1819
|
+
<xsl:template match="iso:ul/iso:note | iso:ol/iso:note | iso:ul/iso:li/iso:note | iso:ol/iso:li/iso:note" priority="2"/>
|
1810
1820
|
|
1811
1821
|
<xsl:template match="iso:li">
|
1812
1822
|
<fo:list-item id="{@id}">
|
@@ -1818,7 +1828,10 @@
|
|
1818
1828
|
<fo:list-item-body start-indent="body-start()">
|
1819
1829
|
<fo:block>
|
1820
1830
|
<xsl:apply-templates/>
|
1821
|
-
<xsl:apply-templates select=".//iso:note" mode="process"/>
|
1831
|
+
<!-- <xsl:apply-templates select=".//iso:note" mode="process"/> -->
|
1832
|
+
<xsl:for-each select="./iso:note">
|
1833
|
+
<xsl:call-template name="note"/>
|
1834
|
+
</xsl:for-each>
|
1822
1835
|
</fo:block>
|
1823
1836
|
</fo:list-item-body>
|
1824
1837
|
</fo:list-item>
|
@@ -1828,6 +1841,10 @@
|
|
1828
1841
|
<xsl:call-template name="note"/>
|
1829
1842
|
</xsl:template>
|
1830
1843
|
|
1844
|
+
<xsl:template match="*" mode="process">
|
1845
|
+
<xsl:apply-templates select="."/>
|
1846
|
+
</xsl:template>
|
1847
|
+
|
1831
1848
|
<xsl:template match="iso:preferred">
|
1832
1849
|
<fo:block line-height="1.1">
|
1833
1850
|
<fo:block font-weight="bold" keep-with-next="always">
|
@@ -1909,20 +1926,6 @@
|
|
1909
1926
|
</xsl:template>
|
1910
1927
|
|
1911
1928
|
|
1912
|
-
<xsl:template match="mathml:math" priority="2">
|
1913
|
-
<fo:inline font-family="Cambria Math">
|
1914
|
-
<xsl:variable name="mathml">
|
1915
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
1916
|
-
</xsl:variable>
|
1917
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
1918
|
-
<!-- <xsl:copy-of select="."/> -->
|
1919
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
1920
|
-
</fo:instream-foreign-object>
|
1921
|
-
</fo:inline>
|
1922
|
-
</xsl:template>
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
1929
|
<xsl:template match="iso:admonition">
|
1927
1930
|
<fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
|
1928
1931
|
<xsl:variable name="type">
|
@@ -2695,6 +2698,7 @@
|
|
2695
2698
|
</xsl:choose>
|
2696
2699
|
</xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'
'"/><xsl:attribute-set name="root-style">
|
2697
2700
|
|
2701
|
+
|
2698
2702
|
</xsl:attribute-set><xsl:attribute-set name="link-style">
|
2699
2703
|
|
2700
2704
|
<xsl:attribute name="color">blue</xsl:attribute>
|
@@ -2777,6 +2781,7 @@
|
|
2777
2781
|
|
2778
2782
|
|
2779
2783
|
<xsl:attribute name="padding-right">5mm</xsl:attribute>
|
2784
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
2780
2785
|
|
2781
2786
|
|
2782
2787
|
|
@@ -3041,13 +3046,27 @@
|
|
3041
3046
|
|
3042
3047
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
3043
3048
|
|
3044
|
-
</xsl:attribute-set><xsl:
|
3049
|
+
</xsl:attribute-set><xsl:variable name="color-added-text">
|
3050
|
+
<xsl:text>rgb(0, 255, 0)</xsl:text>
|
3051
|
+
</xsl:variable><xsl:attribute-set name="add-style">
|
3045
3052
|
<xsl:attribute name="color">red</xsl:attribute>
|
3046
3053
|
<xsl:attribute name="text-decoration">underline</xsl:attribute>
|
3047
|
-
|
3048
|
-
<xsl:attribute name="color"
|
3054
|
+
<!-- <xsl:attribute name="color">black</xsl:attribute>
|
3055
|
+
<xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
|
3056
|
+
<xsl:attribute name="padding-top">1mm</xsl:attribute>
|
3057
|
+
<xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
|
3058
|
+
</xsl:attribute-set><xsl:variable name="color-deleted-text">
|
3059
|
+
<xsl:text>red</xsl:text>
|
3060
|
+
</xsl:variable><xsl:attribute-set name="del-style">
|
3061
|
+
<xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
|
3049
3062
|
<xsl:attribute name="text-decoration">line-through</xsl:attribute>
|
3050
|
-
</xsl:attribute-set><xsl:
|
3063
|
+
</xsl:attribute-set><xsl:attribute-set name="mathml-style">
|
3064
|
+
<xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
|
3065
|
+
|
3066
|
+
<xsl:attribute name="font-family">Cambria Math</xsl:attribute>
|
3067
|
+
|
3068
|
+
|
3069
|
+
</xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
|
3051
3070
|
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
|
3052
3071
|
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
|
3053
3072
|
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
|
@@ -3092,16 +3111,17 @@
|
|
3092
3111
|
<xsl:call-template name="add-zero-spaces-java"/>
|
3093
3112
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3094
3113
|
|
3114
|
+
<xsl:variable name="table-preamble">
|
3115
|
+
|
3116
|
+
|
3117
|
+
</xsl:variable>
|
3118
|
+
|
3095
3119
|
<xsl:variable name="table">
|
3096
3120
|
|
3097
3121
|
<xsl:variable name="simple-table">
|
3098
3122
|
<xsl:call-template name="getSimpleTable"/>
|
3099
3123
|
</xsl:variable>
|
3100
3124
|
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
3125
|
<!-- <xsl:if test="$namespace = 'bipm'">
|
3106
3126
|
<fo:block> </fo:block>
|
3107
3127
|
</xsl:if> -->
|
@@ -3112,7 +3132,7 @@
|
|
3112
3132
|
|
3113
3133
|
|
3114
3134
|
|
3115
|
-
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)
|
3135
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
|
3116
3136
|
|
3117
3137
|
<!-- <xsl:variable name="cols-count">
|
3118
3138
|
<xsl:choose>
|
@@ -3131,8 +3151,6 @@
|
|
3131
3151
|
<!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
|
3132
3152
|
<!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
|
3133
3153
|
|
3134
|
-
|
3135
|
-
|
3136
3154
|
<xsl:variable name="colwidths">
|
3137
3155
|
<xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
|
3138
3156
|
<xsl:call-template name="calculate-column-widths">
|
@@ -3160,6 +3178,7 @@
|
|
3160
3178
|
</xsl:choose>
|
3161
3179
|
</xsl:variable>
|
3162
3180
|
|
3181
|
+
|
3163
3182
|
<fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
|
3164
3183
|
|
3165
3184
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
@@ -3201,6 +3220,12 @@
|
|
3201
3220
|
</xsl:if>
|
3202
3221
|
|
3203
3222
|
|
3223
|
+
<xsl:if test="ancestor::*[local-name() = 'table']">
|
3224
|
+
<!-- for internal table in table cell -->
|
3225
|
+
<attribute name="border">0.5pt solid black</attribute>
|
3226
|
+
</xsl:if>
|
3227
|
+
|
3228
|
+
|
3204
3229
|
|
3205
3230
|
|
3206
3231
|
<attribute name="margin-left">0mm</attribute>
|
@@ -3295,7 +3320,8 @@
|
|
3295
3320
|
</fo:block-container>
|
3296
3321
|
</xsl:variable>
|
3297
3322
|
|
3298
|
-
|
3323
|
+
<xsl:variable name="isAdded" select="@added"/>
|
3324
|
+
<xsl:variable name="isDeleted" select="@deleted"/>
|
3299
3325
|
|
3300
3326
|
<xsl:choose>
|
3301
3327
|
<xsl:when test="@width">
|
@@ -3309,7 +3335,14 @@
|
|
3309
3335
|
<fo:table-body>
|
3310
3336
|
<fo:table-row>
|
3311
3337
|
<fo:table-cell column-number="2">
|
3312
|
-
<
|
3338
|
+
<xsl:copy-of select="$table-preamble"/>
|
3339
|
+
<fo:block>
|
3340
|
+
<xsl:call-template name="setTrackChangesStyles">
|
3341
|
+
<xsl:with-param name="isAdded" select="$isAdded"/>
|
3342
|
+
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
3343
|
+
</xsl:call-template>
|
3344
|
+
<xsl:copy-of select="$table"/>
|
3345
|
+
</fo:block>
|
3313
3346
|
</fo:table-cell>
|
3314
3347
|
</fo:table-row>
|
3315
3348
|
</fo:table-body>
|
@@ -3320,7 +3353,22 @@
|
|
3320
3353
|
|
3321
3354
|
</xsl:when>
|
3322
3355
|
<xsl:otherwise>
|
3323
|
-
<xsl:
|
3356
|
+
<xsl:choose>
|
3357
|
+
<xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
|
3358
|
+
<xsl:copy-of select="$table-preamble"/>
|
3359
|
+
<fo:block>
|
3360
|
+
<xsl:call-template name="setTrackChangesStyles">
|
3361
|
+
<xsl:with-param name="isAdded" select="$isAdded"/>
|
3362
|
+
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
3363
|
+
</xsl:call-template>
|
3364
|
+
<xsl:copy-of select="$table"/>
|
3365
|
+
</fo:block>
|
3366
|
+
</xsl:when>
|
3367
|
+
<xsl:otherwise>
|
3368
|
+
<xsl:copy-of select="$table-preamble"/>
|
3369
|
+
<xsl:copy-of select="$table"/>
|
3370
|
+
</xsl:otherwise>
|
3371
|
+
</xsl:choose>
|
3324
3372
|
</xsl:otherwise>
|
3325
3373
|
</xsl:choose>
|
3326
3374
|
|
@@ -3383,7 +3431,7 @@
|
|
3383
3431
|
</xsl:for-each>
|
3384
3432
|
</xsl:when>
|
3385
3433
|
<xsl:otherwise>
|
3386
|
-
<xsl:for-each select="xalan:nodeset($table)
|
3434
|
+
<xsl:for-each select="xalan:nodeset($table)/*/tr">
|
3387
3435
|
<xsl:variable name="td_text">
|
3388
3436
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
3389
3437
|
|
@@ -3781,7 +3829,8 @@
|
|
3781
3829
|
<xsl:attribute name="text-align">
|
3782
3830
|
<xsl:choose>
|
3783
3831
|
<xsl:when test="@align">
|
3784
|
-
<xsl:
|
3832
|
+
<xsl:call-template name="setAlignment"/>
|
3833
|
+
<!-- <xsl:value-of select="@align"/> -->
|
3785
3834
|
</xsl:when>
|
3786
3835
|
<xsl:otherwise>center</xsl:otherwise>
|
3787
3836
|
</xsl:choose>
|
@@ -3799,6 +3848,9 @@
|
|
3799
3848
|
|
3800
3849
|
|
3801
3850
|
|
3851
|
+
<xsl:if test="$lang = 'ar'">
|
3852
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
3853
|
+
</xsl:if>
|
3802
3854
|
<xsl:if test="@colspan">
|
3803
3855
|
<xsl:attribute name="number-columns-spanned">
|
3804
3856
|
<xsl:value-of select="@colspan"/>
|
@@ -3830,11 +3882,15 @@
|
|
3830
3882
|
<xsl:attribute name="text-align">
|
3831
3883
|
<xsl:choose>
|
3832
3884
|
<xsl:when test="@align">
|
3833
|
-
<xsl:
|
3885
|
+
<xsl:call-template name="setAlignment"/>
|
3886
|
+
<!-- <xsl:value-of select="@align"/> -->
|
3834
3887
|
</xsl:when>
|
3835
3888
|
<xsl:otherwise>left</xsl:otherwise>
|
3836
3889
|
</xsl:choose>
|
3837
3890
|
</xsl:attribute>
|
3891
|
+
<xsl:if test="$lang = 'ar'">
|
3892
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
3893
|
+
</xsl:if>
|
3838
3894
|
<!-- and ancestor::*[local-name() = 'thead'] -->
|
3839
3895
|
<xsl:attribute name="padding-top">0.5mm</xsl:attribute>
|
3840
3896
|
|
@@ -3852,6 +3908,9 @@
|
|
3852
3908
|
|
3853
3909
|
|
3854
3910
|
|
3911
|
+
<xsl:if test=".//*[local-name() = 'table']">
|
3912
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
3913
|
+
</xsl:if>
|
3855
3914
|
<xsl:if test="@colspan">
|
3856
3915
|
<xsl:attribute name="number-columns-spanned">
|
3857
3916
|
<xsl:value-of select="@colspan"/>
|
@@ -3985,13 +4044,13 @@
|
|
3985
4044
|
</xsl:choose>
|
3986
4045
|
</xsl:variable>
|
3987
4046
|
<!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
|
3988
|
-
<xsl:element name="{$ns}:table">
|
4047
|
+
<!-- <xsl:element name="{$ns}:table"> -->
|
3989
4048
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
3990
4049
|
<tbody>
|
3991
4050
|
<xsl:apply-templates mode="dl"/>
|
3992
4051
|
</tbody>
|
3993
4052
|
</xsl:for-each>
|
3994
|
-
</xsl:element>
|
4053
|
+
<!-- </xsl:element> -->
|
3995
4054
|
</xsl:variable>
|
3996
4055
|
|
3997
4056
|
<xsl:call-template name="calculate-column-widths">
|
@@ -4088,6 +4147,8 @@
|
|
4088
4147
|
<xsl:apply-templates/>
|
4089
4148
|
</fo:inline>
|
4090
4149
|
</xsl:template><xsl:template match="*[local-name()='dl']">
|
4150
|
+
<xsl:variable name="isAdded" select="@added"/>
|
4151
|
+
<xsl:variable name="isDeleted" select="@deleted"/>
|
4091
4152
|
<fo:block-container>
|
4092
4153
|
|
4093
4154
|
<xsl:if test="not(ancestor::*[local-name() = 'quote'])">
|
@@ -4104,6 +4165,12 @@
|
|
4104
4165
|
</xsl:attribute>
|
4105
4166
|
|
4106
4167
|
</xsl:if>
|
4168
|
+
|
4169
|
+
<xsl:call-template name="setTrackChangesStyles">
|
4170
|
+
<xsl:with-param name="isAdded" select="$isAdded"/>
|
4171
|
+
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
4172
|
+
</xsl:call-template>
|
4173
|
+
|
4107
4174
|
<fo:block-container>
|
4108
4175
|
|
4109
4176
|
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
@@ -4225,11 +4292,11 @@
|
|
4225
4292
|
</xsl:choose>
|
4226
4293
|
</xsl:variable>
|
4227
4294
|
<!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
|
4228
|
-
<xsl:element name="{$ns}:table">
|
4295
|
+
<!-- <xsl:element name="{$ns}:table"> -->
|
4229
4296
|
<tbody>
|
4230
4297
|
<xsl:apply-templates mode="dl"/>
|
4231
4298
|
</tbody>
|
4232
|
-
</xsl:element>
|
4299
|
+
<!-- </xsl:element> -->
|
4233
4300
|
</xsl:variable>
|
4234
4301
|
<!-- html-table<xsl:copy-of select="$html-table"/> -->
|
4235
4302
|
<xsl:variable name="colwidths">
|
@@ -4499,9 +4566,71 @@
|
|
4499
4566
|
<xsl:apply-templates/>
|
4500
4567
|
</fo:inline>
|
4501
4568
|
</xsl:template><xsl:template match="*[local-name()='add']">
|
4502
|
-
<
|
4503
|
-
<xsl:
|
4504
|
-
|
4569
|
+
<xsl:choose>
|
4570
|
+
<xsl:when test="@amendment">
|
4571
|
+
<fo:inline>
|
4572
|
+
<xsl:call-template name="insertTag">
|
4573
|
+
<xsl:with-param name="kind">A</xsl:with-param>
|
4574
|
+
<xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
|
4575
|
+
</xsl:call-template>
|
4576
|
+
<xsl:apply-templates/>
|
4577
|
+
<xsl:call-template name="insertTag">
|
4578
|
+
<xsl:with-param name="type">closing</xsl:with-param>
|
4579
|
+
<xsl:with-param name="kind">A</xsl:with-param>
|
4580
|
+
<xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
|
4581
|
+
</xsl:call-template>
|
4582
|
+
</fo:inline>
|
4583
|
+
</xsl:when>
|
4584
|
+
<xsl:when test="@corrigenda">
|
4585
|
+
<fo:inline>
|
4586
|
+
<xsl:call-template name="insertTag">
|
4587
|
+
<xsl:with-param name="kind">C</xsl:with-param>
|
4588
|
+
<xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
|
4589
|
+
</xsl:call-template>
|
4590
|
+
<xsl:apply-templates/>
|
4591
|
+
<xsl:call-template name="insertTag">
|
4592
|
+
<xsl:with-param name="type">closing</xsl:with-param>
|
4593
|
+
<xsl:with-param name="kind">C</xsl:with-param>
|
4594
|
+
<xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
|
4595
|
+
</xsl:call-template>
|
4596
|
+
</fo:inline>
|
4597
|
+
</xsl:when>
|
4598
|
+
<xsl:otherwise>
|
4599
|
+
<fo:inline xsl:use-attribute-sets="add-style">
|
4600
|
+
<xsl:apply-templates/>
|
4601
|
+
</fo:inline>
|
4602
|
+
</xsl:otherwise>
|
4603
|
+
</xsl:choose>
|
4604
|
+
|
4605
|
+
</xsl:template><xsl:template name="insertTag">
|
4606
|
+
<xsl:param name="type"/>
|
4607
|
+
<xsl:param name="kind"/>
|
4608
|
+
<xsl:param name="value"/>
|
4609
|
+
<xsl:variable name="add_width" select="string-length($value) * 20"/>
|
4610
|
+
<xsl:variable name="maxwidth" select="60 + $add_width"/>
|
4611
|
+
<fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
|
4612
|
+
<!-- <xsl:attribute name="width">7mm</xsl:attribute>
|
4613
|
+
<xsl:attribute name="content-height">100%</xsl:attribute> -->
|
4614
|
+
<xsl:attribute name="height">5mm</xsl:attribute>
|
4615
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
4616
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
4617
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
4618
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
|
4619
|
+
<g>
|
4620
|
+
<xsl:if test="$type = 'closing'">
|
4621
|
+
<xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
|
4622
|
+
</xsl:if>
|
4623
|
+
<polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
|
4624
|
+
<line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
|
4625
|
+
</g>
|
4626
|
+
<text font-family="Arial" x="15" y="57" font-size="40pt">
|
4627
|
+
<xsl:if test="$type = 'closing'">
|
4628
|
+
<xsl:attribute name="x">25</xsl:attribute>
|
4629
|
+
</xsl:if>
|
4630
|
+
<xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
|
4631
|
+
</text>
|
4632
|
+
</svg>
|
4633
|
+
</fo:instream-foreign-object>
|
4505
4634
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
4506
4635
|
<fo:inline xsl:use-attribute-sets="del-style">
|
4507
4636
|
<xsl:apply-templates/>
|
@@ -4844,13 +4973,30 @@
|
|
4844
4973
|
<xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
|
4845
4974
|
<xsl:value-of select="substring($str, 2)"/>
|
4846
4975
|
</xsl:template><xsl:template match="mathml:math">
|
4847
|
-
<
|
4976
|
+
<xsl:variable name="isAdded" select="@added"/>
|
4977
|
+
<xsl:variable name="isDeleted" select="@deleted"/>
|
4978
|
+
|
4979
|
+
<fo:inline xsl:use-attribute-sets="mathml-style">
|
4980
|
+
|
4981
|
+
|
4982
|
+
<xsl:call-template name="setTrackChangesStyles">
|
4983
|
+
<xsl:with-param name="isAdded" select="$isAdded"/>
|
4984
|
+
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
4985
|
+
</xsl:call-template>
|
4848
4986
|
|
4849
4987
|
<xsl:variable name="mathml">
|
4850
4988
|
<xsl:apply-templates select="." mode="mathml"/>
|
4851
4989
|
</xsl:variable>
|
4852
4990
|
<fo:instream-foreign-object fox:alt-text="Math">
|
4853
4991
|
|
4992
|
+
|
4993
|
+
<xsl:if test="count(ancestor::*[local-name() = 'table']) > 1">
|
4994
|
+
<xsl:attribute name="width">95%</xsl:attribute>
|
4995
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
4996
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
4997
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
4998
|
+
</xsl:if>
|
4999
|
+
|
4854
5000
|
<!-- <xsl:copy-of select="."/> -->
|
4855
5001
|
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
4856
5002
|
</fo:instream-foreign-object>
|
@@ -5096,8 +5242,15 @@
|
|
5096
5242
|
</fo:inline>
|
5097
5243
|
</xsl:if>
|
5098
5244
|
</xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
|
5245
|
+
<xsl:variable name="isAdded" select="@added"/>
|
5246
|
+
<xsl:variable name="isDeleted" select="@deleted"/>
|
5099
5247
|
<fo:block-container id="{@id}">
|
5100
5248
|
|
5249
|
+
<xsl:call-template name="setTrackChangesStyles">
|
5250
|
+
<xsl:with-param name="isAdded" select="$isAdded"/>
|
5251
|
+
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5252
|
+
</xsl:call-template>
|
5253
|
+
|
5101
5254
|
<fo:block>
|
5102
5255
|
<xsl:apply-templates/>
|
5103
5256
|
</fo:block>
|
@@ -5117,6 +5270,8 @@
|
|
5117
5270
|
<xsl:apply-templates/>
|
5118
5271
|
</fo:block>
|
5119
5272
|
</xsl:template><xsl:template match="*[local-name() = 'image']">
|
5273
|
+
<xsl:variable name="isAdded" select="../@added"/>
|
5274
|
+
<xsl:variable name="isDeleted" select="../@deleted"/>
|
5120
5275
|
<xsl:choose>
|
5121
5276
|
<xsl:when test="ancestor::*[local-name() = 'title']">
|
5122
5277
|
<fo:inline padding-left="1mm" padding-right="1mm">
|
@@ -5132,7 +5287,26 @@
|
|
5132
5287
|
<xsl:variable name="src">
|
5133
5288
|
<xsl:call-template name="image_src"/>
|
5134
5289
|
</xsl:variable>
|
5135
|
-
|
5290
|
+
|
5291
|
+
<xsl:choose>
|
5292
|
+
<xsl:when test="$isDeleted = 'true'">
|
5293
|
+
<!-- enclose in svg -->
|
5294
|
+
<fo:instream-foreign-object fox:alt-text="Image {@alt}">
|
5295
|
+
<xsl:attribute name="width">100%</xsl:attribute>
|
5296
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
5297
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
5298
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
5299
|
+
|
5300
|
+
|
5301
|
+
<xsl:apply-templates select="." mode="cross_image"/>
|
5302
|
+
|
5303
|
+
</fo:instream-foreign-object>
|
5304
|
+
</xsl:when>
|
5305
|
+
<xsl:otherwise>
|
5306
|
+
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
|
5307
|
+
</xsl:otherwise>
|
5308
|
+
</xsl:choose>
|
5309
|
+
|
5136
5310
|
</fo:block>
|
5137
5311
|
</xsl:otherwise>
|
5138
5312
|
</xsl:choose>
|
@@ -5148,6 +5322,55 @@
|
|
5148
5322
|
<xsl:value-of select="@src"/>
|
5149
5323
|
</xsl:otherwise>
|
5150
5324
|
</xsl:choose>
|
5325
|
+
</xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
|
5326
|
+
<xsl:choose>
|
5327
|
+
<xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
|
5328
|
+
<xsl:variable name="src">
|
5329
|
+
<xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
|
5330
|
+
</xsl:variable>
|
5331
|
+
<xsl:variable name="width" select="document($src)/@width"/>
|
5332
|
+
<xsl:variable name="height" select="document($src)/@height"/>
|
5333
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
|
5334
|
+
<image xlink:href="{$src}" style="overflow:visible;"/>
|
5335
|
+
</svg>
|
5336
|
+
</xsl:when>
|
5337
|
+
<xsl:when test="not(starts-with(@src, 'data:'))">
|
5338
|
+
<xsl:variable name="src">
|
5339
|
+
<xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
|
5340
|
+
</xsl:variable>
|
5341
|
+
<xsl:variable name="file" select="java:java.io.File.new(@src)"/>
|
5342
|
+
<xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
|
5343
|
+
<xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
|
5344
|
+
<xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
|
5345
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
|
5346
|
+
<image xlink:href="{$src}" style="overflow:visible;"/>
|
5347
|
+
</svg>
|
5348
|
+
</xsl:when>
|
5349
|
+
<xsl:otherwise>
|
5350
|
+
<xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
|
5351
|
+
<xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
|
5352
|
+
<xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
|
5353
|
+
<xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
|
5354
|
+
<xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
|
5355
|
+
<xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
|
5356
|
+
<!-- width=<xsl:value-of select="$width"/> -->
|
5357
|
+
<xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
|
5358
|
+
<!-- height=<xsl:value-of select="$height"/> -->
|
5359
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
|
5360
|
+
<image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
|
5361
|
+
<xsl:call-template name="svg_cross">
|
5362
|
+
<xsl:with-param name="width" select="$width"/>
|
5363
|
+
<xsl:with-param name="height" select="$height"/>
|
5364
|
+
</xsl:call-template>
|
5365
|
+
</svg>
|
5366
|
+
</xsl:otherwise>
|
5367
|
+
</xsl:choose>
|
5368
|
+
|
5369
|
+
</xsl:template><xsl:template name="svg_cross">
|
5370
|
+
<xsl:param name="width"/>
|
5371
|
+
<xsl:param name="height"/>
|
5372
|
+
<line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
|
5373
|
+
<line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
|
5151
5374
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
|
5152
5375
|
<xsl:apply-templates mode="contents"/>
|
5153
5376
|
<xsl:text> </xsl:text>
|
@@ -5690,6 +5913,7 @@
|
|
5690
5913
|
<xsl:variable name="element">
|
5691
5914
|
|
5692
5915
|
inline
|
5916
|
+
<xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
|
5693
5917
|
</xsl:variable>
|
5694
5918
|
<xsl:choose>
|
5695
5919
|
<xsl:when test="ancestor::*[local-name() = 'appendix']">
|
@@ -5697,7 +5921,7 @@
|
|
5697
5921
|
<xsl:apply-templates/>
|
5698
5922
|
</fo:inline>
|
5699
5923
|
</xsl:when>
|
5700
|
-
<xsl:when test="normalize-space($element)
|
5924
|
+
<xsl:when test="contains(normalize-space($element), 'block')">
|
5701
5925
|
<fo:block xsl:use-attribute-sets="example-name-style">
|
5702
5926
|
<xsl:apply-templates/>
|
5703
5927
|
</fo:block>
|
@@ -5921,7 +6145,8 @@
|
|
5921
6145
|
</fo:inline>
|
5922
6146
|
</xsl:when>
|
5923
6147
|
<xsl:otherwise>
|
5924
|
-
<
|
6148
|
+
<xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
|
6149
|
+
<fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/></fo:inline>
|
5925
6150
|
</xsl:otherwise>
|
5926
6151
|
</xsl:choose>
|
5927
6152
|
|
@@ -6634,4 +6859,44 @@
|
|
6634
6859
|
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
6635
6860
|
</xsl:choose>
|
6636
6861
|
|
6862
|
+
</xsl:template><xsl:template name="setTrackChangesStyles">
|
6863
|
+
<xsl:param name="isAdded"/>
|
6864
|
+
<xsl:param name="isDeleted"/>
|
6865
|
+
<xsl:choose>
|
6866
|
+
<xsl:when test="local-name() = 'math'">
|
6867
|
+
<xsl:if test="$isAdded = 'true'">
|
6868
|
+
<xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
|
6869
|
+
</xsl:if>
|
6870
|
+
<xsl:if test="$isDeleted = 'true'">
|
6871
|
+
<xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
|
6872
|
+
</xsl:if>
|
6873
|
+
</xsl:when>
|
6874
|
+
<xsl:otherwise>
|
6875
|
+
<xsl:if test="$isAdded = 'true'">
|
6876
|
+
<xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
|
6877
|
+
<xsl:attribute name="padding">2mm</xsl:attribute>
|
6878
|
+
</xsl:if>
|
6879
|
+
<xsl:if test="$isDeleted = 'true'">
|
6880
|
+
<xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
|
6881
|
+
<xsl:if test="local-name() = 'table'">
|
6882
|
+
<xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
|
6883
|
+
</xsl:if>
|
6884
|
+
<!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
|
6885
|
+
<xsl:attribute name="padding">2mm</xsl:attribute>
|
6886
|
+
</xsl:if>
|
6887
|
+
</xsl:otherwise>
|
6888
|
+
</xsl:choose>
|
6889
|
+
</xsl:template><xsl:variable name="LRM" select="''"/><xsl:variable name="RLM" select="''"/><xsl:template name="setWritingMode">
|
6890
|
+
<xsl:if test="$lang = 'ar'">
|
6891
|
+
<xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
|
6892
|
+
</xsl:if>
|
6893
|
+
</xsl:template><xsl:template name="setAlignment">
|
6894
|
+
<xsl:param name="align" select="normalize-space(@align)"/>
|
6895
|
+
<xsl:choose>
|
6896
|
+
<xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
|
6897
|
+
<xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
|
6898
|
+
<xsl:when test="$align != ''">
|
6899
|
+
<xsl:value-of select="$align"/>
|
6900
|
+
</xsl:when>
|
6901
|
+
</xsl:choose>
|
6637
6902
|
</xsl:template></xsl:stylesheet>
|