metanorma-iec 2.2.6 → 2.2.7
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/isodoc/iec/iec.international-standard.xsl +272 -6
- data/lib/isodoc/iec/word_convert.rb +13 -0
- data/lib/metanorma/iec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e1fc48630666c6749ec3bcd326cd1a0da5d5cf961cfd702e0f43f385d256919
|
|
4
|
+
data.tar.gz: 370662a054ffa70d325da95ce080bbd9ca05a767ad938a2a42c32d9331bec1a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10fc31cc59820dca344cdb94069b3f90a7037be04c2715144355a753561e466cf00407200f2e25d2bd63fb06051d45a6b5156b44e79fac165e7693a2c867e5ae
|
|
7
|
+
data.tar.gz: ae68e356bbe71bd9a02ea06cb9bb6ecc91b146cef7c9d0fa9e8c035a335b24c317ad0165aa7cc39d3235f6a28e25f808447b3d7d883daa17c2b082b84de0b0ec
|
|
@@ -2847,6 +2847,7 @@
|
|
|
2847
2847
|
<xsl:attribute-set name="term-name-style">
|
|
2848
2848
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
2849
2849
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
|
2850
|
+
|
|
2850
2851
|
</xsl:attribute-set>
|
|
2851
2852
|
|
|
2852
2853
|
<xsl:attribute-set name="figure-block-style">
|
|
@@ -3821,7 +3822,7 @@
|
|
|
3821
3822
|
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
|
3822
3823
|
</xsl:when>
|
|
3823
3824
|
<xsl:otherwise>
|
|
3824
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and
|
|
3825
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
|
|
3825
3826
|
</xsl:otherwise>
|
|
3826
3827
|
</xsl:choose>
|
|
3827
3828
|
|
|
@@ -4329,7 +4330,7 @@
|
|
|
4329
4330
|
<xsl:param name="colwidths"/>
|
|
4330
4331
|
<xsl:param name="colgroup"/>
|
|
4331
4332
|
|
|
4332
|
-
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
|
4333
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
|
4333
4334
|
|
|
4334
4335
|
<xsl:variable name="isNoteOrFnExistShowAfterTable">
|
|
4335
4336
|
|
|
@@ -4401,6 +4402,7 @@
|
|
|
4401
4402
|
|
|
4402
4403
|
<!-- except gb and bsi -->
|
|
4403
4404
|
|
|
4405
|
+
<xsl:apply-templates select="../*[local-name()='dl']"/>
|
|
4404
4406
|
<xsl:apply-templates select="../*[local-name()='note']"/>
|
|
4405
4407
|
|
|
4406
4408
|
<xsl:variable name="isDisplayRowSeparator">
|
|
@@ -4527,7 +4529,7 @@
|
|
|
4527
4529
|
<!-- ===================== -->
|
|
4528
4530
|
<!-- Table's row processing -->
|
|
4529
4531
|
<!-- ===================== -->
|
|
4530
|
-
<!-- row in table header (thead) -->
|
|
4532
|
+
<!-- row in table header (thead) thead/tr -->
|
|
4531
4533
|
<xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
|
4532
4534
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
|
4533
4535
|
|
|
@@ -4561,7 +4563,7 @@
|
|
|
4561
4563
|
</xsl:choose>
|
|
4562
4564
|
</xsl:template>
|
|
4563
4565
|
|
|
4564
|
-
<!-- row in table footer (tfoot) -->
|
|
4566
|
+
<!-- row in table footer (tfoot), tfoot/tr -->
|
|
4565
4567
|
<xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
|
4566
4568
|
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
|
4567
4569
|
|
|
@@ -5051,6 +5053,8 @@
|
|
|
5051
5053
|
<!-- <dl><xsl:copy-of select="."/></dl> -->
|
|
5052
5054
|
<fo:block-container>
|
|
5053
5055
|
|
|
5056
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
5057
|
+
|
|
5054
5058
|
<xsl:if test="not(ancestor::*[local-name() = 'quote'])">
|
|
5055
5059
|
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
|
5056
5060
|
</xsl:if>
|
|
@@ -7204,13 +7208,17 @@
|
|
|
7204
7208
|
</xsl:template>
|
|
7205
7209
|
|
|
7206
7210
|
<xsl:template match="*[local-name() = 'callout']">
|
|
7207
|
-
<
|
|
7211
|
+
<xsl:choose>
|
|
7212
|
+
<xsl:when test="normalize-space(@target) = ''"><<xsl:apply-templates/>></xsl:when>
|
|
7213
|
+
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
|
|
7214
|
+
</xsl:choose>
|
|
7208
7215
|
</xsl:template>
|
|
7209
7216
|
|
|
7210
7217
|
<xsl:template match="*[local-name() = 'annotation']">
|
|
7211
7218
|
<xsl:variable name="annotation-id" select="@id"/>
|
|
7212
7219
|
<xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
|
|
7213
7220
|
<fo:block id="{$annotation-id}" white-space="nowrap">
|
|
7221
|
+
|
|
7214
7222
|
<fo:inline>
|
|
7215
7223
|
<xsl:apply-templates>
|
|
7216
7224
|
<xsl:with-param name="callout" select="concat('<', $callout, '> ')"/>
|
|
@@ -7315,6 +7323,10 @@
|
|
|
7315
7323
|
<!-- ====== -->
|
|
7316
7324
|
<!-- ====== -->
|
|
7317
7325
|
|
|
7326
|
+
<xsl:template name="setBlockSpanAll">
|
|
7327
|
+
<xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
|
|
7328
|
+
</xsl:template>
|
|
7329
|
+
|
|
7318
7330
|
<!-- ====== -->
|
|
7319
7331
|
<!-- note -->
|
|
7320
7332
|
<!-- termnote -->
|
|
@@ -7324,6 +7336,8 @@
|
|
|
7324
7336
|
|
|
7325
7337
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
|
|
7326
7338
|
|
|
7339
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
7340
|
+
|
|
7327
7341
|
<fo:block-container margin-left="0mm" margin-right="0mm">
|
|
7328
7342
|
|
|
7329
7343
|
<fo:block>
|
|
@@ -7374,6 +7388,8 @@
|
|
|
7374
7388
|
<xsl:template match="*[local-name() = 'termnote']">
|
|
7375
7389
|
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
|
|
7376
7390
|
|
|
7391
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
7392
|
+
|
|
7377
7393
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
|
7378
7394
|
|
|
7379
7395
|
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
|
@@ -9296,6 +9312,9 @@
|
|
|
9296
9312
|
<!-- ====== -->
|
|
9297
9313
|
<xsl:template match="*[local-name() = 'termexample']">
|
|
9298
9314
|
<fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
|
|
9315
|
+
|
|
9316
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
9317
|
+
|
|
9299
9318
|
<xsl:apply-templates select="*[local-name()='name']"/>
|
|
9300
9319
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
|
9301
9320
|
</fo:block>
|
|
@@ -9347,6 +9366,8 @@
|
|
|
9347
9366
|
|
|
9348
9367
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
|
9349
9368
|
|
|
9369
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
9370
|
+
|
|
9350
9371
|
<xsl:variable name="fo_element">
|
|
9351
9372
|
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
|
9352
9373
|
|
|
@@ -9380,6 +9401,35 @@
|
|
|
9380
9401
|
</fo:block-container>
|
|
9381
9402
|
</xsl:when> <!-- end block -->
|
|
9382
9403
|
|
|
9404
|
+
<xsl:when test="contains(normalize-space($fo_element), 'list')">
|
|
9405
|
+
|
|
9406
|
+
<xsl:variable name="provisional_distance_between_starts">
|
|
9407
|
+
7
|
|
9408
|
+
</xsl:variable>
|
|
9409
|
+
<xsl:variable name="indent">
|
|
9410
|
+
0
|
|
9411
|
+
</xsl:variable>
|
|
9412
|
+
|
|
9413
|
+
<fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
|
|
9414
|
+
<fo:list-item>
|
|
9415
|
+
<fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
|
|
9416
|
+
<fo:block>
|
|
9417
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
|
9418
|
+
<xsl:with-param name="fo_element">block</xsl:with-param>
|
|
9419
|
+
</xsl:apply-templates>
|
|
9420
|
+
</fo:block>
|
|
9421
|
+
</fo:list-item-label>
|
|
9422
|
+
<fo:list-item-body start-indent="body-start()">
|
|
9423
|
+
<fo:block>
|
|
9424
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
|
9425
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
9426
|
+
</xsl:apply-templates>
|
|
9427
|
+
</fo:block>
|
|
9428
|
+
</fo:list-item-body>
|
|
9429
|
+
</fo:list-item>
|
|
9430
|
+
</fo:list-block>
|
|
9431
|
+
</xsl:when> <!-- end list -->
|
|
9432
|
+
|
|
9383
9433
|
<xsl:otherwise> <!-- inline -->
|
|
9384
9434
|
|
|
9385
9435
|
<!-- display 'EXAMPLE' and first element in the same line -->
|
|
@@ -9455,6 +9505,11 @@
|
|
|
9455
9505
|
</fo:block>
|
|
9456
9506
|
</fo:block-container>
|
|
9457
9507
|
</xsl:when>
|
|
9508
|
+
<xsl:when test="starts-with(normalize-space($element), 'list')">
|
|
9509
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
|
9510
|
+
<xsl:apply-templates/>
|
|
9511
|
+
</fo:block>
|
|
9512
|
+
</xsl:when>
|
|
9458
9513
|
<xsl:otherwise>
|
|
9459
9514
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
|
9460
9515
|
<xsl:apply-templates/>
|
|
@@ -9572,6 +9627,9 @@
|
|
|
9572
9627
|
<!-- ====== -->
|
|
9573
9628
|
<xsl:template match="*[local-name() = 'quote']">
|
|
9574
9629
|
<fo:block-container margin-left="0mm">
|
|
9630
|
+
|
|
9631
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
9632
|
+
|
|
9575
9633
|
<xsl:if test="parent::*[local-name() = 'note']">
|
|
9576
9634
|
<xsl:if test="not(ancestor::*[local-name() = 'table'])">
|
|
9577
9635
|
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
|
@@ -9860,6 +9918,8 @@
|
|
|
9860
9918
|
<fo:block>
|
|
9861
9919
|
<xsl:call-template name="setId"/>
|
|
9862
9920
|
|
|
9921
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
9922
|
+
|
|
9863
9923
|
<xsl:apply-templates/>
|
|
9864
9924
|
</fo:block>
|
|
9865
9925
|
</xsl:template>
|
|
@@ -9874,6 +9934,8 @@
|
|
|
9874
9934
|
<fo:block break-after="page"/>
|
|
9875
9935
|
<fo:block id="{@id}">
|
|
9876
9936
|
|
|
9937
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
9938
|
+
|
|
9877
9939
|
</fo:block>
|
|
9878
9940
|
<xsl:apply-templates/>
|
|
9879
9941
|
</xsl:template>
|
|
@@ -10839,6 +10901,8 @@
|
|
|
10839
10901
|
<!-- text in the box -->
|
|
10840
10902
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
|
|
10841
10903
|
|
|
10904
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
|
10905
|
+
|
|
10842
10906
|
<fo:block-container xsl:use-attribute-sets="admonition-container-style">
|
|
10843
10907
|
|
|
10844
10908
|
<fo:block text-align="justify">
|
|
@@ -11016,6 +11080,16 @@
|
|
|
11016
11080
|
<xsl:apply-templates mode="update_xml_step1"/>
|
|
11017
11081
|
</xsl:copy>
|
|
11018
11082
|
</xsl:template>
|
|
11083
|
+
|
|
11084
|
+
<!-- remove semantic xml -->
|
|
11085
|
+
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
|
|
11086
|
+
|
|
11087
|
+
<!-- remove image/emf -->
|
|
11088
|
+
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
|
|
11089
|
+
|
|
11090
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
|
|
11091
|
+
<xsl:copy-of select="."/>
|
|
11092
|
+
</xsl:template>
|
|
11019
11093
|
<!-- =========================================================================== -->
|
|
11020
11094
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
|
11021
11095
|
<!-- =========================================================================== -->
|
|
@@ -11037,7 +11111,7 @@
|
|
|
11037
11111
|
|
|
11038
11112
|
<xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
|
|
11039
11113
|
|
|
11040
|
-
<xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
|
11114
|
+
<xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
|
11041
11115
|
|
|
11042
11116
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
|
11043
11117
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
|
@@ -11111,6 +11185,10 @@
|
|
|
11111
11185
|
|
|
11112
11186
|
</xsl:template>
|
|
11113
11187
|
|
|
11188
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
|
|
11189
|
+
<xsl:copy-of select="."/>
|
|
11190
|
+
</xsl:template>
|
|
11191
|
+
|
|
11114
11192
|
<xsl:template name="replace_text_tags">
|
|
11115
11193
|
<xsl:param name="tag_open"/>
|
|
11116
11194
|
<xsl:param name="tag_close"/>
|
|
@@ -11137,6 +11215,194 @@
|
|
|
11137
11215
|
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
|
11138
11216
|
<!-- ===================================== -->
|
|
11139
11217
|
|
|
11218
|
+
<!-- ===================================== -->
|
|
11219
|
+
<!-- ===================================== -->
|
|
11220
|
+
<!-- Make linear XML (need for landscape orientation) -->
|
|
11221
|
+
<!-- ===================================== -->
|
|
11222
|
+
<!-- ===================================== -->
|
|
11223
|
+
<xsl:template match="@*|node()" mode="linear_xml">
|
|
11224
|
+
<xsl:copy>
|
|
11225
|
+
<xsl:apply-templates select="@*|node()" mode="linear_xml"/>
|
|
11226
|
+
</xsl:copy>
|
|
11227
|
+
</xsl:template>
|
|
11228
|
+
|
|
11229
|
+
<xsl:template match="processing-instruction()" mode="linear_xml">
|
|
11230
|
+
<xsl:copy-of select="."/>
|
|
11231
|
+
</xsl:template>
|
|
11232
|
+
|
|
11233
|
+
<!-- From:
|
|
11234
|
+
<clause>
|
|
11235
|
+
<title>...</title>
|
|
11236
|
+
<p>...</p>
|
|
11237
|
+
</clause>
|
|
11238
|
+
To:
|
|
11239
|
+
<clause/>
|
|
11240
|
+
<title>...</title>
|
|
11241
|
+
<p>...</p>
|
|
11242
|
+
-->
|
|
11243
|
+
<xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
|
|
11244
|
+
|
|
11245
|
+
<xsl:copy>
|
|
11246
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11247
|
+
|
|
11248
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
11249
|
+
|
|
11250
|
+
<xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
|
|
11251
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
|
11252
|
+
</xsl:if>
|
|
11253
|
+
</xsl:copy>
|
|
11254
|
+
|
|
11255
|
+
<xsl:apply-templates mode="linear_xml"/>
|
|
11256
|
+
</xsl:template>
|
|
11257
|
+
|
|
11258
|
+
<xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
|
|
11259
|
+
<xsl:copy>
|
|
11260
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11261
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
11262
|
+
<xsl:variable name="level">
|
|
11263
|
+
<xsl:call-template name="getLevel"/>
|
|
11264
|
+
</xsl:variable>
|
|
11265
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
|
11266
|
+
<xsl:attribute name="ancestor">sections</xsl:attribute>
|
|
11267
|
+
<xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
|
|
11268
|
+
</xsl:copy>
|
|
11269
|
+
<xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
|
|
11270
|
+
</xsl:template>
|
|
11271
|
+
|
|
11272
|
+
<xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
|
|
11273
|
+
<xsl:copy>
|
|
11274
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11275
|
+
|
|
11276
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
11277
|
+
|
|
11278
|
+
<xsl:variable name="level">
|
|
11279
|
+
<xsl:call-template name="getLevel"/>
|
|
11280
|
+
</xsl:variable>
|
|
11281
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
|
11282
|
+
|
|
11283
|
+
<xsl:if test="parent::*[local-name() = 'annex']">
|
|
11284
|
+
<xsl:attribute name="depth">1</xsl:attribute>
|
|
11285
|
+
</xsl:if>
|
|
11286
|
+
|
|
11287
|
+
<xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
|
|
11288
|
+
<xsl:copy-of select="../@inline-header"/>
|
|
11289
|
+
</xsl:if>
|
|
11290
|
+
|
|
11291
|
+
<xsl:attribute name="ancestor">
|
|
11292
|
+
<xsl:choose>
|
|
11293
|
+
<xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
|
|
11294
|
+
<xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
|
|
11295
|
+
<xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
|
|
11296
|
+
<xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
|
|
11297
|
+
<xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
|
|
11298
|
+
</xsl:choose>
|
|
11299
|
+
</xsl:attribute>
|
|
11300
|
+
|
|
11301
|
+
<xsl:apply-templates mode="linear_xml"/>
|
|
11302
|
+
</xsl:copy>
|
|
11303
|
+
</xsl:template>
|
|
11304
|
+
|
|
11305
|
+
<!-- add @to = figure, table, clause -->
|
|
11306
|
+
<!-- add @depth = from -->
|
|
11307
|
+
<xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
|
|
11308
|
+
<xsl:copy>
|
|
11309
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11310
|
+
<xsl:variable name="target" select="@target"/>
|
|
11311
|
+
<xsl:attribute name="to">
|
|
11312
|
+
<xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
|
|
11313
|
+
</xsl:attribute>
|
|
11314
|
+
<xsl:attribute name="depth">
|
|
11315
|
+
<xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
|
|
11316
|
+
</xsl:attribute>
|
|
11317
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
|
11318
|
+
</xsl:copy>
|
|
11319
|
+
</xsl:template>
|
|
11320
|
+
|
|
11321
|
+
<xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
|
|
11322
|
+
<xsl:choose>
|
|
11323
|
+
<xsl:when test="contains(., $non_breaking_hyphen)">
|
|
11324
|
+
<xsl:call-template name="replaceChar">
|
|
11325
|
+
<xsl:with-param name="text" select="."/>
|
|
11326
|
+
<xsl:with-param name="replace" select="$non_breaking_hyphen"/>
|
|
11327
|
+
<xsl:with-param name="by" select="'-'"/>
|
|
11328
|
+
</xsl:call-template>
|
|
11329
|
+
</xsl:when>
|
|
11330
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
|
11331
|
+
</xsl:choose>
|
|
11332
|
+
</xsl:template>
|
|
11333
|
+
|
|
11334
|
+
<xsl:template name="replaceChar">
|
|
11335
|
+
<xsl:param name="text"/>
|
|
11336
|
+
<xsl:param name="replace"/>
|
|
11337
|
+
<xsl:param name="by"/>
|
|
11338
|
+
<xsl:choose>
|
|
11339
|
+
<xsl:when test="$text = '' or $replace = '' or not($replace)">
|
|
11340
|
+
<xsl:value-of select="$text"/>
|
|
11341
|
+
</xsl:when>
|
|
11342
|
+
<xsl:when test="contains($text, $replace)">
|
|
11343
|
+
<xsl:value-of select="substring-before($text,$replace)"/>
|
|
11344
|
+
<xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
|
|
11345
|
+
<xsl:call-template name="replaceChar">
|
|
11346
|
+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
|
|
11347
|
+
<xsl:with-param name="replace" select="$replace"/>
|
|
11348
|
+
<xsl:with-param name="by" select="$by"/>
|
|
11349
|
+
</xsl:call-template>
|
|
11350
|
+
</xsl:when>
|
|
11351
|
+
<xsl:otherwise>
|
|
11352
|
+
<xsl:value-of select="$text"/>
|
|
11353
|
+
</xsl:otherwise>
|
|
11354
|
+
</xsl:choose>
|
|
11355
|
+
</xsl:template>
|
|
11356
|
+
|
|
11357
|
+
<xsl:template match="*[local-name() = 'inlineChar']">
|
|
11358
|
+
<fo:inline><xsl:value-of select="."/></fo:inline>
|
|
11359
|
+
</xsl:template>
|
|
11360
|
+
|
|
11361
|
+
<!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
|
|
11362
|
+
<!--
|
|
11363
|
+
<fn reference="1">
|
|
11364
|
+
<p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
|
|
11365
|
+
</fn>
|
|
11366
|
+
-->
|
|
11367
|
+
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
|
|
11368
|
+
<xsl:variable name="p_fn_">
|
|
11369
|
+
<xsl:call-template name="get_fn_list"/>
|
|
11370
|
+
</xsl:variable>
|
|
11371
|
+
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
|
|
11372
|
+
<xsl:variable name="gen_id" select="generate-id(.)"/>
|
|
11373
|
+
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
|
|
11374
|
+
<xsl:variable name="reference" select="@reference"/>
|
|
11375
|
+
<!-- fn sequence number in document -->
|
|
11376
|
+
<xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
|
|
11377
|
+
|
|
11378
|
+
<xsl:copy>
|
|
11379
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11380
|
+
<!-- put actual reference number -->
|
|
11381
|
+
<xsl:attribute name="current_fn_number">
|
|
11382
|
+
<xsl:value-of select="$current_fn_number"/>
|
|
11383
|
+
</xsl:attribute>
|
|
11384
|
+
<xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
|
|
11385
|
+
<xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
|
|
11386
|
+
</xsl:attribute>
|
|
11387
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
|
11388
|
+
</xsl:copy>
|
|
11389
|
+
</xsl:template>
|
|
11390
|
+
|
|
11391
|
+
<xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
|
|
11392
|
+
<xsl:copy>
|
|
11393
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
|
11394
|
+
<xsl:if test="@depth = '1'">
|
|
11395
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
|
11396
|
+
</xsl:if>
|
|
11397
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
|
11398
|
+
</xsl:copy>
|
|
11399
|
+
</xsl:template>
|
|
11400
|
+
<!-- ===================================== -->
|
|
11401
|
+
<!-- ===================================== -->
|
|
11402
|
+
<!-- END: Make linear XML (need for landscape orientation) -->
|
|
11403
|
+
<!-- ===================================== -->
|
|
11404
|
+
<!-- ===================================== -->
|
|
11405
|
+
|
|
11140
11406
|
<!-- for correct rendering combining chars -->
|
|
11141
11407
|
<xsl:template match="*[local-name() = 'lang_none']">
|
|
11142
11408
|
<fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
|
|
@@ -11,6 +11,19 @@ module IsoDoc
|
|
|
11
11
|
@libdir = File.dirname(__FILE__)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
def convert(input_filename, file = nil, debug = false,
|
|
15
|
+
output_filename = nil)
|
|
16
|
+
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
|
17
|
+
@openmathdelim, @closemathdelim = extract_delims(file)
|
|
18
|
+
docxml, filename, dir = convert_init(file, input_filename, debug)
|
|
19
|
+
result = convert1(docxml, filename, dir)
|
|
20
|
+
return result if debug
|
|
21
|
+
|
|
22
|
+
output_filename ||= "#{filename}.#{@suffix}"
|
|
23
|
+
postprocess(result, output_filename, dir)
|
|
24
|
+
FileUtils.rm_rf dir
|
|
25
|
+
end
|
|
26
|
+
|
|
14
27
|
def font_choice(options)
|
|
15
28
|
if options[:script] == "Hans" then '"Source Han Sans",serif'
|
|
16
29
|
else '"Arial",sans-serif'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-iec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-03-
|
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-iso
|