metanorma-ieee 1.0.9 → 1.0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 339168811c63f630d027737c234fd6e17d8b9a43f81ee16a1a35558d189afef5
4
- data.tar.gz: '09beb8778d4cfdcae8613bccfac21fc3fd13ec5ec5812e06f63d002f42ff245e'
3
+ metadata.gz: 56f7f0388b6fb0a8842e97ea9c3c3edf6fa03cc9989f5ae31c0c9c30a5b2d88e
4
+ data.tar.gz: cfa588f4ad63ed775313e27afc4e981ed340a78c557badb9fc8b7da0d5d35ea4
5
5
  SHA512:
6
- metadata.gz: 1b2b3df533221c7f236a91a06aee9c09fea3763f3e3a2f1b1d5c2ab870b40a24fd87d75eae9e65e12cdfabb465c60da0998ba900d8ef9bcb8e05cb4b417ad528
7
- data.tar.gz: 8355ed38f26005fc218a0da14df0450efa0c7d326af6d7235bfe5971ca9f6549f114327857a7b9677d8e9cb79fd00bbc7a78e9c15b2325887b888268fe6f178f
6
+ metadata.gz: aca4e3edeb8aee38ade1db7f3ef6868ffd969f943d75a1ff435f14e1efe8fb72e5196ec57acae8cb10106b09d7e3c28f96fd783027f02ba5a347c533555e0bdc
7
+ data.tar.gz: 5b1a3a15c5b027a38779df25641a2edd44efec2bf7b44d1adaf41debdb2b707f8a4d7b9768eb7095640d2b0232b3bd17de2ac856f406eba972ac577c41315b6e
@@ -3,7 +3,6 @@
3
3
 
4
4
 
5
5
  <nav>
6
- <h1 id="content">{{ labels["table_of_contents"]}}</h1>
7
6
  <div id="toc"></div>
8
7
 
9
8
  </nav>
@@ -59,12 +59,4 @@ mso-break-type:section-break'/>
59
59
  </div>
60
60
 
61
61
 
62
- <div class="WordSectionContents">
63
-
64
- <p class="IEEEStdsLevel1frontmatter"><span lang="EN-US">Contents</span></p>
65
-
66
- WORDTOC
67
-
68
- </div>
69
-
70
62
 
@@ -74,8 +74,8 @@ module IsoDoc
74
74
  end
75
75
 
76
76
  def clausedelimspace(node, out)
77
- if node.at("./ancestor::xmlns:p[@type = 'officeorgrepmemberhdr'"\
78
- " or @type = 'officeorgrepmember']")
77
+ if node.at("./ancestor::xmlns:p[@type = 'officeorgrepmemberhdr' " \
78
+ "or @type = 'officeorgrepmember']")
79
79
  out.tab
80
80
  else super
81
81
  end
@@ -4437,6 +4437,7 @@
4437
4437
  </xsl:attribute-set>
4438
4438
 
4439
4439
  <xsl:attribute-set name="xref-style">
4440
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4440
4441
 
4441
4442
  <xsl:attribute name="color">blue</xsl:attribute>
4442
4443
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -6479,9 +6480,13 @@
6479
6480
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6480
6481
  </xsl:if>
6481
6482
 
6482
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6483
- <xsl:value-of select="$current_fn_number_text"/>
6484
- </fo:basic-link>
6483
+ <xsl:call-template name="insert_basic_link">
6484
+ <xsl:with-param name="element">
6485
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6486
+ <xsl:value-of select="$current_fn_number_text"/>
6487
+ </fo:basic-link>
6488
+ </xsl:with-param>
6489
+ </xsl:call-template>
6485
6490
  </fo:inline>
6486
6491
  </xsl:variable>
6487
6492
 
@@ -6823,8 +6828,10 @@
6823
6828
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6824
6829
  <xsl:text> </xsl:text>
6825
6830
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6826
- <xsl:text/>
6827
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
6831
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
6832
+ <xsl:text> </xsl:text>
6833
+ </xsl:if>
6834
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
6828
6835
  </fo:block>
6829
6836
 
6830
6837
  </xsl:when> <!-- END: only one component -->
@@ -7311,8 +7318,18 @@
7311
7318
  </xsl:if>
7312
7319
  </xsl:template>
7313
7320
 
7314
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
7315
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7321
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
7322
+ <xsl:variable name="is_inline_element_after_where">
7323
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
7324
+ </xsl:variable>
7325
+ <xsl:choose>
7326
+ <xsl:when test="$is_inline_element_after_where = 'true'">
7327
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7328
+ </xsl:when>
7329
+ <xsl:otherwise>
7330
+ <xsl:apply-templates select="."/>
7331
+ </xsl:otherwise>
7332
+ </xsl:choose>
7316
7333
  </xsl:template>
7317
7334
 
7318
7335
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -8742,6 +8759,79 @@
8742
8759
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8743
8760
  </xsl:template>
8744
8761
 
8762
+ <!-- special case for:
8763
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8764
+ <mstyle displaystyle="true">
8765
+ <msup>
8766
+ <mi color="#00000000">C</mi>
8767
+ <mtext>R</mtext>
8768
+ </msup>
8769
+ <msubsup>
8770
+ <mtext>C</mtext>
8771
+ <mi>n</mi>
8772
+ <mi>k</mi>
8773
+ </msubsup>
8774
+ </mstyle>
8775
+ </math>
8776
+ -->
8777
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
8778
+ <xsl:copy>
8779
+ <xsl:copy-of select="@*"/>
8780
+ <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"/>
8781
+ <xsl:if test="string-length($next_mtext) != ''">
8782
+ <xsl:attribute name="color">#00000000</xsl:attribute>
8783
+ </xsl:if>
8784
+ <xsl:apply-templates/>
8785
+ <xsl:value-of select="$next_mtext"/>
8786
+ </xsl:copy>
8787
+ </xsl:template>
8788
+
8789
+ <!-- special case for:
8790
+ <msup>
8791
+ <mtext/>
8792
+ <mn>1</mn>
8793
+ </msup>
8794
+ convert to (add mspace after mtext and enclose them into mrow):
8795
+ <msup>
8796
+ <mrow>
8797
+ <mtext/>
8798
+ <mspace height="1.47ex"/>
8799
+ </mrow>
8800
+ <mn>1</mn>
8801
+ </msup>
8802
+ -->
8803
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
8804
+ <mathml:mrow>
8805
+ <xsl:copy-of select="."/>
8806
+ <mathml:mspace height="1.47ex"/>
8807
+ </mathml:mrow>
8808
+ </xsl:template>
8809
+
8810
+ <!-- add space around vertical line -->
8811
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
8812
+ <xsl:copy>
8813
+ <xsl:apply-templates select="@*" mode="mathml"/>
8814
+ <xsl:if test="not(@lspace)">
8815
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
8816
+ </xsl:if>
8817
+ <xsl:if test="not(@rspace)">
8818
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
8819
+ </xsl:if>
8820
+ <xsl:apply-templates mode="mathml"/>
8821
+ </xsl:copy>
8822
+ </xsl:template>
8823
+
8824
+ <!-- decrease fontsize for 'Circled Times' char -->
8825
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
8826
+ <xsl:copy>
8827
+ <xsl:apply-templates select="@*" mode="mathml"/>
8828
+ <xsl:if test="not(@fontsize)">
8829
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
8830
+ </xsl:if>
8831
+ <xsl:apply-templates mode="mathml"/>
8832
+ </xsl:copy>
8833
+ </xsl:template>
8834
+
8745
8835
  <!-- Examples:
8746
8836
  <stem type="AsciiMath">x = 1</stem>
8747
8837
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8811,19 +8901,23 @@
8811
8901
  <xsl:apply-templates/>
8812
8902
  </xsl:when>
8813
8903
  <xsl:otherwise>
8814
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8815
- <xsl:choose>
8816
- <xsl:when test="normalize-space(.) = ''">
8817
- <xsl:call-template name="add-zero-spaces-link-java">
8818
- <xsl:with-param name="text" select="$target_text"/>
8819
- </xsl:call-template>
8820
- </xsl:when>
8821
- <xsl:otherwise>
8822
- <!-- output text from <link>text</link> -->
8823
- <xsl:apply-templates/>
8824
- </xsl:otherwise>
8825
- </xsl:choose>
8826
- </fo:basic-link>
8904
+ <xsl:call-template name="insert_basic_link">
8905
+ <xsl:with-param name="element">
8906
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8907
+ <xsl:choose>
8908
+ <xsl:when test="normalize-space(.) = ''">
8909
+ <xsl:call-template name="add-zero-spaces-link-java">
8910
+ <xsl:with-param name="text" select="$target_text"/>
8911
+ </xsl:call-template>
8912
+ </xsl:when>
8913
+ <xsl:otherwise>
8914
+ <!-- output text from <link>text</link> -->
8915
+ <xsl:apply-templates/>
8916
+ </xsl:otherwise>
8917
+ </xsl:choose>
8918
+ </fo:basic-link>
8919
+ </xsl:with-param>
8920
+ </xsl:call-template>
8827
8921
  </xsl:otherwise>
8828
8922
  </xsl:choose>
8829
8923
  </fo:inline>
@@ -8886,12 +8980,16 @@
8886
8980
  </xsl:template>
8887
8981
 
8888
8982
  <xsl:template match="*[local-name() = 'xref']">
8889
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8890
- <xsl:if test="parent::*[local-name() = 'add']">
8891
- <xsl:call-template name="append_add-style"/>
8892
- </xsl:if>
8893
- <xsl:apply-templates/>
8894
- </fo:basic-link>
8983
+ <xsl:call-template name="insert_basic_link">
8984
+ <xsl:with-param name="element">
8985
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8986
+ <xsl:if test="parent::*[local-name() = 'add']">
8987
+ <xsl:call-template name="append_add-style"/>
8988
+ </xsl:if>
8989
+ <xsl:apply-templates/>
8990
+ </fo:basic-link>
8991
+ </xsl:with-param>
8992
+ </xsl:call-template>
8895
8993
  </xsl:template>
8896
8994
 
8897
8995
  <!-- ====== -->
@@ -9278,7 +9376,7 @@
9278
9376
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
9279
9377
  </xsl:when>
9280
9378
  <xsl:when test="not(starts-with(@src, 'data:'))">
9281
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9379
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9282
9380
  </xsl:when>
9283
9381
  <xsl:otherwise>
9284
9382
  <xsl:value-of select="@src"/>
@@ -9300,7 +9398,7 @@
9300
9398
  </xsl:when>
9301
9399
  <xsl:when test="not(starts-with(@src, 'data:'))">
9302
9400
  <xsl:variable name="src">
9303
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9401
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9304
9402
  </xsl:variable>
9305
9403
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9306
9404
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -9686,15 +9784,19 @@
9686
9784
  <xsl:param name="dest"/>
9687
9785
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
9688
9786
  <fo:block font-size="1pt">
9689
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9690
- <fo:inline-container inline-progression-dimension="100%">
9691
- <fo:block-container height="{$height - 1}px" width="100%">
9692
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
9693
- <xsl:attribute name="background-color">magenta</xsl:attribute>
9694
- </xsl:if> -->
9695
- <fo:block> </fo:block></fo:block-container>
9696
- </fo:inline-container>
9697
- </fo:basic-link>
9787
+ <xsl:call-template name="insert_basic_link">
9788
+ <xsl:with-param name="element">
9789
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9790
+ <fo:inline-container inline-progression-dimension="100%">
9791
+ <fo:block-container height="{$height - 1}px" width="100%">
9792
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
9793
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
9794
+ </xsl:if> -->
9795
+ <fo:block> </fo:block></fo:block-container>
9796
+ </fo:inline-container>
9797
+ </fo:basic-link>
9798
+ </xsl:with-param>
9799
+ </xsl:call-template>
9698
9800
  </fo:block>
9699
9801
  </fo:block-container>
9700
9802
  </xsl:template>
@@ -11251,14 +11353,18 @@
11251
11353
  </xsl:template>
11252
11354
 
11253
11355
  <xsl:template match="*[local-name() = 'origin']">
11254
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11255
- <xsl:if test="normalize-space(@citeas) = ''">
11256
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11257
- </xsl:if>
11258
- <fo:inline xsl:use-attribute-sets="origin-style">
11259
- <xsl:apply-templates/>
11260
- </fo:inline>
11261
- </fo:basic-link>
11356
+ <xsl:call-template name="insert_basic_link">
11357
+ <xsl:with-param name="element">
11358
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11359
+ <xsl:if test="normalize-space(@citeas) = ''">
11360
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11361
+ </xsl:if>
11362
+ <fo:inline xsl:use-attribute-sets="origin-style">
11363
+ <xsl:apply-templates/>
11364
+ </fo:inline>
11365
+ </fo:basic-link>
11366
+ </xsl:with-param>
11367
+ </xsl:call-template>
11262
11368
  </xsl:template>
11263
11369
 
11264
11370
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -11332,9 +11438,13 @@
11332
11438
  <xsl:if test="../*[local-name() = 'author']">
11333
11439
  <xsl:text>, </xsl:text>
11334
11440
  </xsl:if>
11335
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11336
- <xsl:apply-templates/>
11337
- </fo:basic-link>
11441
+ <xsl:call-template name="insert_basic_link">
11442
+ <xsl:with-param name="element">
11443
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11444
+ <xsl:apply-templates/>
11445
+ </fo:basic-link>
11446
+ </xsl:with-param>
11447
+ </xsl:call-template>
11338
11448
  </xsl:template>
11339
11449
 
11340
11450
  <xsl:template match="*[local-name() = 'author']">
@@ -11388,25 +11498,29 @@
11388
11498
  <xsl:attribute name="text-decoration">none</xsl:attribute>
11389
11499
  </xsl:if>
11390
11500
 
11391
- <fo:basic-link fox:alt-text="{@citeas}">
11392
- <xsl:if test="normalize-space(@citeas) = ''">
11393
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11394
- </xsl:if>
11395
- <xsl:if test="@type = 'inline'">
11501
+ <xsl:call-template name="insert_basic_link">
11502
+ <xsl:with-param name="element">
11503
+ <fo:basic-link fox:alt-text="{@citeas}">
11504
+ <xsl:if test="normalize-space(@citeas) = ''">
11505
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11506
+ </xsl:if>
11507
+ <xsl:if test="@type = 'inline'">
11396
11508
 
11397
- </xsl:if>
11509
+ </xsl:if>
11398
11510
 
11399
- <xsl:choose>
11400
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11401
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11402
- </xsl:when>
11403
- <xsl:otherwise>
11404
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11405
- </xsl:otherwise>
11406
- </xsl:choose>
11511
+ <xsl:choose>
11512
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11513
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11514
+ </xsl:when>
11515
+ <xsl:otherwise>
11516
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11517
+ </xsl:otherwise>
11518
+ </xsl:choose>
11407
11519
 
11408
- <xsl:apply-templates/>
11409
- </fo:basic-link>
11520
+ <xsl:apply-templates/>
11521
+ </fo:basic-link>
11522
+ </xsl:with-param>
11523
+ </xsl:call-template>
11410
11524
 
11411
11525
  </fo:inline>
11412
11526
  </xsl:when>
@@ -11649,7 +11763,10 @@
11649
11763
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
11650
11764
 
11651
11765
  <xsl:template name="setULLabel">
11652
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11766
+ <xsl:variable name="list_level__">
11767
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11768
+ </xsl:variable>
11769
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
11653
11770
  <xsl:variable name="list_level">
11654
11771
  <xsl:choose>
11655
11772
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -11782,9 +11899,11 @@
11782
11899
  </fo:block-container>
11783
11900
  </xsl:when>
11784
11901
  <xsl:otherwise>
11785
- <fo:block>
11786
- <xsl:apply-templates select="." mode="list"/>
11787
- </fo:block>
11902
+
11903
+ <fo:block>
11904
+ <xsl:apply-templates select="." mode="list"/>
11905
+ </fo:block>
11906
+
11788
11907
  </xsl:otherwise>
11789
11908
  </xsl:choose>
11790
11909
  </xsl:template>
@@ -12484,24 +12603,32 @@
12484
12603
  <xsl:for-each select="*[local-name() = 'tab']">
12485
12604
  <xsl:variable name="current_id" select="generate-id()"/>
12486
12605
  <fo:table-cell>
12487
- <fo:block>
12488
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12489
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12490
- <xsl:choose>
12491
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12492
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12493
- </xsl:choose>
12494
- </xsl:for-each>
12495
- </fo:basic-link>
12606
+ <fo:block line-height-shift-adjustment="disregard-shifts">
12607
+ <xsl:call-template name="insert_basic_link">
12608
+ <xsl:with-param name="element">
12609
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12610
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12611
+ <xsl:choose>
12612
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12613
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12614
+ </xsl:choose>
12615
+ </xsl:for-each>
12616
+ </fo:basic-link>
12617
+ </xsl:with-param>
12618
+ </xsl:call-template>
12496
12619
  </fo:block>
12497
12620
  </fo:table-cell>
12498
12621
  </xsl:for-each>
12499
12622
  <!-- last column - for page numbers -->
12500
12623
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
12501
12624
  <fo:block>
12502
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12503
- <fo:page-number-citation ref-id="{$target}"/>
12504
- </fo:basic-link>
12625
+ <xsl:call-template name="insert_basic_link">
12626
+ <xsl:with-param name="element">
12627
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12628
+ <fo:page-number-citation ref-id="{$target}"/>
12629
+ </fo:basic-link>
12630
+ </xsl:with-param>
12631
+ </xsl:call-template>
12505
12632
  </fo:block>
12506
12633
  </fo:table-cell>
12507
12634
  </xsl:template>
@@ -12543,6 +12670,27 @@
12543
12670
  <!-- End Table of Contents (ToC) processing -->
12544
12671
  <!-- =================== -->
12545
12672
 
12673
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
12674
+ <xsl:template name="insert_basic_link">
12675
+ <xsl:param name="element"/>
12676
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
12677
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
12678
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
12679
+ <xsl:choose>
12680
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
12681
+ <xsl:copy-of select="$element_node"/>
12682
+ </xsl:when>
12683
+ <xsl:otherwise>
12684
+ <fo:inline>
12685
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
12686
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
12687
+ </xsl:for-each>
12688
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
12689
+ </fo:inline>
12690
+ </xsl:otherwise>
12691
+ </xsl:choose>
12692
+ </xsl:template>
12693
+
12546
12694
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
12547
12695
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
12548
12696
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -4437,6 +4437,7 @@
4437
4437
  </xsl:attribute-set>
4438
4438
 
4439
4439
  <xsl:attribute-set name="xref-style">
4440
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4440
4441
 
4441
4442
  <xsl:attribute name="color">blue</xsl:attribute>
4442
4443
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -6479,9 +6480,13 @@
6479
6480
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6480
6481
  </xsl:if>
6481
6482
 
6482
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6483
- <xsl:value-of select="$current_fn_number_text"/>
6484
- </fo:basic-link>
6483
+ <xsl:call-template name="insert_basic_link">
6484
+ <xsl:with-param name="element">
6485
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6486
+ <xsl:value-of select="$current_fn_number_text"/>
6487
+ </fo:basic-link>
6488
+ </xsl:with-param>
6489
+ </xsl:call-template>
6485
6490
  </fo:inline>
6486
6491
  </xsl:variable>
6487
6492
 
@@ -6823,8 +6828,10 @@
6823
6828
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6824
6829
  <xsl:text> </xsl:text>
6825
6830
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6826
- <xsl:text/>
6827
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
6831
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
6832
+ <xsl:text> </xsl:text>
6833
+ </xsl:if>
6834
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
6828
6835
  </fo:block>
6829
6836
 
6830
6837
  </xsl:when> <!-- END: only one component -->
@@ -7311,8 +7318,18 @@
7311
7318
  </xsl:if>
7312
7319
  </xsl:template>
7313
7320
 
7314
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
7315
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7321
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
7322
+ <xsl:variable name="is_inline_element_after_where">
7323
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
7324
+ </xsl:variable>
7325
+ <xsl:choose>
7326
+ <xsl:when test="$is_inline_element_after_where = 'true'">
7327
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7328
+ </xsl:when>
7329
+ <xsl:otherwise>
7330
+ <xsl:apply-templates select="."/>
7331
+ </xsl:otherwise>
7332
+ </xsl:choose>
7316
7333
  </xsl:template>
7317
7334
 
7318
7335
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -8742,6 +8759,79 @@
8742
8759
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8743
8760
  </xsl:template>
8744
8761
 
8762
+ <!-- special case for:
8763
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8764
+ <mstyle displaystyle="true">
8765
+ <msup>
8766
+ <mi color="#00000000">C</mi>
8767
+ <mtext>R</mtext>
8768
+ </msup>
8769
+ <msubsup>
8770
+ <mtext>C</mtext>
8771
+ <mi>n</mi>
8772
+ <mi>k</mi>
8773
+ </msubsup>
8774
+ </mstyle>
8775
+ </math>
8776
+ -->
8777
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
8778
+ <xsl:copy>
8779
+ <xsl:copy-of select="@*"/>
8780
+ <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"/>
8781
+ <xsl:if test="string-length($next_mtext) != ''">
8782
+ <xsl:attribute name="color">#00000000</xsl:attribute>
8783
+ </xsl:if>
8784
+ <xsl:apply-templates/>
8785
+ <xsl:value-of select="$next_mtext"/>
8786
+ </xsl:copy>
8787
+ </xsl:template>
8788
+
8789
+ <!-- special case for:
8790
+ <msup>
8791
+ <mtext/>
8792
+ <mn>1</mn>
8793
+ </msup>
8794
+ convert to (add mspace after mtext and enclose them into mrow):
8795
+ <msup>
8796
+ <mrow>
8797
+ <mtext/>
8798
+ <mspace height="1.47ex"/>
8799
+ </mrow>
8800
+ <mn>1</mn>
8801
+ </msup>
8802
+ -->
8803
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
8804
+ <mathml:mrow>
8805
+ <xsl:copy-of select="."/>
8806
+ <mathml:mspace height="1.47ex"/>
8807
+ </mathml:mrow>
8808
+ </xsl:template>
8809
+
8810
+ <!-- add space around vertical line -->
8811
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
8812
+ <xsl:copy>
8813
+ <xsl:apply-templates select="@*" mode="mathml"/>
8814
+ <xsl:if test="not(@lspace)">
8815
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
8816
+ </xsl:if>
8817
+ <xsl:if test="not(@rspace)">
8818
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
8819
+ </xsl:if>
8820
+ <xsl:apply-templates mode="mathml"/>
8821
+ </xsl:copy>
8822
+ </xsl:template>
8823
+
8824
+ <!-- decrease fontsize for 'Circled Times' char -->
8825
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
8826
+ <xsl:copy>
8827
+ <xsl:apply-templates select="@*" mode="mathml"/>
8828
+ <xsl:if test="not(@fontsize)">
8829
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
8830
+ </xsl:if>
8831
+ <xsl:apply-templates mode="mathml"/>
8832
+ </xsl:copy>
8833
+ </xsl:template>
8834
+
8745
8835
  <!-- Examples:
8746
8836
  <stem type="AsciiMath">x = 1</stem>
8747
8837
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8811,19 +8901,23 @@
8811
8901
  <xsl:apply-templates/>
8812
8902
  </xsl:when>
8813
8903
  <xsl:otherwise>
8814
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8815
- <xsl:choose>
8816
- <xsl:when test="normalize-space(.) = ''">
8817
- <xsl:call-template name="add-zero-spaces-link-java">
8818
- <xsl:with-param name="text" select="$target_text"/>
8819
- </xsl:call-template>
8820
- </xsl:when>
8821
- <xsl:otherwise>
8822
- <!-- output text from <link>text</link> -->
8823
- <xsl:apply-templates/>
8824
- </xsl:otherwise>
8825
- </xsl:choose>
8826
- </fo:basic-link>
8904
+ <xsl:call-template name="insert_basic_link">
8905
+ <xsl:with-param name="element">
8906
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8907
+ <xsl:choose>
8908
+ <xsl:when test="normalize-space(.) = ''">
8909
+ <xsl:call-template name="add-zero-spaces-link-java">
8910
+ <xsl:with-param name="text" select="$target_text"/>
8911
+ </xsl:call-template>
8912
+ </xsl:when>
8913
+ <xsl:otherwise>
8914
+ <!-- output text from <link>text</link> -->
8915
+ <xsl:apply-templates/>
8916
+ </xsl:otherwise>
8917
+ </xsl:choose>
8918
+ </fo:basic-link>
8919
+ </xsl:with-param>
8920
+ </xsl:call-template>
8827
8921
  </xsl:otherwise>
8828
8922
  </xsl:choose>
8829
8923
  </fo:inline>
@@ -8886,12 +8980,16 @@
8886
8980
  </xsl:template>
8887
8981
 
8888
8982
  <xsl:template match="*[local-name() = 'xref']">
8889
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8890
- <xsl:if test="parent::*[local-name() = 'add']">
8891
- <xsl:call-template name="append_add-style"/>
8892
- </xsl:if>
8893
- <xsl:apply-templates/>
8894
- </fo:basic-link>
8983
+ <xsl:call-template name="insert_basic_link">
8984
+ <xsl:with-param name="element">
8985
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8986
+ <xsl:if test="parent::*[local-name() = 'add']">
8987
+ <xsl:call-template name="append_add-style"/>
8988
+ </xsl:if>
8989
+ <xsl:apply-templates/>
8990
+ </fo:basic-link>
8991
+ </xsl:with-param>
8992
+ </xsl:call-template>
8895
8993
  </xsl:template>
8896
8994
 
8897
8995
  <!-- ====== -->
@@ -9278,7 +9376,7 @@
9278
9376
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
9279
9377
  </xsl:when>
9280
9378
  <xsl:when test="not(starts-with(@src, 'data:'))">
9281
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9379
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9282
9380
  </xsl:when>
9283
9381
  <xsl:otherwise>
9284
9382
  <xsl:value-of select="@src"/>
@@ -9300,7 +9398,7 @@
9300
9398
  </xsl:when>
9301
9399
  <xsl:when test="not(starts-with(@src, 'data:'))">
9302
9400
  <xsl:variable name="src">
9303
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9401
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9304
9402
  </xsl:variable>
9305
9403
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9306
9404
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -9686,15 +9784,19 @@
9686
9784
  <xsl:param name="dest"/>
9687
9785
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
9688
9786
  <fo:block font-size="1pt">
9689
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9690
- <fo:inline-container inline-progression-dimension="100%">
9691
- <fo:block-container height="{$height - 1}px" width="100%">
9692
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
9693
- <xsl:attribute name="background-color">magenta</xsl:attribute>
9694
- </xsl:if> -->
9695
- <fo:block> </fo:block></fo:block-container>
9696
- </fo:inline-container>
9697
- </fo:basic-link>
9787
+ <xsl:call-template name="insert_basic_link">
9788
+ <xsl:with-param name="element">
9789
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9790
+ <fo:inline-container inline-progression-dimension="100%">
9791
+ <fo:block-container height="{$height - 1}px" width="100%">
9792
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
9793
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
9794
+ </xsl:if> -->
9795
+ <fo:block> </fo:block></fo:block-container>
9796
+ </fo:inline-container>
9797
+ </fo:basic-link>
9798
+ </xsl:with-param>
9799
+ </xsl:call-template>
9698
9800
  </fo:block>
9699
9801
  </fo:block-container>
9700
9802
  </xsl:template>
@@ -11251,14 +11353,18 @@
11251
11353
  </xsl:template>
11252
11354
 
11253
11355
  <xsl:template match="*[local-name() = 'origin']">
11254
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11255
- <xsl:if test="normalize-space(@citeas) = ''">
11256
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11257
- </xsl:if>
11258
- <fo:inline xsl:use-attribute-sets="origin-style">
11259
- <xsl:apply-templates/>
11260
- </fo:inline>
11261
- </fo:basic-link>
11356
+ <xsl:call-template name="insert_basic_link">
11357
+ <xsl:with-param name="element">
11358
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11359
+ <xsl:if test="normalize-space(@citeas) = ''">
11360
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11361
+ </xsl:if>
11362
+ <fo:inline xsl:use-attribute-sets="origin-style">
11363
+ <xsl:apply-templates/>
11364
+ </fo:inline>
11365
+ </fo:basic-link>
11366
+ </xsl:with-param>
11367
+ </xsl:call-template>
11262
11368
  </xsl:template>
11263
11369
 
11264
11370
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -11332,9 +11438,13 @@
11332
11438
  <xsl:if test="../*[local-name() = 'author']">
11333
11439
  <xsl:text>, </xsl:text>
11334
11440
  </xsl:if>
11335
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11336
- <xsl:apply-templates/>
11337
- </fo:basic-link>
11441
+ <xsl:call-template name="insert_basic_link">
11442
+ <xsl:with-param name="element">
11443
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11444
+ <xsl:apply-templates/>
11445
+ </fo:basic-link>
11446
+ </xsl:with-param>
11447
+ </xsl:call-template>
11338
11448
  </xsl:template>
11339
11449
 
11340
11450
  <xsl:template match="*[local-name() = 'author']">
@@ -11388,25 +11498,29 @@
11388
11498
  <xsl:attribute name="text-decoration">none</xsl:attribute>
11389
11499
  </xsl:if>
11390
11500
 
11391
- <fo:basic-link fox:alt-text="{@citeas}">
11392
- <xsl:if test="normalize-space(@citeas) = ''">
11393
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11394
- </xsl:if>
11395
- <xsl:if test="@type = 'inline'">
11501
+ <xsl:call-template name="insert_basic_link">
11502
+ <xsl:with-param name="element">
11503
+ <fo:basic-link fox:alt-text="{@citeas}">
11504
+ <xsl:if test="normalize-space(@citeas) = ''">
11505
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11506
+ </xsl:if>
11507
+ <xsl:if test="@type = 'inline'">
11396
11508
 
11397
- </xsl:if>
11509
+ </xsl:if>
11398
11510
 
11399
- <xsl:choose>
11400
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11401
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11402
- </xsl:when>
11403
- <xsl:otherwise>
11404
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11405
- </xsl:otherwise>
11406
- </xsl:choose>
11511
+ <xsl:choose>
11512
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11513
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11514
+ </xsl:when>
11515
+ <xsl:otherwise>
11516
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11517
+ </xsl:otherwise>
11518
+ </xsl:choose>
11407
11519
 
11408
- <xsl:apply-templates/>
11409
- </fo:basic-link>
11520
+ <xsl:apply-templates/>
11521
+ </fo:basic-link>
11522
+ </xsl:with-param>
11523
+ </xsl:call-template>
11410
11524
 
11411
11525
  </fo:inline>
11412
11526
  </xsl:when>
@@ -11649,7 +11763,10 @@
11649
11763
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
11650
11764
 
11651
11765
  <xsl:template name="setULLabel">
11652
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11766
+ <xsl:variable name="list_level__">
11767
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11768
+ </xsl:variable>
11769
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
11653
11770
  <xsl:variable name="list_level">
11654
11771
  <xsl:choose>
11655
11772
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -11782,9 +11899,11 @@
11782
11899
  </fo:block-container>
11783
11900
  </xsl:when>
11784
11901
  <xsl:otherwise>
11785
- <fo:block>
11786
- <xsl:apply-templates select="." mode="list"/>
11787
- </fo:block>
11902
+
11903
+ <fo:block>
11904
+ <xsl:apply-templates select="." mode="list"/>
11905
+ </fo:block>
11906
+
11788
11907
  </xsl:otherwise>
11789
11908
  </xsl:choose>
11790
11909
  </xsl:template>
@@ -12484,24 +12603,32 @@
12484
12603
  <xsl:for-each select="*[local-name() = 'tab']">
12485
12604
  <xsl:variable name="current_id" select="generate-id()"/>
12486
12605
  <fo:table-cell>
12487
- <fo:block>
12488
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12489
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12490
- <xsl:choose>
12491
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12492
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12493
- </xsl:choose>
12494
- </xsl:for-each>
12495
- </fo:basic-link>
12606
+ <fo:block line-height-shift-adjustment="disregard-shifts">
12607
+ <xsl:call-template name="insert_basic_link">
12608
+ <xsl:with-param name="element">
12609
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12610
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12611
+ <xsl:choose>
12612
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12613
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12614
+ </xsl:choose>
12615
+ </xsl:for-each>
12616
+ </fo:basic-link>
12617
+ </xsl:with-param>
12618
+ </xsl:call-template>
12496
12619
  </fo:block>
12497
12620
  </fo:table-cell>
12498
12621
  </xsl:for-each>
12499
12622
  <!-- last column - for page numbers -->
12500
12623
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
12501
12624
  <fo:block>
12502
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12503
- <fo:page-number-citation ref-id="{$target}"/>
12504
- </fo:basic-link>
12625
+ <xsl:call-template name="insert_basic_link">
12626
+ <xsl:with-param name="element">
12627
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12628
+ <fo:page-number-citation ref-id="{$target}"/>
12629
+ </fo:basic-link>
12630
+ </xsl:with-param>
12631
+ </xsl:call-template>
12505
12632
  </fo:block>
12506
12633
  </fo:table-cell>
12507
12634
  </xsl:template>
@@ -12543,6 +12670,27 @@
12543
12670
  <!-- End Table of Contents (ToC) processing -->
12544
12671
  <!-- =================== -->
12545
12672
 
12673
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
12674
+ <xsl:template name="insert_basic_link">
12675
+ <xsl:param name="element"/>
12676
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
12677
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
12678
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
12679
+ <xsl:choose>
12680
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
12681
+ <xsl:copy-of select="$element_node"/>
12682
+ </xsl:when>
12683
+ <xsl:otherwise>
12684
+ <fo:inline>
12685
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
12686
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
12687
+ </xsl:for-each>
12688
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
12689
+ </fo:inline>
12690
+ </xsl:otherwise>
12691
+ </xsl:choose>
12692
+ </xsl:template>
12693
+
12546
12694
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
12547
12695
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
12548
12696
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -38,6 +38,9 @@ module IsoDoc
38
38
 
39
39
  def make_WordToC(docxml, level)
40
40
  toc = ""
41
+ if source = docxml.at("//div[@class = 'TOC']")
42
+ toc = to_xml(source.children)
43
+ end
41
44
  xpath = (1..level).each.map do |i|
42
45
  "//h#{i}[not(ancestor::*[@class = 'WordSection2'])]"
43
46
  end.join (" | ")
@@ -70,7 +73,7 @@ module IsoDoc
70
73
  if hdr.at("./ancestor::div[@class = 'Annex']")
71
74
  hdr.delete("class")
72
75
  hdr["style"] = "mso-list:l13 level#{idx} lfo33;"
73
- elsif hdr.at("./ancestor::div[@class = 'Section3']")
76
+ elsif hdr.at("./ancestor::div[@class = 'Section3' or @class = 'WordSectionContents']")
74
77
  hdr.name = "p"
75
78
  hdr["class"] = "IEEEStdsLevel#{idx}frontmatter"
76
79
  else
@@ -47,12 +47,11 @@ module IsoDoc
47
47
  ulstyle: "l11", olstyle: "l16" }
48
48
  end
49
49
 
50
- def abstract(isoxml, out)
51
- f = isoxml.at(ns("//preface/abstract")) || return
50
+ def abstract(clause, out)
52
51
  page_break(out)
53
- out.div **attr_code(id: f["id"], class: "abstract") do |s|
54
- clause_name(f, f.at(ns("./title")), s, { class: "AbstractTitle" })
55
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
52
+ out.div **attr_code(id: clause["id"], class: "abstract") do |s|
53
+ clause_name(clause, clause.at(ns("./title")), s, { class: "AbstractTitle" })
54
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
56
55
  end
57
56
  end
58
57
 
@@ -176,6 +175,16 @@ module IsoDoc
176
175
  end
177
176
  end
178
177
 
178
+ def table_of_contents(clause, out)
179
+ out.div class: "WordSectionContents" do |div|
180
+ clause_name(clause, clause.at(ns("./title")), div,
181
+ { class: "IEEEStdsLevel1frontmatter" })
182
+ clause.elements.each do |e|
183
+ parse(e, div) unless e.name == "title"
184
+ end
185
+ end
186
+ end
187
+
179
188
  include BaseConvert
180
189
  include Init
181
190
  end
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/ieee" xmlns="http://relaxng.org/ns/structure/1.0">
2
+ <grammar ns='https://www.metanorma.org/ns/ieee' xmlns="http://relaxng.org/ns/structure/1.0">
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.
@@ -29,13 +30,7 @@
29
30
  </include>
30
31
  <define name="ieee-standard">
31
32
  <element name="ieee-standard">
32
- <attribute name="version"/>
33
- <attribute name="type">
34
- <choice>
35
- <value>semantic</value>
36
- <value>presentation</value>
37
- </choice>
38
- </attribute>
33
+ <ref name="Root-Attributes"/>
39
34
  <ref name="bibdata"/>
40
35
  <zeroOrMore>
41
36
  <ref name="termdocsource"/>
@@ -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,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.0.9".freeze
3
+ VERSION = "1.0.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
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: metanorma-standoc