metanorma-un 0.10.7 → 0.10.8

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.
@@ -1508,6 +1508,7 @@
1508
1508
  </xsl:attribute-set>
1509
1509
 
1510
1510
  <xsl:attribute-set name="xref-style">
1511
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1511
1512
 
1512
1513
  </xsl:attribute-set>
1513
1514
 
@@ -3520,9 +3521,13 @@
3520
3521
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3521
3522
  </xsl:if>
3522
3523
 
3523
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3524
- <xsl:value-of select="$current_fn_number_text"/>
3525
- </fo:basic-link>
3524
+ <xsl:call-template name="insert_basic_link">
3525
+ <xsl:with-param name="element">
3526
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3527
+ <xsl:value-of select="$current_fn_number_text"/>
3528
+ </fo:basic-link>
3529
+ </xsl:with-param>
3530
+ </xsl:call-template>
3526
3531
  </fo:inline>
3527
3532
  </xsl:variable>
3528
3533
 
@@ -3855,8 +3860,10 @@
3855
3860
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3856
3861
  <xsl:text> </xsl:text>
3857
3862
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3858
- <xsl:text/>
3859
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3863
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3864
+ <xsl:text> </xsl:text>
3865
+ </xsl:if>
3866
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3860
3867
  </fo:block>
3861
3868
 
3862
3869
  </xsl:when> <!-- END: only one component -->
@@ -4343,8 +4350,18 @@
4343
4350
  </xsl:if>
4344
4351
  </xsl:template>
4345
4352
 
4346
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4347
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4353
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4354
+ <xsl:variable name="is_inline_element_after_where">
4355
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4356
+ </xsl:variable>
4357
+ <xsl:choose>
4358
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4359
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4360
+ </xsl:when>
4361
+ <xsl:otherwise>
4362
+ <xsl:apply-templates select="."/>
4363
+ </xsl:otherwise>
4364
+ </xsl:choose>
4348
4365
  </xsl:template>
4349
4366
 
4350
4367
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5772,6 +5789,79 @@
5772
5789
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5773
5790
  </xsl:template>
5774
5791
 
5792
+ <!-- special case for:
5793
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5794
+ <mstyle displaystyle="true">
5795
+ <msup>
5796
+ <mi color="#00000000">C</mi>
5797
+ <mtext>R</mtext>
5798
+ </msup>
5799
+ <msubsup>
5800
+ <mtext>C</mtext>
5801
+ <mi>n</mi>
5802
+ <mi>k</mi>
5803
+ </msubsup>
5804
+ </mstyle>
5805
+ </math>
5806
+ -->
5807
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5808
+ <xsl:copy>
5809
+ <xsl:copy-of select="@*"/>
5810
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
5811
+ <xsl:if test="string-length($next_mtext) != ''">
5812
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5813
+ </xsl:if>
5814
+ <xsl:apply-templates/>
5815
+ <xsl:value-of select="$next_mtext"/>
5816
+ </xsl:copy>
5817
+ </xsl:template>
5818
+
5819
+ <!-- special case for:
5820
+ <msup>
5821
+ <mtext/>
5822
+ <mn>1</mn>
5823
+ </msup>
5824
+ convert to (add mspace after mtext and enclose them into mrow):
5825
+ <msup>
5826
+ <mrow>
5827
+ <mtext/>
5828
+ <mspace height="1.47ex"/>
5829
+ </mrow>
5830
+ <mn>1</mn>
5831
+ </msup>
5832
+ -->
5833
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5834
+ <mathml:mrow>
5835
+ <xsl:copy-of select="."/>
5836
+ <mathml:mspace height="1.47ex"/>
5837
+ </mathml:mrow>
5838
+ </xsl:template>
5839
+
5840
+ <!-- add space around vertical line -->
5841
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5842
+ <xsl:copy>
5843
+ <xsl:apply-templates select="@*" mode="mathml"/>
5844
+ <xsl:if test="not(@lspace)">
5845
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5846
+ </xsl:if>
5847
+ <xsl:if test="not(@rspace)">
5848
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5849
+ </xsl:if>
5850
+ <xsl:apply-templates mode="mathml"/>
5851
+ </xsl:copy>
5852
+ </xsl:template>
5853
+
5854
+ <!-- decrease fontsize for 'Circled Times' char -->
5855
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5856
+ <xsl:copy>
5857
+ <xsl:apply-templates select="@*" mode="mathml"/>
5858
+ <xsl:if test="not(@fontsize)">
5859
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5860
+ </xsl:if>
5861
+ <xsl:apply-templates mode="mathml"/>
5862
+ </xsl:copy>
5863
+ </xsl:template>
5864
+
5775
5865
  <!-- Examples:
5776
5866
  <stem type="AsciiMath">x = 1</stem>
5777
5867
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5829,19 +5919,23 @@
5829
5919
  <xsl:apply-templates/>
5830
5920
  </xsl:when>
5831
5921
  <xsl:otherwise>
5832
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5833
- <xsl:choose>
5834
- <xsl:when test="normalize-space(.) = ''">
5835
- <xsl:call-template name="add-zero-spaces-link-java">
5836
- <xsl:with-param name="text" select="$target_text"/>
5837
- </xsl:call-template>
5838
- </xsl:when>
5839
- <xsl:otherwise>
5840
- <!-- output text from <link>text</link> -->
5841
- <xsl:apply-templates/>
5842
- </xsl:otherwise>
5843
- </xsl:choose>
5844
- </fo:basic-link>
5922
+ <xsl:call-template name="insert_basic_link">
5923
+ <xsl:with-param name="element">
5924
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5925
+ <xsl:choose>
5926
+ <xsl:when test="normalize-space(.) = ''">
5927
+ <xsl:call-template name="add-zero-spaces-link-java">
5928
+ <xsl:with-param name="text" select="$target_text"/>
5929
+ </xsl:call-template>
5930
+ </xsl:when>
5931
+ <xsl:otherwise>
5932
+ <!-- output text from <link>text</link> -->
5933
+ <xsl:apply-templates/>
5934
+ </xsl:otherwise>
5935
+ </xsl:choose>
5936
+ </fo:basic-link>
5937
+ </xsl:with-param>
5938
+ </xsl:call-template>
5845
5939
  </xsl:otherwise>
5846
5940
  </xsl:choose>
5847
5941
  </fo:inline>
@@ -5904,12 +5998,16 @@
5904
5998
  </xsl:template>
5905
5999
 
5906
6000
  <xsl:template match="*[local-name() = 'xref']">
5907
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5908
- <xsl:if test="parent::*[local-name() = 'add']">
5909
- <xsl:call-template name="append_add-style"/>
5910
- </xsl:if>
5911
- <xsl:apply-templates/>
5912
- </fo:basic-link>
6001
+ <xsl:call-template name="insert_basic_link">
6002
+ <xsl:with-param name="element">
6003
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6004
+ <xsl:if test="parent::*[local-name() = 'add']">
6005
+ <xsl:call-template name="append_add-style"/>
6006
+ </xsl:if>
6007
+ <xsl:apply-templates/>
6008
+ </fo:basic-link>
6009
+ </xsl:with-param>
6010
+ </xsl:call-template>
5913
6011
  </xsl:template>
5914
6012
 
5915
6013
  <!-- ====== -->
@@ -6317,7 +6415,7 @@
6317
6415
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6318
6416
  </xsl:when>
6319
6417
  <xsl:when test="not(starts-with(@src, 'data:'))">
6320
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6418
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6321
6419
  </xsl:when>
6322
6420
  <xsl:otherwise>
6323
6421
  <xsl:value-of select="@src"/>
@@ -6339,7 +6437,7 @@
6339
6437
  </xsl:when>
6340
6438
  <xsl:when test="not(starts-with(@src, 'data:'))">
6341
6439
  <xsl:variable name="src">
6342
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6440
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6343
6441
  </xsl:variable>
6344
6442
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6345
6443
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6725,15 +6823,19 @@
6725
6823
  <xsl:param name="dest"/>
6726
6824
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6727
6825
  <fo:block font-size="1pt">
6728
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6729
- <fo:inline-container inline-progression-dimension="100%">
6730
- <fo:block-container height="{$height - 1}px" width="100%">
6731
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6732
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6733
- </xsl:if> -->
6734
- <fo:block> </fo:block></fo:block-container>
6735
- </fo:inline-container>
6736
- </fo:basic-link>
6826
+ <xsl:call-template name="insert_basic_link">
6827
+ <xsl:with-param name="element">
6828
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6829
+ <fo:inline-container inline-progression-dimension="100%">
6830
+ <fo:block-container height="{$height - 1}px" width="100%">
6831
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6832
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6833
+ </xsl:if> -->
6834
+ <fo:block> </fo:block></fo:block-container>
6835
+ </fo:inline-container>
6836
+ </fo:basic-link>
6837
+ </xsl:with-param>
6838
+ </xsl:call-template>
6737
6839
  </fo:block>
6738
6840
  </fo:block-container>
6739
6841
  </xsl:template>
@@ -8282,14 +8384,18 @@
8282
8384
  </xsl:template>
8283
8385
 
8284
8386
  <xsl:template match="*[local-name() = 'origin']">
8285
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8286
- <xsl:if test="normalize-space(@citeas) = ''">
8287
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8288
- </xsl:if>
8289
- <fo:inline xsl:use-attribute-sets="origin-style">
8290
- <xsl:apply-templates/>
8291
- </fo:inline>
8292
- </fo:basic-link>
8387
+ <xsl:call-template name="insert_basic_link">
8388
+ <xsl:with-param name="element">
8389
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8390
+ <xsl:if test="normalize-space(@citeas) = ''">
8391
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8392
+ </xsl:if>
8393
+ <fo:inline xsl:use-attribute-sets="origin-style">
8394
+ <xsl:apply-templates/>
8395
+ </fo:inline>
8396
+ </fo:basic-link>
8397
+ </xsl:with-param>
8398
+ </xsl:call-template>
8293
8399
  </xsl:template>
8294
8400
 
8295
8401
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8363,9 +8469,13 @@
8363
8469
  <xsl:if test="../*[local-name() = 'author']">
8364
8470
  <xsl:text>, </xsl:text>
8365
8471
  </xsl:if>
8366
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8367
- <xsl:apply-templates/>
8368
- </fo:basic-link>
8472
+ <xsl:call-template name="insert_basic_link">
8473
+ <xsl:with-param name="element">
8474
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8475
+ <xsl:apply-templates/>
8476
+ </fo:basic-link>
8477
+ </xsl:with-param>
8478
+ </xsl:call-template>
8369
8479
  </xsl:template>
8370
8480
 
8371
8481
  <xsl:template match="*[local-name() = 'author']">
@@ -8414,25 +8524,29 @@
8414
8524
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8415
8525
  <xsl:variable name="text" select="normalize-space()"/>
8416
8526
 
8417
- <fo:basic-link fox:alt-text="{@citeas}">
8418
- <xsl:if test="normalize-space(@citeas) = ''">
8419
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8420
- </xsl:if>
8421
- <xsl:if test="@type = 'inline'">
8527
+ <xsl:call-template name="insert_basic_link">
8528
+ <xsl:with-param name="element">
8529
+ <fo:basic-link fox:alt-text="{@citeas}">
8530
+ <xsl:if test="normalize-space(@citeas) = ''">
8531
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8532
+ </xsl:if>
8533
+ <xsl:if test="@type = 'inline'">
8422
8534
 
8423
- </xsl:if>
8535
+ </xsl:if>
8424
8536
 
8425
- <xsl:choose>
8426
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8427
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8428
- </xsl:when>
8429
- <xsl:otherwise>
8430
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8431
- </xsl:otherwise>
8432
- </xsl:choose>
8537
+ <xsl:choose>
8538
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8539
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8540
+ </xsl:when>
8541
+ <xsl:otherwise>
8542
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8543
+ </xsl:otherwise>
8544
+ </xsl:choose>
8433
8545
 
8434
- <xsl:apply-templates/>
8435
- </fo:basic-link>
8546
+ <xsl:apply-templates/>
8547
+ </fo:basic-link>
8548
+ </xsl:with-param>
8549
+ </xsl:call-template>
8436
8550
 
8437
8551
  </fo:inline>
8438
8552
  </xsl:when>
@@ -8679,7 +8793,10 @@
8679
8793
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8680
8794
 
8681
8795
  <xsl:template name="setULLabel">
8682
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8796
+ <xsl:variable name="list_level__">
8797
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8798
+ </xsl:variable>
8799
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8683
8800
  <xsl:variable name="list_level">
8684
8801
  <xsl:choose>
8685
8802
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8812,9 +8929,11 @@
8812
8929
  </fo:block-container>
8813
8930
  </xsl:when>
8814
8931
  <xsl:otherwise>
8815
- <fo:block>
8816
- <xsl:apply-templates select="." mode="list"/>
8817
- </fo:block>
8932
+
8933
+ <fo:block>
8934
+ <xsl:apply-templates select="." mode="list"/>
8935
+ </fo:block>
8936
+
8818
8937
  </xsl:otherwise>
8819
8938
  </xsl:choose>
8820
8939
  </xsl:template>
@@ -9481,24 +9600,32 @@
9481
9600
  <xsl:for-each select="*[local-name() = 'tab']">
9482
9601
  <xsl:variable name="current_id" select="generate-id()"/>
9483
9602
  <fo:table-cell>
9484
- <fo:block>
9485
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9486
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9487
- <xsl:choose>
9488
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9489
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9490
- </xsl:choose>
9491
- </xsl:for-each>
9492
- </fo:basic-link>
9603
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9604
+ <xsl:call-template name="insert_basic_link">
9605
+ <xsl:with-param name="element">
9606
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9607
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9608
+ <xsl:choose>
9609
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9610
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9611
+ </xsl:choose>
9612
+ </xsl:for-each>
9613
+ </fo:basic-link>
9614
+ </xsl:with-param>
9615
+ </xsl:call-template>
9493
9616
  </fo:block>
9494
9617
  </fo:table-cell>
9495
9618
  </xsl:for-each>
9496
9619
  <!-- last column - for page numbers -->
9497
9620
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9498
9621
  <fo:block>
9499
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9500
- <fo:page-number-citation ref-id="{$target}"/>
9501
- </fo:basic-link>
9622
+ <xsl:call-template name="insert_basic_link">
9623
+ <xsl:with-param name="element">
9624
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9625
+ <fo:page-number-citation ref-id="{$target}"/>
9626
+ </fo:basic-link>
9627
+ </xsl:with-param>
9628
+ </xsl:call-template>
9502
9629
  </fo:block>
9503
9630
  </fo:table-cell>
9504
9631
  </xsl:template>
@@ -9540,6 +9667,27 @@
9540
9667
  <!-- End Table of Contents (ToC) processing -->
9541
9668
  <!-- =================== -->
9542
9669
 
9670
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9671
+ <xsl:template name="insert_basic_link">
9672
+ <xsl:param name="element"/>
9673
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9674
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9675
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9676
+ <xsl:choose>
9677
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9678
+ <xsl:copy-of select="$element_node"/>
9679
+ </xsl:when>
9680
+ <xsl:otherwise>
9681
+ <fo:inline>
9682
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9683
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9684
+ </xsl:for-each>
9685
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9686
+ </fo:inline>
9687
+ </xsl:otherwise>
9688
+ </xsl:choose>
9689
+ </xsl:template>
9690
+
9543
9691
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9544
9692
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9545
9693
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -49,7 +49,7 @@ module IsoDoc
49
49
  def footnotes(_div)
50
50
  if @meta.get[:item_footnote]
51
51
  fn = noko do |xml|
52
- xml.aside **{ id: "ftnitem" } do |d|
52
+ xml.aside id: "ftnitem" do |d|
53
53
  d.p @meta.get[:item_footnote]
54
54
  end
55
55
  end.join("\n")
@@ -74,15 +74,10 @@ module IsoDoc
74
74
  end
75
75
 
76
76
  def make_body2(body, docxml)
77
- body.div **{ class: "WordSection2" } do |div2|
77
+ body.div class: "WordSection2" do |div2|
78
78
  info docxml, div2
79
79
  boilerplate docxml, div2
80
- preface_block docxml, div2
81
- abstract docxml, div2
82
- foreword docxml, div2
83
- introduction docxml, div2
84
- preface docxml, div2
85
- acknowledgements docxml, div2
80
+ front docxml, div2
86
81
  div2.p { |p| p << "&#xa0;" } # placeholder
87
82
  end
88
83
  section_break(body)
@@ -109,27 +104,25 @@ module IsoDoc
109
104
  end_line(isoxml, out)
110
105
  end
111
106
 
112
- def introduction(isoxml, out)
113
- f = isoxml.at(ns("//introduction")) || return
114
- out.div **{ class: "Section3", id: f["id"] } do |div|
107
+ def introduction(clause, out)
108
+ out.div class: "Section3", id: clause["id"] do |div|
115
109
  page_break(out)
116
- div.p(**{ class: "IntroTitle" }) do |h1|
117
- f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
110
+ div.p(class: "IntroTitle") do |h1|
111
+ clause&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
118
112
  end
119
- f.elements.each do |e|
113
+ clause.elements.each do |e|
120
114
  parse(e, div) unless e.name == "title"
121
115
  end
122
116
  end
123
117
  end
124
118
 
125
- def foreword(isoxml, out)
126
- f = isoxml.at(ns("//foreword")) || return
127
- out.div **attr_code(id: f["id"]) do |s|
119
+ def foreword(clause, out)
120
+ out.div **attr_code(id: clause["id"]) do |s|
128
121
  page_break(out)
129
- s.p(**{ class: "ForewordTitle" }) do |h1|
130
- f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
122
+ s.p(class: "ForewordTitle") do |h1|
123
+ clause&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
131
124
  end
132
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
125
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
133
126
  end
134
127
  end
135
128
 
@@ -160,14 +153,13 @@ module IsoDoc
160
153
  abstractbox.parent.remove if abstractbox && !abstract
161
154
  end
162
155
 
163
- def abstract(isoxml, out)
164
- f = isoxml.at(ns("//abstract")) || return
165
- out.div **attr_code(id: f["id"]) do |s|
156
+ def abstract(clause, out)
157
+ out.div **attr_code(id: clause["id"]) do |s|
166
158
  page_break(out)
167
- s.p(**{ class: "AbstractTitle" }) do |h1|
168
- f&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
159
+ s.p(class: "AbstractTitle") do |h1|
160
+ clause&.at(ns("./title"))&.children&.each { |n| parse(n, h1) }
169
161
  end
170
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
162
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
171
163
  end
172
164
  end
173
165
 
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.1 -->
20
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -1349,15 +1350,19 @@
1349
1350
  </choice>
1350
1351
  </element>
1351
1352
  </define>
1353
+ <define name="Root-Attributes">
1354
+ <attribute name="version"/>
1355
+ <attribute name="schema-version"/>
1356
+ <attribute name="type">
1357
+ <choice>
1358
+ <value>semantic</value>
1359
+ <value>presentation</value>
1360
+ </choice>
1361
+ </attribute>
1362
+ </define>
1352
1363
  <define name="standard-document">
1353
1364
  <element name="standard-document">
1354
- <attribute name="version"/>
1355
- <attribute name="type">
1356
- <choice>
1357
- <value>semantic</value>
1358
- <value>presentation</value>
1359
- </choice>
1360
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1361
1366
  <ref name="bibdata"/>
1362
1367
  <optional>
1363
1368
  <ref name="misccontainer"/>
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/un" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar ns='https://www.metanorma.org/ns/un' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
3
  <!--
4
+ VERSION v1.2.1
4
5
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
6
  we cannot have a new default namespace: we will end up with a grammar with two different
6
7
  namespaces, one for isostandard and one for csand additions. And we do not want that.
@@ -209,13 +210,7 @@
209
210
  </include>
210
211
  <define name="un-standard">
211
212
  <element name="un-standard">
212
- <attribute name="version"/>
213
- <attribute name="type">
214
- <choice>
215
- <value>semantic</value>
216
- <value>presentation</value>
217
- </choice>
218
- </attribute>
213
+ <ref name="Root-Attributes"/>
219
214
  <ref name="bibdata"/>
220
215
  <optional>
221
216
  <ref name="misccontainer"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.10.7".freeze
3
+ VERSION = "0.10.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.7
4
+ version: 0.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639