metanorma-ribose 2.4.8 → 2.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e549eb0c8148a30ba6177252afadff242b1cfa0f27e72582fb1e78e3c6e2018
4
- data.tar.gz: 81330799b6a8f41148f8bf1ee67e2d0c5d2fc49a8ad7b44d2eb42ad11c630f31
3
+ metadata.gz: 9381f89e208661e42df91dc0593b6dbf8c5381d246aafd7b579923dd7b1f2492
4
+ data.tar.gz: 7f8d151e92f730d331fd394a4a727b9d9f2959b1351fd9242e4b4f0599e00d50
5
5
  SHA512:
6
- metadata.gz: d239aea83642c38368accef728ac49efb631e3ef9bc9e189b040e2ba2c99b78558490f789c7d5e3f5105c0a60dbd6e702c335d648a036ac916023eae3f90bb97
7
- data.tar.gz: 58f5e06a315fc205ee223da291f075aab8e336d82a9b013ca58f0ef3dfb6c10be40beb0aaadf8874bda74be42f7c7d1ce29648583c8ce9208fc0966c7f8689c1
6
+ metadata.gz: aed1f2cbba8b5cdace7c5aef3887db5ffe6387f52c9b648138dbbf39a6a184d750b3971f18d4d555ebf80efdee612ff77ec4ff8ce4078556db723fca42fce51a
7
+ data.tar.gz: 8834ae24e24a0b17c563f52acc0f9b9fc9b6282d069efc7c4bee00915f372f37b05ed97bb672468f4881a13f695a78b7bf6623c147850baefa9b910bc6b74495
@@ -799,13 +799,9 @@
799
799
  <xsl:attribute name="id">
800
800
  <xsl:value-of select="@id"/>
801
801
  </xsl:attribute>
802
- <xsl:attribute name="text-align">
803
- <xsl:choose>
804
- <!-- <xsl:when test="ancestor::ribose:preface">justify</xsl:when> -->
805
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
806
- <xsl:otherwise>left</xsl:otherwise><!-- justify -->
807
- </xsl:choose>
808
- </xsl:attribute>
802
+
803
+ <xsl:call-template name="setBlockAttributes"/>
804
+
809
805
  <xsl:attribute name="space-after">
810
806
  <xsl:choose>
811
807
  <xsl:when test="ancestor::ribose:li">6pt</xsl:when>
@@ -1212,7 +1208,7 @@
1212
1208
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="ribose:xref"/>
1213
1209
 
1214
1210
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1215
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
1211
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1216
1212
 
1217
1213
  <!-- external parameters -->
1218
1214
 
@@ -2982,7 +2978,7 @@
2982
2978
 
2983
2979
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
2984
2980
 
2985
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2981
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2986
2982
 
2987
2983
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2988
2984
 
@@ -3000,17 +2996,32 @@
3000
2996
  </xsl:variable>
3001
2997
 
3002
2998
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3003
-
2999
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3000
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3004
3001
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3005
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3002
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3006
3003
  </redirect:write>
3004
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3007
3005
 
3008
3006
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3009
3007
 
3008
+ <!-- TODO: instead of
3009
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3010
+ in each template, add removing empty page_sequence here
3011
+ -->
3012
+
3013
+ <xsl:if test="$debug = 'true'">
3014
+ <redirect:write file="page_sequence_preface.xml">
3015
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3016
+ </redirect:write>
3017
+ </xsl:if>
3018
+
3019
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3010
3020
  <xsl:call-template name="deleteFile">
3011
3021
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3012
3022
  </xsl:call-template>
3013
- </xsl:template>
3023
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3024
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
3014
3025
 
3015
3026
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
3016
3027
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -3035,37 +3046,7 @@
3035
3046
  </xsl:for-each>
3036
3047
  </xsl:template><!-- END: processMainSectionsDefault -->
3037
3048
 
3038
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
3039
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3040
- <xsl:sort select="@displayorder" data-type="number"/>
3041
- <xsl:variable name="flatxml">
3042
- <xsl:apply-templates select="." mode="flatxml"/>
3043
- </xsl:variable>
3044
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3045
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3046
-
3047
- </xsl:for-each>
3048
-
3049
- <xsl:for-each select="/*/*[local-name()='annex']">
3050
- <xsl:sort select="@displayorder" data-type="number"/>
3051
- <xsl:variable name="flatxml">
3052
- <xsl:apply-templates select="." mode="flatxml"/>
3053
- </xsl:variable>
3054
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3055
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3056
- </xsl:for-each>
3057
-
3058
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3059
- <xsl:sort select="@displayorder" data-type="number"/>
3060
- <xsl:variable name="flatxml">
3061
- <xsl:apply-templates select="." mode="flatxml"/>
3062
- </xsl:variable>
3063
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3064
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3065
- </xsl:for-each>
3066
- </xsl:template>
3067
-
3068
- <!-- Example:
3049
+ <!-- Example:
3069
3050
  <iso-standard>
3070
3051
  <sections>
3071
3052
  <page_sequence>
@@ -3085,7 +3066,7 @@
3085
3066
  -->
3086
3067
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
3087
3068
 
3088
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3069
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3089
3070
 
3090
3071
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3091
3072
 
@@ -3122,11 +3103,17 @@
3122
3103
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3123
3104
 
3124
3105
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3125
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3106
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3126
3107
  </redirect:write>
3127
3108
 
3128
3109
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3129
3110
 
3111
+ <xsl:if test="$debug = 'true'">
3112
+ <redirect:write file="page_sequence_main.xml">
3113
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3114
+ </redirect:write>
3115
+ </xsl:if>
3116
+
3130
3117
  <xsl:call-template name="deleteFile">
3131
3118
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3132
3119
  </xsl:call-template>
@@ -3139,6 +3126,14 @@
3139
3126
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
3140
3127
  </xsl:template>
3141
3128
 
3129
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
3130
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
3131
+ <xsl:choose>
3132
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
3133
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
3134
+ </xsl:choose>
3135
+ </xsl:template>
3136
+
3142
3137
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3143
3138
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3144
3139
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -3474,7 +3469,9 @@
3474
3469
 
3475
3470
  <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3476
3471
  <xsl:if test="$isNoteOrFnExist = 'true'">
3477
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3472
+
3473
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3474
+
3478
3475
  </xsl:if>
3479
3476
 
3480
3477
  <xsl:choose>
@@ -3531,13 +3528,14 @@
3531
3528
  </fo:table>
3532
3529
 
3533
3530
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3534
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3535
- <xsl:call-template name="insertTableFooterInSeparateTable">
3536
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3537
- <xsl:with-param name="colwidths" select="$colwidths"/>
3538
- <xsl:with-param name="colgroup" select="$colgroup"/>
3539
- </xsl:call-template>
3540
- </xsl:for-each>
3531
+
3532
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3533
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3534
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3535
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3536
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3537
+ </xsl:call-template>
3538
+ </xsl:for-each>
3541
3539
 
3542
3540
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3543
3541
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3927,8 +3925,10 @@
3927
3925
  <width_min><xsl:value-of select="@width_min"/></width_min>
3928
3926
  <e><xsl:value-of select="$d * $W div $D"/></e>
3929
3927
  <!-- set the column's width to the minimum width plus d times W over D. -->
3928
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3929
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
3930
3930
  <column divider="100">
3931
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3931
+ <xsl:value-of select="$column_width"/>
3932
3932
  </column>
3933
3933
  </xsl:for-each>
3934
3934
 
@@ -4336,6 +4336,22 @@
4336
4336
 
4337
4337
  <xsl:call-template name="refine_table-header-cell-style"/>
4338
4338
 
4339
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
4340
+ <!-- <xsl:choose>
4341
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
4342
+ <fo:block-container reference-orientation="270">
4343
+ <fo:block role="SKIP" text-align="start">
4344
+ <xsl:apply-templates />
4345
+ </fo:block>
4346
+ </fo:block-container>
4347
+ </xsl:when>
4348
+ <xsl:otherwise>
4349
+ <fo:block role="SKIP">
4350
+ <xsl:apply-templates />
4351
+ </fo:block>
4352
+ </xsl:otherwise>
4353
+ </xsl:choose> -->
4354
+
4339
4355
  <fo:block role="SKIP">
4340
4356
  <xsl:apply-templates/>
4341
4357
  </fo:block>
@@ -7843,6 +7859,15 @@
7843
7859
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7844
7860
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7845
7861
  </xsl:when>
7862
+ <!-- in WebP format, then convert image into PNG -->
7863
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
7864
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7865
+ <xsl:value-of select="$src_png"/>
7866
+ </xsl:when>
7867
+ <xsl:when test="not(starts-with(@src, 'data:')) and (java:endsWith(java:java.lang.String.new(@src), '.webp') or java:endsWith(java:java.lang.String.new(@src), '.WEBP'))">
7868
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7869
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7870
+ </xsl:when>
7846
7871
  <xsl:when test="not(starts-with(@src, 'data:'))">
7847
7872
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7848
7873
  </xsl:when>
@@ -11515,6 +11540,75 @@
11515
11540
  <!-- ===================================== -->
11516
11541
  <!-- Update xml -->
11517
11542
  <!-- ===================================== -->
11543
+
11544
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
11545
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
11546
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
11547
+
11548
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11549
+ <xsl:variable name="updated_xml_step1">
11550
+ <xsl:if test="$table_if = 'false'">
11551
+ <xsl:apply-templates mode="update_xml_step1"/>
11552
+ </xsl:if>
11553
+ </xsl:variable>
11554
+
11555
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
11556
+ <xsl:if test="$debug = 'true'">
11557
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
11558
+ <xsl:message>END updated_xml_step1</xsl:message>
11559
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
11560
+ <xsl:copy-of select="$updated_xml_step1"/>
11561
+ </redirect:write> -->
11562
+ </xsl:if>
11563
+
11564
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
11565
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
11566
+
11567
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
11568
+ <xsl:variable name="updated_xml_step2">
11569
+
11570
+ <xsl:if test="$table_if = 'false'">
11571
+ <xsl:copy-of select="$updated_xml_step1"/>
11572
+ </xsl:if>
11573
+
11574
+ </xsl:variable>
11575
+
11576
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
11577
+ <xsl:if test="$debug = 'true'">
11578
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
11579
+ <xsl:message>END updated_xml_step2</xsl:message>
11580
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
11581
+ <xsl:copy-of select="$updated_xml_step2"/>
11582
+ </redirect:write> -->
11583
+ </xsl:if>
11584
+
11585
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
11586
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
11587
+
11588
+ <xsl:variable name="updated_xml_step3">
11589
+ <xsl:choose>
11590
+ <xsl:when test="$table_if = 'false'">
11591
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
11592
+ </xsl:when>
11593
+ <xsl:otherwise>
11594
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
11595
+ </xsl:otherwise>
11596
+ </xsl:choose>
11597
+ </xsl:variable>
11598
+
11599
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
11600
+ <xsl:if test="$debug = 'true'">
11601
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
11602
+ <xsl:message>END updated_xml_step3</xsl:message>
11603
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
11604
+ <xsl:copy-of select="$updated_xml_step3"/>
11605
+ </redirect:write> -->
11606
+ </xsl:if>
11607
+
11608
+ <xsl:copy-of select="$updated_xml_step3"/>
11609
+
11610
+ </xsl:template>
11611
+
11518
11612
  <!-- =========================================================================== -->
11519
11613
  <!-- STEP1: -->
11520
11614
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -11714,7 +11808,7 @@
11714
11808
 
11715
11809
  <!-- determine pagebreak is last element before </fo:flow> or not -->
11716
11810
  <xsl:variable name="isLast">
11717
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11811
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11718
11812
  <xsl:if test="following-sibling::*">false</xsl:if>
11719
11813
  </xsl:for-each>
11720
11814
  </xsl:variable>
@@ -11736,7 +11830,7 @@
11736
11830
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
11737
11831
 
11738
11832
  <!-- create a new page_sequence (opening elements) -->
11739
- <xsl:text disable-output-escaping="yes">&lt;page_sequence namespace="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
11833
+ <xsl:text disable-output-escaping="yes">&lt;page_sequence xmlns="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
11740
11834
 
11741
11835
  <xsl:call-template name="insertOpeningElements">
11742
11836
  <xsl:with-param name="tree" select="$tree"/>
@@ -11746,7 +11840,7 @@
11746
11840
  </xsl:template>
11747
11841
 
11748
11842
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
11749
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11843
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11750
11844
  <element pos="{position()}">
11751
11845
  <xsl:copy-of select="@*[local-name() != 'id']"/>
11752
11846
  <xsl:value-of select="name()"/>
@@ -11927,7 +12021,7 @@
11927
12021
  <xsl:value-of select="substring-before($text, $tag_open)"/>
11928
12022
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
11929
12023
 
11930
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
12024
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
11931
12025
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
11932
12026
  </xsl:element>
11933
12027
 
@@ -12749,7 +12843,10 @@
12749
12843
  <xsl:call-template name="setTextAlignment">
12750
12844
  <xsl:with-param name="default" select="$text_align_default"/>
12751
12845
  </xsl:call-template>
12846
+ <xsl:call-template name="setKeepAttributes"/>
12847
+ </xsl:template>
12752
12848
 
12849
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
12753
12850
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
12754
12851
  <!-- Example: keep-lines-together="true" -->
12755
12852
  <xsl:if test="@keep-lines-together = 'true'">
@@ -12761,6 +12858,72 @@
12761
12858
  </xsl:if>
12762
12859
  </xsl:template>
12763
12860
 
12861
+ <!-- insert cover page image -->
12862
+ <!-- background cover image -->
12863
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
12864
+ <xsl:param name="number">1</xsl:param>
12865
+ <xsl:param name="name">coverpage-image</xsl:param>
12866
+ <xsl:variable name="num" select="number($number)"/>
12867
+ <!-- background image -->
12868
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
12869
+ <fo:block>
12870
+ <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
12871
+ <xsl:choose>
12872
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
12873
+ <fo:instream-foreign-object fox:alt-text="Image Front">
12874
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
12875
+ <xsl:call-template name="getSVG"/>
12876
+ </fo:instream-foreign-object>
12877
+ </xsl:when>
12878
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
12879
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
12880
+ </xsl:when>
12881
+ <xsl:otherwise> <!-- bitmap image -->
12882
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
12883
+ <xsl:if test="$coverimage_src != ''">
12884
+ <xsl:variable name="coverpage">
12885
+ <xsl:call-template name="getImageURL">
12886
+ <xsl:with-param name="src" select="$coverimage_src"/>
12887
+ </xsl:call-template>
12888
+ </xsl:variable>
12889
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
12890
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
12891
+ </xsl:if>
12892
+ </xsl:otherwise>
12893
+ </xsl:choose>
12894
+ </xsl:for-each>
12895
+ </fo:block>
12896
+ </fo:block-container>
12897
+ </xsl:template>
12898
+
12899
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
12900
+ <xsl:param name="src"/>
12901
+ <xsl:choose>
12902
+ <xsl:when test="starts-with($src, 'data:image')">
12903
+ <xsl:value-of select="$src"/>
12904
+ </xsl:when>
12905
+ <xsl:otherwise>
12906
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12907
+ </xsl:otherwise>
12908
+ </xsl:choose>
12909
+ </xsl:template>
12910
+
12911
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
12912
+ <xsl:choose>
12913
+ <xsl:when test="*[local-name() = 'svg']">
12914
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
12915
+ </xsl:when>
12916
+ <xsl:otherwise>
12917
+ <xsl:variable name="svg_content" select="document(@src)"/>
12918
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
12919
+ <xsl:apply-templates select="." mode="svg_update"/>
12920
+ </xsl:for-each>
12921
+ </xsl:otherwise>
12922
+ </xsl:choose>
12923
+ </xsl:template>
12924
+
12925
+ <!-- END: insert cover page image -->
12926
+
12764
12927
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
12765
12928
  <xsl:param name="number"/>
12766
12929
  <xsl:param name="first"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ribose
3
- VERSION = "2.4.8".freeze
3
+ VERSION = "2.4.9".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ribose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-03 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic