metanorma-iec 1.3.10 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2597,6 +2597,8 @@
2597
2597
 
2598
2598
  <title-list-figures lang="en">List of Figures</title-list-figures>
2599
2599
 
2600
+ <title-table-figures lang="en">Table of Figures</title-table-figures>
2601
+
2600
2602
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2601
2603
 
2602
2604
  <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
@@ -2873,6 +2875,11 @@
2873
2875
 
2874
2876
 
2875
2877
 
2878
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
2879
+
2880
+
2881
+
2882
+
2876
2883
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
2877
2884
 
2878
2885
 
@@ -3049,13 +3056,20 @@
3049
3056
 
3050
3057
  </xsl:attribute-set><xsl:attribute-set name="list-style">
3051
3058
 
3052
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
3059
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
3060
+ <xsl:attribute name="line-height">135%</xsl:attribute>
3061
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
3053
3062
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3054
3063
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
3055
3064
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
3056
3065
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
3057
3066
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
3058
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
3067
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
3068
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3069
+ <xsl:sort select="@displayorder" data-type="number"/>
3070
+ <xsl:apply-templates select="." mode="contents"/>
3071
+ </xsl:for-each>
3072
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
3059
3073
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
3060
3074
 
3061
3075
  <!-- Normative references -->
@@ -3068,13 +3082,33 @@
3068
3082
  <!-- Bibliography -->
3069
3083
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
3070
3084
 
3071
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3085
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
3086
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3087
+ <xsl:sort select="@displayorder" data-type="number"/>
3088
+ <xsl:apply-templates select="." mode="contents"/>
3089
+ </xsl:for-each>
3090
+
3091
+ <xsl:for-each select="/*/*[local-name()='annex']">
3092
+ <xsl:sort select="@displayorder" data-type="number"/>
3093
+ <xsl:apply-templates select="." mode="contents"/>
3094
+ </xsl:for-each>
3095
+
3096
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3097
+ <xsl:sort select="@displayorder" data-type="number"/>
3098
+ <xsl:apply-templates select="." mode="contents"/>
3099
+ </xsl:for-each>
3100
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
3072
3101
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
3073
3102
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
3074
3103
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
3075
3104
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
3076
3105
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
3077
- </xsl:template><xsl:template name="processMainSectionsDefault">
3106
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3107
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3108
+ <xsl:sort select="@displayorder" data-type="number"/>
3109
+ <xsl:apply-templates select="."/>
3110
+ </xsl:for-each>
3111
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
3078
3112
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
3079
3113
 
3080
3114
  <!-- Normative references -->
@@ -3086,6 +3120,22 @@
3086
3120
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
3087
3121
  <!-- Bibliography -->
3088
3122
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
3123
+ </xsl:template><xsl:template name="processMainSectionsDefault">
3124
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3125
+ <xsl:sort select="@displayorder" data-type="number"/>
3126
+ <xsl:apply-templates select="."/>
3127
+
3128
+ </xsl:for-each>
3129
+
3130
+ <xsl:for-each select="/*/*[local-name()='annex']">
3131
+ <xsl:sort select="@displayorder" data-type="number"/>
3132
+ <xsl:apply-templates select="."/>
3133
+ </xsl:for-each>
3134
+
3135
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3136
+ <xsl:sort select="@displayorder" data-type="number"/>
3137
+ <xsl:apply-templates select="."/>
3138
+ </xsl:for-each>
3089
3139
  </xsl:template><xsl:template match="text()">
3090
3140
  <xsl:value-of select="."/>
3091
3141
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -3980,9 +4030,8 @@
3980
4030
 
3981
4031
  <!-- Table's note name (NOTE, for example) -->
3982
4032
 
3983
- <fo:inline padding-right="2mm">
4033
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
3984
4034
 
3985
-
3986
4035
 
3987
4036
 
3988
4037
 
@@ -4633,6 +4682,8 @@
4633
4682
  <xsl:if test="$font-size != ''">
4634
4683
  <xsl:attribute name="font-size">
4635
4684
  <xsl:choose>
4685
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4686
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4636
4687
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4637
4688
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4638
4689
  </xsl:choose>
@@ -5438,6 +5489,7 @@
5438
5489
  <xsl:otherwise>
5439
5490
  <fo:block xsl:use-attribute-sets="image-style">
5440
5491
 
5492
+
5441
5493
  <xsl:variable name="src">
5442
5494
  <xsl:call-template name="image_src"/>
5443
5495
  </xsl:variable>
@@ -5685,6 +5737,13 @@
5685
5737
  </xsl:attribute>
5686
5738
  <xsl:apply-templates mode="svg_update"/>
5687
5739
  </xsl:copy>
5740
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
5741
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5742
+ <xsl:for-each select="*[local-name() = 'svg']">
5743
+ <xsl:call-template name="image_svg">
5744
+ <xsl:with-param name="name" select="$name"/>
5745
+ </xsl:call-template>
5746
+ </xsl:for-each>
5688
5747
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5689
5748
  <xsl:variable name="svg_content" select="document(@src)"/>
5690
5749
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5789,7 +5848,7 @@
5789
5848
  </fo:basic-link>
5790
5849
  </fo:block>
5791
5850
  </fo:block-container>
5792
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5851
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5793
5852
  <xsl:apply-templates mode="contents"/>
5794
5853
  <xsl:text> </xsl:text>
5795
5854
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
@@ -5797,7 +5856,7 @@
5797
5856
  <xsl:text> </xsl:text>
5798
5857
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
5799
5858
  <xsl:value-of select="."/>
5800
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5859
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
5801
5860
  <xsl:value-of select="."/>
5802
5861
  </xsl:template><xsl:template match="node()" mode="contents">
5803
5862
  <xsl:apply-templates mode="contents"/>
@@ -5895,6 +5954,8 @@
5895
5954
 
5896
5955
 
5897
5956
 
5957
+
5958
+
5898
5959
  </fo:bookmark-tree>
5899
5960
  </xsl:if>
5900
5961
  </xsl:template><xsl:template name="insertFigureBookmarks">
@@ -6088,12 +6149,16 @@
6088
6149
  <xsl:if test="$font-size != ''">
6089
6150
  <xsl:attribute name="font-size">
6090
6151
  <xsl:choose>
6152
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6153
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6091
6154
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6092
6155
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6093
6156
  </xsl:choose>
6094
6157
  </xsl:attribute>
6095
6158
  </xsl:if>
6096
6159
 
6160
+
6161
+
6097
6162
  <xsl:apply-templates/>
6098
6163
  </fo:block>
6099
6164
 
@@ -6441,6 +6506,7 @@
6441
6506
  </xsl:choose>
6442
6507
  </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
6443
6508
  <fo:block xsl:use-attribute-sets="termsource-style">
6509
+
6444
6510
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
6445
6511
  <xsl:variable name="termsource_text">
6446
6512
  <xsl:apply-templates/>
@@ -6469,14 +6535,15 @@
6469
6535
  </xsl:if>
6470
6536
  </xsl:template><xsl:variable name="localized.source">
6471
6537
  <xsl:call-template name="getLocalizedString">
6472
- <xsl:with-param name="key">source</xsl:with-param>
6473
- </xsl:call-template>
6538
+ <xsl:with-param name="key">source</xsl:with-param>
6539
+ </xsl:call-template>
6474
6540
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6475
6541
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6476
6542
  <xsl:if test="normalize-space(@citeas) = ''">
6477
6543
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6478
6544
  </xsl:if>
6479
6545
 
6546
+
6480
6547
  <fo:inline>
6481
6548
 
6482
6549
 
@@ -6484,6 +6551,7 @@
6484
6551
 
6485
6552
 
6486
6553
 
6554
+
6487
6555
  <xsl:call-template name="getTitle">
6488
6556
  <xsl:with-param name="name" select="'title-source'"/>
6489
6557
  </xsl:call-template>
@@ -6495,6 +6563,7 @@
6495
6563
  <fo:inline xsl:use-attribute-sets="origin-style">
6496
6564
  <xsl:apply-templates/>
6497
6565
  </fo:inline>
6566
+
6498
6567
  </fo:basic-link>
6499
6568
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6500
6569
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -6561,6 +6630,9 @@
6561
6630
 
6562
6631
  </xsl:if>
6563
6632
 
6633
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
6634
+ <xsl:variable name="text" select="normalize-space()"/>
6635
+
6564
6636
 
6565
6637
 
6566
6638
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -6573,7 +6645,9 @@
6573
6645
 
6574
6646
 
6575
6647
  </xsl:if>
6576
-
6648
+
6649
+
6650
+
6577
6651
  <xsl:apply-templates/>
6578
6652
  </fo:basic-link>
6579
6653
 
@@ -6908,6 +6982,7 @@
6908
6982
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6909
6983
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6910
6984
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6985
+
6911
6986
  <xsl:apply-templates/>
6912
6987
  </fo:block>
6913
6988
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -7076,9 +7151,97 @@
7076
7151
  <fo:block-container border="1pt solid black" width="50%">
7077
7152
  <fo:block> </fo:block>
7078
7153
  </fo:block-container>
7154
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
7155
+ <xsl:param name="colwidths"/>
7156
+ <xsl:variable name="colwidths_">
7157
+ <xsl:choose>
7158
+ <xsl:when test="not($colwidths)">
7159
+ <xsl:variable name="toc_table_simple">
7160
+ <tbody>
7161
+ <xsl:apply-templates mode="toc_table_width"/>
7162
+ </tbody>
7163
+ </xsl:variable>
7164
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
7165
+ <xsl:call-template name="calculate-column-widths">
7166
+ <xsl:with-param name="cols-count" select="$cols-count"/>
7167
+ <xsl:with-param name="table" select="$toc_table_simple"/>
7168
+ </xsl:call-template>
7169
+ </xsl:when>
7170
+ <xsl:otherwise>
7171
+ <xsl:copy-of select="$colwidths"/>
7172
+ </xsl:otherwise>
7173
+ </xsl:choose>
7174
+ </xsl:variable>
7175
+ <fo:block role="TOCI" space-after="16pt">
7176
+ <fo:table width="100%" table-layout="fixed">
7177
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
7178
+ <fo:table-column column-width="proportional-column-width({.})"/>
7179
+ </xsl:for-each>
7180
+ <fo:table-body>
7181
+ <xsl:apply-templates/>
7182
+ </fo:table-body>
7183
+ </fo:table>
7184
+ </fo:block>
7185
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7186
+ <fo:table-row min-height="5mm">
7187
+ <xsl:apply-templates/>
7188
+ </fo:table-row>
7189
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
7190
+ <xsl:apply-templates/>
7191
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
7192
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
7193
+ <xsl:variable name="target" select="@target"/>
7194
+ <xsl:for-each select="*[local-name() = 'tab']">
7195
+ <xsl:variable name="current_id" select="generate-id()"/>
7196
+ <fo:table-cell>
7197
+ <fo:block>
7198
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
7199
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
7200
+ <xsl:choose>
7201
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
7202
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
7203
+ </xsl:choose>
7204
+ </xsl:for-each>
7205
+ </fo:basic-link>
7206
+ </fo:block>
7207
+ </fo:table-cell>
7208
+ </xsl:for-each>
7209
+ <!-- last column - for page numbers -->
7210
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
7211
+ <fo:block>
7212
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
7213
+ <fo:page-number-citation ref-id="{$target}"/>
7214
+ </fo:basic-link>
7215
+ </fo:block>
7216
+ </fo:table-cell>
7217
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
7218
+ <xsl:apply-templates mode="toc_table_width"/>
7219
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
7220
+ <tr>
7221
+ <xsl:apply-templates mode="toc_table_width"/>
7222
+ </tr>
7223
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
7224
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
7225
+ <xsl:for-each select="*[local-name() = 'tab']">
7226
+ <xsl:variable name="current_id" select="generate-id()"/>
7227
+ <td>
7228
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
7229
+ <xsl:copy-of select="."/>
7230
+ </xsl:for-each>
7231
+ </td>
7232
+ </xsl:for-each>
7233
+ <td>333</td> <!-- page number, just for fill -->
7079
7234
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7080
7235
  <fo:inline padding-right="5mm"> </fo:inline>
7081
7236
  <fo:inline><xsl:apply-templates/></fo:inline>
7237
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
7238
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
7239
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
7240
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
7241
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
7242
+ </svg>
7243
+ </fo:instream-foreign-object>
7244
+ </fo:inline>
7082
7245
  </xsl:template><xsl:template name="convertDate">
7083
7246
  <xsl:param name="date"/>
7084
7247
  <xsl:param name="format" select="'short'"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.3.10".freeze
3
+ VERSION = "1.4.0".freeze
4
4
  end
5
5
  end
6
6
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
29
29
 
30
- spec.add_dependency "metanorma-iso", "~> 1.9.0"
30
+ spec.add_dependency "metanorma-iso", "~> 1.10.0"
31
31
  spec.add_dependency "ruby-jing"
32
32
 
33
33
  spec.add_development_dependency "byebug"
@@ -1,8 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
- OPTIONS = [backend: :iec, header_footer: true].freeze
5
-
6
4
  RSpec.describe Asciidoctor::Iec do
7
5
  before(:all) do
8
6
  @blank_hdr = blank_hdr_gen
@@ -133,7 +133,7 @@ RSpec.describe Asciidoctor::Iec do
133
133
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
134
134
  #{TERMS_BOILERPLATE}
135
135
  <term id="term-term1">
136
- <preferred>Term1</preferred>
136
+ <preferred><expression><name>Term1</name></expression></preferred>
137
137
  <termnote id="_">
138
138
  <p id="_">This is a note</p>
139
139
  </termnote>
@@ -255,7 +255,7 @@ RSpec.describe Asciidoctor::Iec do
255
255
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
256
256
  #{TERMS_BOILERPLATE}
257
257
  <term id="term-term1">
258
- <preferred>Term1</preferred>
258
+ <preferred><expression><name>Term1</name></expression></preferred>
259
259
  <termexample id="_">
260
260
  <p id="_">This is an example</p>
261
261
  </termexample>
@@ -467,77 +467,4 @@ RSpec.describe Asciidoctor::Iec do
467
467
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
468
468
  .to be_equivalent_to xmlpp(output)
469
469
  end
470
-
471
- it "processes unmodified term sources" do
472
- input = <<~INPUT
473
- #{ASCIIDOC_BLANK_HDR}
474
- == Terms and Definitions
475
-
476
- === Term1
477
-
478
- [.source]
479
- <<ISO2191,section=1>>
480
- INPUT
481
- output = <<~OUTPUT
482
- #{@blank_hdr}
483
- <sections>
484
- <terms id="_" obligation="normative">
485
- <title>Terms and definitions</title>
486
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
487
- #{TERMS_BOILERPLATE}
488
- <term id="term-term1">
489
- <preferred>Term1</preferred>
490
- <termsource status="identical">
491
- <origin bibitemid="ISO2191" type="inline" citeas="">
492
- <localityStack>
493
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
494
- </localityStack>
495
- </origin>
496
- </termsource>
497
- </term>
498
- </terms>
499
- </sections>
500
- </iec-standard>
501
- OUTPUT
502
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
503
- .to be_equivalent_to xmlpp(output)
504
- end
505
-
506
- it "processes modified term sources" do
507
- input = <<~INPUT
508
- #{ASCIIDOC_BLANK_HDR}
509
- == Terms and Definitions
510
-
511
- === Term1
512
-
513
- [.source]
514
- <<ISO2191,section=1>>, with adjustments
515
- INPUT
516
- output = <<~OUTPUT
517
- #{@blank_hdr}
518
- <sections>
519
- <terms id="_" obligation="normative">
520
- <title>Terms and definitions</title>
521
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
522
- #{TERMS_BOILERPLATE}
523
- <term id="term-term1">
524
- <preferred>Term1</preferred>
525
- <termsource status="modified">
526
- <origin bibitemid="ISO2191" type="inline" citeas="">
527
- <localityStack>
528
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
529
- </localityStack>
530
- </origin>
531
- <modification>
532
- <p id="_">with adjustments</p>
533
- </modification>
534
- </termsource>
535
- </term>
536
- </terms>
537
- </sections>
538
- </iec-standard>
539
- OUTPUT
540
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
541
- .to be_equivalent_to xmlpp(output)
542
- end
543
470
  end
@@ -96,94 +96,6 @@ end
96
96
  OUTPUT
97
97
  end
98
98
 
99
- it "processes stem-only terms as admitted" do
100
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
101
- #{ASCIIDOC_BLANK_HDR}
102
- == Terms and Definitions
103
-
104
- === stem:[t_90]
105
-
106
- stem:[t_91]
107
-
108
- Time
109
- INPUT
110
- #{@blank_hdr}
111
- <sections>
112
- <terms id="_" obligation="normative">
113
- <title>Terms and definitions</title>
114
- <p id="_">For the purposes of this document,
115
- the following terms and definitions apply.</p>
116
- #{TERMS_BOILERPLATE}
117
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
118
- <mi>t</mi>
119
- </mrow>
120
- <mrow>
121
- <mn>90</mn>
122
- </mrow>
123
- </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
124
- <mi>t</mi>
125
- </mrow>
126
- <mrow>
127
- <mn>91</mn>
128
- </mrow>
129
- </msub></math></stem></admitted>
130
- <definition><p id="_">Time</p></definition></term>
131
- </terms>
132
- </sections>
133
- </iec-standard>
134
- OUTPUT
135
- end
136
-
137
- it "permits multiple blocks in term definition paragraph" do
138
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
139
- = Document title
140
- Author
141
- :docfile: test.adoc
142
- :nodoc:
143
- :novalid:
144
- :stem:
145
- :no-isobib:
146
-
147
- == Terms and Definitions
148
-
149
- === stem:[t_90]
150
-
151
- [stem]
152
- ++++
153
- t_A
154
- ++++
155
-
156
- This paragraph is extraneous
157
- INPUT
158
- #{@blank_hdr}
159
- <sections>
160
- <terms id="_" obligation="normative">
161
- <title>Terms and definitions</title>
162
- <p id="_">For the purposes of this document,
163
- the following terms and definitions apply.</p>
164
- #{TERMS_BOILERPLATE}
165
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
166
- <mi>t</mi>
167
- </mrow>
168
- <mrow>
169
- <mn>90</mn>
170
- </mrow>
171
- </msub></math></stem></preferred><definition><formula id="_">
172
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
173
- <mi>t</mi>
174
- </mrow>
175
- <mrow>
176
- <mi>A</mi>
177
- </mrow>
178
- </msub></math></stem>
179
- </formula><p id="_">This paragraph is extraneous</p></definition>
180
- </term>
181
- </terms>
182
- </sections>
183
- </iec-standard>
184
- OUTPUT
185
- end
186
-
187
99
  it "keeps any initial boilerplate from terms and definitions" do
188
100
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
189
101
  #{ASCIIDOC_BLANK_HDR}
@@ -210,8 +122,8 @@ end
210
122
  </li>
211
123
  </ul>
212
124
  <term id="term-time">
213
- <preferred>Time</preferred>
214
- <definition><p id="_">This paragraph is extraneous</p></definition>
125
+ <preferred><expression><name>Time</name></expression></preferred>
126
+ <definition><verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition></definition>
215
127
  </term></terms>
216
128
  </sections>
217
129
  </iec-standard>
@@ -254,38 +166,6 @@ end
254
166
  OUTPUT
255
167
  end
256
168
 
257
- it "processes localities in term sources" do
258
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
259
- #{ASCIIDOC_BLANK_HDR}
260
- == Terms and Definitions
261
-
262
- === Term1
263
-
264
- [.source]
265
- <<ISO2191,section=1>>
266
- INPUT
267
- #{@blank_hdr}
268
- <sections>
269
- <terms id="_" obligation="normative">
270
- <title>Terms and definitions</title>
271
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
272
- #{TERMS_BOILERPLATE}
273
- <term id="term-term1">
274
- <preferred>Term1</preferred>
275
- <termsource status="identical">
276
- <origin bibitemid="ISO2191" type="inline" citeas="">
277
- <localityStack>
278
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
279
- </localityStack>
280
- </origin>
281
- </termsource>
282
- </term>
283
- </terms>
284
- </sections>
285
- </iec-standard>
286
- OUTPUT
287
- end
288
-
289
169
  it "removes extraneous material from Normative References" do
290
170
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
291
171
  #{ASCIIDOC_BLANK_HDR}
@@ -9,7 +9,7 @@ end
9
9
 
10
10
 
11
11
  it "generates reference boilerplate for IEV" do
12
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
12
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
13
13
  = Document title
14
14
  Author
15
15
  :docfile: test.adoc
@@ -90,7 +90,7 @@ end
90
90
  end
91
91
 
92
92
  it "generates terms boilerplate for IEV" do
93
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
93
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
94
94
  = Document title
95
95
  Author
96
96
  :docfile: test.adoc
@@ -157,7 +157,7 @@ INPUT
157
157
  <terms id='_' obligation='normative'>
158
158
  <title>General</title>
159
159
  <term id='term-term-1'>
160
- <preferred>Term 1</preferred>
160
+ <preferred><expression><name>Term 1</name></expression></preferred>
161
161
  </term>
162
162
  </terms>
163
163
  </clause>
@@ -168,7 +168,7 @@ OUTPUT
168
168
  end
169
169
 
170
170
  it "uses IEV introduction title" do
171
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
171
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
172
172
  = Document title
173
173
  Author
174
174
  :docfile: test.adoc