metanorma-ieee 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e84f9dd6b6e556837d431e572dbe1bacfaae32997260f02d900b0186a54d01de
4
- data.tar.gz: ae742824b749285c825ebe9d4c88d259c318addfe2982ff5ef19211b4937ddad
3
+ metadata.gz: 9d385541cb9e78fa0d9483068e986baf934834df10bebd3c9a17264543d82fd8
4
+ data.tar.gz: fdd0216aa35a5619165c08ef254bdaa1683057270afe086854fbbc59cb0727b3
5
5
  SHA512:
6
- metadata.gz: db667c8dc612dd9f66c20e74cef3488b205fe3fa7c5715993667baedf0694a5fc9bb0d2c68dc3ce9fc308531c34f2a09b584a97103198199136c330cbcd36d7d
7
- data.tar.gz: 57354088005c3641e05791bb3a05665d82d1257bd9dd2ae3cdeca56052a4bfd3ea203ef4a91173a9c31ef695eb05cc53b48e5f4b56c415b6374462421d641086
6
+ metadata.gz: db131c2d66f6f4778110ddc74ec1ddd09255a7613661b16aeba2b77fc35b636ad3f2196a52acee03d3aa2affaa0d41a2cd809233b9d56a6b5206d116fa054ad6
7
+ data.tar.gz: e7bf261fc7906ba379ce7d26641dcb9e13b03fe34331b21619a47309e50c844a2a8a598a680df4cefd4d6a6c0ab57955b4d475dc0a2a031cf46dbf7f2caf55a9
@@ -131,6 +131,35 @@ a.FootnoteRef + a.FootnoteRef:before {
131
131
  color: red;
132
132
  text-decoration: line-through; }
133
133
 
134
+ /* code highlighting with line numbers */
135
+ table.rouge-line-table td.rouge-gutter {
136
+ -moz-user-select: none;
137
+ -ms-user-select: none;
138
+ -webkit-user-select: none;
139
+ user-select: none;
140
+ padding-right: 1em; }
141
+
142
+ table.rouge-line-table td.rouge-code {
143
+ -moz-user-select: all;
144
+ -ms-user-select: all;
145
+ -webkit-user-select: all;
146
+ user-select: all; }
147
+
148
+ table.rouge-line-table,
149
+ table.rouge-line-table th,
150
+ table.rouge-line-table td {
151
+ width: auto;
152
+ border: none;
153
+ margin: 0;
154
+ padding: 0;
155
+ font-size: 100%; }
156
+
157
+ table.rouge-line-table pre {
158
+ margin: 0;
159
+ padding: 0;
160
+ overflow-x: visible;
161
+ font-size: 100%; }
162
+
134
163
  #standard-band {
135
164
  background-color: #0AC442; }
136
165
 
@@ -894,7 +923,7 @@ table {
894
923
  table th, table td {
895
924
  padding: 1em; }
896
925
  table td.header {
897
- font-weigth: 400; }
926
+ font-weight: 400; }
898
927
 
899
928
  td,
900
929
  th {
@@ -3,7 +3,7 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <!-- mandatory 'key' -->
6
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
6
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
7
7
 
8
8
  <!-- mandatory variable -->
9
9
 
@@ -2080,7 +2080,7 @@
2080
2080
  </fn>
2081
2081
  -->
2082
2082
 
2083
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" mode="flatxml">
2083
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="flatxml">
2084
2084
  <xsl:variable name="p_fn_">
2085
2085
  <xsl:call-template name="get_fn_list"/>
2086
2086
  </xsl:variable>
@@ -2643,7 +2643,7 @@
2643
2643
  </xsl:choose>
2644
2644
  </xsl:template>
2645
2645
 
2646
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="3">
2646
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="3">
2647
2647
  <xsl:call-template name="fn"/>
2648
2648
  </xsl:template>
2649
2649
 
@@ -3797,14 +3797,14 @@
3797
3797
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
3798
3798
 
3799
3799
  <!--
3800
- <misc-container>
3800
+ <metanorma-extension>
3801
3801
  <presentation-metadata>
3802
3802
  <papersize>letter</papersize>
3803
3803
  </presentation-metadata>
3804
- </misc-container>
3804
+ </metanorma-extension>
3805
3805
  -->
3806
3806
 
3807
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3807
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3808
3808
  <xsl:variable name="papersize_width_">
3809
3809
  <xsl:choose>
3810
3810
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -3921,7 +3921,7 @@
3921
3921
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
3922
3922
 
3923
3923
  <xsl:variable name="title-list-tables">
3924
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
3924
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
3925
3925
  <xsl:value-of select="$toc_table_title"/>
3926
3926
  <xsl:if test="normalize-space($toc_table_title) = ''">
3927
3927
  <xsl:call-template name="getTitle">
@@ -3931,7 +3931,7 @@
3931
3931
  </xsl:variable>
3932
3932
 
3933
3933
  <xsl:variable name="title-list-figures">
3934
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
3934
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
3935
3935
  <xsl:value-of select="$toc_figure_title"/>
3936
3936
  <xsl:if test="normalize-space($toc_figure_title) = ''">
3937
3937
  <xsl:call-template name="getTitle">
@@ -3941,7 +3941,7 @@
3941
3941
  </xsl:variable>
3942
3942
 
3943
3943
  <xsl:variable name="title-list-recommendations">
3944
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
3944
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
3945
3945
  <xsl:value-of select="$toc_requirement_title"/>
3946
3946
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
3947
3947
  <xsl:call-template name="getTitle">
@@ -4013,7 +4013,7 @@
4013
4013
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
4014
4014
 
4015
4015
  <xsl:variable name="additional_fonts_">
4016
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4016
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4017
4017
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
4018
4018
  </xsl:for-each>
4019
4019
  </xsl:variable>
@@ -5092,10 +5092,10 @@
5092
5092
 
5093
5093
  <xsl:template name="processTablesFigures_Contents">
5094
5094
  <xsl:param name="always"/>
5095
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5095
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5096
5096
  <xsl:call-template name="processTables_Contents"/>
5097
5097
  </xsl:if>
5098
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5098
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5099
5099
  <xsl:call-template name="processFigures_Contents"/>
5100
5100
  </xsl:if>
5101
5101
  </xsl:template>
@@ -5444,6 +5444,8 @@
5444
5444
  <xsl:attribute name="border">none</xsl:attribute>
5445
5445
  </xsl:if>
5446
5446
 
5447
+ <xsl:call-template name="setBordersTableArray"/>
5448
+
5447
5449
  </xsl:element>
5448
5450
  </xsl:variable>
5449
5451
 
@@ -5568,6 +5570,10 @@
5568
5570
 
5569
5571
  </xsl:template>
5570
5572
 
5573
+ <xsl:template name="setBordersTableArray">
5574
+
5575
+ </xsl:template>
5576
+
5571
5577
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5572
5578
  <xsl:param name="continued"/>
5573
5579
  <xsl:if test="normalize-space() != ''">
@@ -6050,6 +6056,8 @@
6050
6056
  <fo:table-row>
6051
6057
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6052
6058
 
6059
+ <xsl:call-template name="setBordersTableArray"/>
6060
+
6053
6061
  <!-- fn will be processed inside 'note' processing -->
6054
6062
 
6055
6063
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -6213,6 +6221,8 @@
6213
6221
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6214
6222
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6215
6223
 
6224
+ <xsl:call-template name="setBordersTableArray"/>
6225
+
6216
6226
  <xsl:if test="position() = last()">
6217
6227
  <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6218
6228
  </xsl:if>
@@ -6247,6 +6257,8 @@
6247
6257
  <xsl:attribute name="min-height">0mm</xsl:attribute>
6248
6258
  </xsl:if>
6249
6259
 
6260
+ <xsl:call-template name="setBordersTableArray"/>
6261
+
6250
6262
  <xsl:call-template name="setTableRowAttributes"/>
6251
6263
  <xsl:apply-templates/>
6252
6264
  </fo:table-row>
@@ -6266,6 +6278,8 @@
6266
6278
  <xsl:with-param name="default">center</xsl:with-param>
6267
6279
  </xsl:call-template>
6268
6280
 
6281
+ <xsl:call-template name="setBordersTableArray"/>
6282
+
6269
6283
  <xsl:if test="$lang = 'ar'">
6270
6284
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6271
6285
  </xsl:if>
@@ -6325,6 +6339,8 @@
6325
6339
  <xsl:attribute name="border">none</xsl:attribute>
6326
6340
  </xsl:if>
6327
6341
 
6342
+ <xsl:call-template name="setBordersTableArray"/>
6343
+
6328
6344
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6329
6345
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6330
6346
  </xsl:if>
@@ -6379,7 +6395,7 @@
6379
6395
  </fn>
6380
6396
  -->
6381
6397
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6382
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
6398
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
6383
6399
 
6384
6400
  <!-- list of footnotes to calculate actual footnotes number -->
6385
6401
  <xsl:variable name="p_fn_">
@@ -6436,8 +6452,7 @@
6436
6452
  </fo:basic-link>
6437
6453
  </fo:inline>
6438
6454
  </xsl:variable>
6439
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6440
- gen_id=<xsl:value-of select="$gen_id"/> -->
6455
+
6441
6456
  <xsl:choose>
6442
6457
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6443
6458
  <xsl:copy-of select="$footnote_inline"/>
@@ -6501,7 +6516,7 @@
6501
6516
  <!-- commented:
6502
6517
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6503
6518
  because 'fn' there is in biblio-tag -->
6504
- <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6519
+ <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6505
6520
  <!-- copy unique fn -->
6506
6521
  <fn gen_id="{generate-id(.)}">
6507
6522
  <xsl:copy-of select="@*"/>
@@ -9057,7 +9072,9 @@
9057
9072
 
9058
9073
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9059
9074
  <xsl:if test="number($scale) &lt; 100">
9060
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9075
+
9076
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9077
+
9061
9078
  </xsl:if>
9062
9079
 
9063
9080
  </xsl:if>
@@ -9988,7 +10005,7 @@
9988
10005
  <!-- sourcecode -->
9989
10006
  <!-- =============== -->
9990
10007
 
9991
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10008
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
9992
10009
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
9993
10010
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
9994
10011
 
@@ -10075,6 +10092,12 @@
10075
10092
  </xsl:attribute>
10076
10093
  </xsl:for-each>
10077
10094
 
10095
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
10096
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10097
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10098
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10099
+ </xsl:if>
10100
+
10078
10101
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10079
10102
  </fo:block>
10080
10103
 
@@ -10123,7 +10146,7 @@
10123
10146
  </xsl:template>
10124
10147
 
10125
10148
  <!-- outer table with line numbers for sourcecode -->
10126
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10149
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
10127
10150
  <fo:block>
10128
10151
  <fo:table width="100%" table-layout="fixed">
10129
10152
  <xsl:copy-of select="@id"/>
@@ -10135,16 +10158,16 @@
10135
10158
  </fo:table>
10136
10159
  </fo:block>
10137
10160
  </xsl:template>
10138
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10161
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
10139
10162
  <xsl:apply-templates/>
10140
10163
  </xsl:template>
10141
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10164
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
10142
10165
  <fo:table-row>
10143
10166
  <xsl:apply-templates/>
10144
10167
  </fo:table-row>
10145
10168
  </xsl:template>
10146
10169
  <!-- first td with line numbers -->
10147
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10170
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10148
10171
  <fo:table-cell>
10149
10172
  <fo:block>
10150
10173
 
@@ -10164,8 +10187,9 @@
10164
10187
  </fo:block>
10165
10188
  </fo:table-cell>
10166
10189
  </xsl:template>
10190
+
10167
10191
  <!-- second td with sourcecode -->
10168
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10192
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10169
10193
  <fo:table-cell>
10170
10194
  <fo:block>
10171
10195
  <xsl:apply-templates/>
@@ -10403,7 +10427,25 @@
10403
10427
  <xsl:template match="*[local-name()='pre']" name="pre">
10404
10428
  <fo:block xsl:use-attribute-sets="pre-style">
10405
10429
  <xsl:copy-of select="@id"/>
10406
- <xsl:apply-templates/>
10430
+ <xsl:choose>
10431
+
10432
+ <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
10433
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
10434
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10435
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10436
+ </xsl:if>
10437
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
10438
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
10439
+ <mtext><xsl:value-of select="."/></mtext>
10440
+ </math>
10441
+ </fo:instream-foreign-object>
10442
+ </xsl:when>
10443
+
10444
+ <xsl:otherwise>
10445
+ <xsl:apply-templates/>
10446
+ </xsl:otherwise>
10447
+
10448
+ </xsl:choose>
10407
10449
  </fo:block>
10408
10450
  </xsl:template>
10409
10451
  <!-- =============== -->
@@ -12040,8 +12082,8 @@
12040
12082
 
12041
12083
  <xsl:variable name="toc_level">
12042
12084
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
12043
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12044
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12085
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12086
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12045
12087
  <xsl:choose>
12046
12088
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
12047
12089
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -13169,6 +13211,7 @@
13169
13211
  <xsl:choose>
13170
13212
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
13171
13213
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
13214
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
13172
13215
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
13173
13216
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
13174
13217
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -3,7 +3,7 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <!-- mandatory 'key' -->
6
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
6
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
7
7
 
8
8
  <!-- mandatory variable -->
9
9
 
@@ -2080,7 +2080,7 @@
2080
2080
  </fn>
2081
2081
  -->
2082
2082
 
2083
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" mode="flatxml">
2083
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="flatxml">
2084
2084
  <xsl:variable name="p_fn_">
2085
2085
  <xsl:call-template name="get_fn_list"/>
2086
2086
  </xsl:variable>
@@ -2643,7 +2643,7 @@
2643
2643
  </xsl:choose>
2644
2644
  </xsl:template>
2645
2645
 
2646
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="3">
2646
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="3">
2647
2647
  <xsl:call-template name="fn"/>
2648
2648
  </xsl:template>
2649
2649
 
@@ -3797,14 +3797,14 @@
3797
3797
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
3798
3798
 
3799
3799
  <!--
3800
- <misc-container>
3800
+ <metanorma-extension>
3801
3801
  <presentation-metadata>
3802
3802
  <papersize>letter</papersize>
3803
3803
  </presentation-metadata>
3804
- </misc-container>
3804
+ </metanorma-extension>
3805
3805
  -->
3806
3806
 
3807
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3807
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3808
3808
  <xsl:variable name="papersize_width_">
3809
3809
  <xsl:choose>
3810
3810
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -3921,7 +3921,7 @@
3921
3921
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
3922
3922
 
3923
3923
  <xsl:variable name="title-list-tables">
3924
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
3924
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
3925
3925
  <xsl:value-of select="$toc_table_title"/>
3926
3926
  <xsl:if test="normalize-space($toc_table_title) = ''">
3927
3927
  <xsl:call-template name="getTitle">
@@ -3931,7 +3931,7 @@
3931
3931
  </xsl:variable>
3932
3932
 
3933
3933
  <xsl:variable name="title-list-figures">
3934
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
3934
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
3935
3935
  <xsl:value-of select="$toc_figure_title"/>
3936
3936
  <xsl:if test="normalize-space($toc_figure_title) = ''">
3937
3937
  <xsl:call-template name="getTitle">
@@ -3941,7 +3941,7 @@
3941
3941
  </xsl:variable>
3942
3942
 
3943
3943
  <xsl:variable name="title-list-recommendations">
3944
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
3944
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
3945
3945
  <xsl:value-of select="$toc_requirement_title"/>
3946
3946
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
3947
3947
  <xsl:call-template name="getTitle">
@@ -4013,7 +4013,7 @@
4013
4013
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
4014
4014
 
4015
4015
  <xsl:variable name="additional_fonts_">
4016
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4016
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4017
4017
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
4018
4018
  </xsl:for-each>
4019
4019
  </xsl:variable>
@@ -5092,10 +5092,10 @@
5092
5092
 
5093
5093
  <xsl:template name="processTablesFigures_Contents">
5094
5094
  <xsl:param name="always"/>
5095
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5095
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5096
5096
  <xsl:call-template name="processTables_Contents"/>
5097
5097
  </xsl:if>
5098
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5098
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5099
5099
  <xsl:call-template name="processFigures_Contents"/>
5100
5100
  </xsl:if>
5101
5101
  </xsl:template>
@@ -5444,6 +5444,8 @@
5444
5444
  <xsl:attribute name="border">none</xsl:attribute>
5445
5445
  </xsl:if>
5446
5446
 
5447
+ <xsl:call-template name="setBordersTableArray"/>
5448
+
5447
5449
  </xsl:element>
5448
5450
  </xsl:variable>
5449
5451
 
@@ -5568,6 +5570,10 @@
5568
5570
 
5569
5571
  </xsl:template>
5570
5572
 
5573
+ <xsl:template name="setBordersTableArray">
5574
+
5575
+ </xsl:template>
5576
+
5571
5577
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5572
5578
  <xsl:param name="continued"/>
5573
5579
  <xsl:if test="normalize-space() != ''">
@@ -6050,6 +6056,8 @@
6050
6056
  <fo:table-row>
6051
6057
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6052
6058
 
6059
+ <xsl:call-template name="setBordersTableArray"/>
6060
+
6053
6061
  <!-- fn will be processed inside 'note' processing -->
6054
6062
 
6055
6063
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -6213,6 +6221,8 @@
6213
6221
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6214
6222
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6215
6223
 
6224
+ <xsl:call-template name="setBordersTableArray"/>
6225
+
6216
6226
  <xsl:if test="position() = last()">
6217
6227
  <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6218
6228
  </xsl:if>
@@ -6247,6 +6257,8 @@
6247
6257
  <xsl:attribute name="min-height">0mm</xsl:attribute>
6248
6258
  </xsl:if>
6249
6259
 
6260
+ <xsl:call-template name="setBordersTableArray"/>
6261
+
6250
6262
  <xsl:call-template name="setTableRowAttributes"/>
6251
6263
  <xsl:apply-templates/>
6252
6264
  </fo:table-row>
@@ -6266,6 +6278,8 @@
6266
6278
  <xsl:with-param name="default">center</xsl:with-param>
6267
6279
  </xsl:call-template>
6268
6280
 
6281
+ <xsl:call-template name="setBordersTableArray"/>
6282
+
6269
6283
  <xsl:if test="$lang = 'ar'">
6270
6284
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6271
6285
  </xsl:if>
@@ -6325,6 +6339,8 @@
6325
6339
  <xsl:attribute name="border">none</xsl:attribute>
6326
6340
  </xsl:if>
6327
6341
 
6342
+ <xsl:call-template name="setBordersTableArray"/>
6343
+
6328
6344
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6329
6345
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6330
6346
  </xsl:if>
@@ -6379,7 +6395,7 @@
6379
6395
  </fn>
6380
6396
  -->
6381
6397
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6382
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
6398
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
6383
6399
 
6384
6400
  <!-- list of footnotes to calculate actual footnotes number -->
6385
6401
  <xsl:variable name="p_fn_">
@@ -6436,8 +6452,7 @@
6436
6452
  </fo:basic-link>
6437
6453
  </fo:inline>
6438
6454
  </xsl:variable>
6439
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6440
- gen_id=<xsl:value-of select="$gen_id"/> -->
6455
+
6441
6456
  <xsl:choose>
6442
6457
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6443
6458
  <xsl:copy-of select="$footnote_inline"/>
@@ -6501,7 +6516,7 @@
6501
6516
  <!-- commented:
6502
6517
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6503
6518
  because 'fn' there is in biblio-tag -->
6504
- <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6519
+ <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6505
6520
  <!-- copy unique fn -->
6506
6521
  <fn gen_id="{generate-id(.)}">
6507
6522
  <xsl:copy-of select="@*"/>
@@ -9057,7 +9072,9 @@
9057
9072
 
9058
9073
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9059
9074
  <xsl:if test="number($scale) &lt; 100">
9060
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9075
+
9076
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9077
+
9061
9078
  </xsl:if>
9062
9079
 
9063
9080
  </xsl:if>
@@ -9988,7 +10005,7 @@
9988
10005
  <!-- sourcecode -->
9989
10006
  <!-- =============== -->
9990
10007
 
9991
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10008
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
9992
10009
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
9993
10010
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
9994
10011
 
@@ -10075,6 +10092,12 @@
10075
10092
  </xsl:attribute>
10076
10093
  </xsl:for-each>
10077
10094
 
10095
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
10096
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10097
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10098
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10099
+ </xsl:if>
10100
+
10078
10101
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10079
10102
  </fo:block>
10080
10103
 
@@ -10123,7 +10146,7 @@
10123
10146
  </xsl:template>
10124
10147
 
10125
10148
  <!-- outer table with line numbers for sourcecode -->
10126
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10149
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
10127
10150
  <fo:block>
10128
10151
  <fo:table width="100%" table-layout="fixed">
10129
10152
  <xsl:copy-of select="@id"/>
@@ -10135,16 +10158,16 @@
10135
10158
  </fo:table>
10136
10159
  </fo:block>
10137
10160
  </xsl:template>
10138
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10161
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
10139
10162
  <xsl:apply-templates/>
10140
10163
  </xsl:template>
10141
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10164
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
10142
10165
  <fo:table-row>
10143
10166
  <xsl:apply-templates/>
10144
10167
  </fo:table-row>
10145
10168
  </xsl:template>
10146
10169
  <!-- first td with line numbers -->
10147
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10170
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10148
10171
  <fo:table-cell>
10149
10172
  <fo:block>
10150
10173
 
@@ -10164,8 +10187,9 @@
10164
10187
  </fo:block>
10165
10188
  </fo:table-cell>
10166
10189
  </xsl:template>
10190
+
10167
10191
  <!-- second td with sourcecode -->
10168
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10192
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10169
10193
  <fo:table-cell>
10170
10194
  <fo:block>
10171
10195
  <xsl:apply-templates/>
@@ -10403,7 +10427,25 @@
10403
10427
  <xsl:template match="*[local-name()='pre']" name="pre">
10404
10428
  <fo:block xsl:use-attribute-sets="pre-style">
10405
10429
  <xsl:copy-of select="@id"/>
10406
- <xsl:apply-templates/>
10430
+ <xsl:choose>
10431
+
10432
+ <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
10433
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
10434
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10435
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10436
+ </xsl:if>
10437
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
10438
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
10439
+ <mtext><xsl:value-of select="."/></mtext>
10440
+ </math>
10441
+ </fo:instream-foreign-object>
10442
+ </xsl:when>
10443
+
10444
+ <xsl:otherwise>
10445
+ <xsl:apply-templates/>
10446
+ </xsl:otherwise>
10447
+
10448
+ </xsl:choose>
10407
10449
  </fo:block>
10408
10450
  </xsl:template>
10409
10451
  <!-- =============== -->
@@ -12040,8 +12082,8 @@
12040
12082
 
12041
12083
  <xsl:variable name="toc_level">
12042
12084
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
12043
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12044
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12085
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12086
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12045
12087
  <xsl:choose>
12046
12088
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
12047
12089
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -13169,6 +13211,7 @@
13169
13211
  <xsl:choose>
13170
13212
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
13171
13213
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
13214
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
13172
13215
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
13173
13216
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
13174
13217
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -51,9 +51,9 @@ module IsoDoc
51
51
  def bibrender_relaton(xml, renderings)
52
52
  f = renderings[xml["id"]][:formattedref]
53
53
  f &&= "<formattedref>#{f}</formattedref>"
54
+ keep = "./docidentifier | ./uri | ./note | ./title | ./biblio-tag"
54
55
  xml.children =
55
- "#{f}#{xml.xpath(ns('./docidentifier | ./uri | ./note | ./title'))
56
- .to_xml}"
56
+ "#{f}#{xml.xpath(ns(keep)).to_xml}"
57
57
  @author[xml["id"]] = renderings[xml["id"]][:author]
58
58
  end
59
59
 
@@ -1316,7 +1316,7 @@
1316
1316
  <value>commentaryOf</value>
1317
1317
  <value>hasCommentary</value>
1318
1318
  <value>related</value>
1319
- <value>complements</value>
1319
+ <value>hasComplement</value>
1320
1320
  <value>complementOf</value>
1321
1321
  <value>obsoletes</value>
1322
1322
  <value>obsoletedBy</value>
@@ -2,8 +2,8 @@ module Metanorma
2
2
  module IEEE
3
3
  class Converter < Standoc::Converter
4
4
  BIBLIO =
5
- "//bibliography/references[@normative = 'false'][not(@hidden)] | "\
6
- "//bibliography/clause[.//references[@normative = 'false']] | "\
5
+ "//bibliography/references[@normative = 'false'][not(@hidden)] | " \
6
+ "//bibliography/clause[.//references[@normative = 'false']] | " \
7
7
  "//annex//references[@normative = 'false'][not(@hidden)]".freeze
8
8
 
9
9
  def boilerplate_cleanup(xmldoc)
@@ -21,39 +21,43 @@ module Metanorma
21
21
  end
22
22
 
23
23
  def sort_biblio(bib)
24
+ @c = HTMLEntities.new
25
+ @i = IsoDoc::IEEE::PresentationXMLConvert
26
+ .new({ lang: @lang, script: @script, locale: @locale })
27
+ @i.i18n_init(@lang, @script, @locale)
24
28
  bib.sort do |a, b|
25
29
  sort_biblio_key(a) <=> sort_biblio_key(b)
26
30
  end
27
31
  end
28
32
 
29
- OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
30
- "@type = 'ISBN'".freeze
31
-
32
33
  # Alphabetic by rendering: author surname or designation, followed by title
33
34
  def sort_biblio_key(bib)
34
35
  name = designator_or_name(bib)
35
36
  title = bib.at("./title[@type = 'main']")&.text ||
36
37
  bib.at("./title")&.text || bib.at("./formattedref")&.text
37
38
  title.gsub!(/[[:punct:]]/, "")
38
- "#{name}. #{title}"
39
+ @c.decode("#{name} #{title}").strip.downcase
39
40
  end
40
41
 
41
42
  def designator_or_name(bib)
42
43
  case bib["type"]
43
- when "standard", "techreport"
44
- n = bib.at("./docidentifier[@primary]") ||
45
- bib.at("./docidentifier[not(#{OTHERIDS})]")
46
- n&.text || "ZZZZ"
44
+ when "standard", "techreport" then designator_docid(bib)
47
45
  else
48
46
  bib1 = bib.dup
49
47
  bib1.add_namespace(nil, self.class::XML_NAMESPACE)
50
- i = IsoDoc::IEEE::PresentationXMLConvert
51
- .new({ lang: @lang, script: @script, locale: @locale })
52
- i.i18n_init(@lang, @script, @locale)
53
- i.creatornames(bib1)
48
+ n = @i.creatornames(bib1)
49
+ n.nil? && bib["type"].nil? and n = designator_docid(bib)
50
+ n
54
51
  end
55
52
  end
56
53
 
54
+ def designator_docid(bib)
55
+ n = bib.at("./docidentifier[@primary]") ||
56
+ bib.at("./docidentifier[not(#{skip_docid})]")
57
+ n or return "ZZZZ"
58
+ @isodoc.docid_prefix(n["type"], n.children.to_xml)
59
+ end
60
+
57
61
  def normref_cleanup(xmldoc)
58
62
  super
59
63
  normref_reorder(xmldoc)
@@ -93,7 +97,7 @@ module Metanorma
93
97
 
94
98
  def biblio_renumber(xmldoc)
95
99
  i = 0
96
- xmldoc.xpath("//references[not(@normative = 'true')]"\
100
+ xmldoc.xpath("//references[not(@normative = 'true')]" \
97
101
  "[not(@hidden = 'true')]").each do |r|
98
102
  r.xpath("./bibitem[not(@hidden = 'true')]").each do |b|
99
103
  i += 1
@@ -103,7 +107,7 @@ module Metanorma
103
107
  end
104
108
 
105
109
  def biblio_renumber1(bib, idx)
106
- docid = bib.at("./docidentifier[@type = 'metanorma' or "\
110
+ docid = bib.at("./docidentifier[@type = 'metanorma' or " \
107
111
  "@type = 'metanorma-ordinal']")
108
112
  if /^\[?\d+\]?$/.match?(docid&.text)
109
113
  docid.children = "[B#{idx}]"
@@ -1580,7 +1580,7 @@
1580
1580
  </element>
1581
1581
  </define>
1582
1582
  <define name="misccontainer">
1583
- <element name="misc-container">
1583
+ <element name="metanorma-extension">
1584
1584
  <oneOrMore>
1585
1585
  <ref name="AnyElement"/>
1586
1586
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.0.2".freeze
3
+ VERSION = "1.0.4".freeze
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ extenttemplate:
9
9
  misc: "{{ volume }}, {{issue}}, {{ page }}, {{ duration }}"
10
10
  template:
11
11
  # skip authoritative_identifier, it is inserted in front of formattedref within metanorma
12
- standard: "{{ title }}."
12
+ standard: "{% if home_standard %}{{ title }}.{% else %}{{ creatornames }}, “{{ title }},” {{ extent }}, {{ labels['version'] }}_{{ edition_raw }}, {{date}}, {{labels['updated'] | capitalize }}_{{date_updated}}, {{status }}, {{ authorizer }}, {{ uri }} .{% endif %}"
13
13
  article: "{{creatornames}}, “{{title}},” <em>{{ series }}</em>, {{ extent }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
14
14
  book: "{{creatornames}}, <em>{{title}}</em>, {{ edition }}, {{place}}: {{publisher}}, {{date}}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
15
15
  techreport: book
@@ -1,4 +1,5 @@
1
1
  require "relaton-render"
2
+ require_relative "parse"
2
3
 
3
4
  module Relaton
4
5
  module Render
@@ -7,6 +8,11 @@ module Relaton
7
8
  def config_loc
8
9
  YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
9
10
  end
11
+
12
+ def klass_initialize(_options)
13
+ super
14
+ @parseklass = Relaton::Render::IEEE::Parse
15
+ end
10
16
  end
11
17
  end
12
18
  end
@@ -0,0 +1,21 @@
1
+ module Relaton
2
+ module Render
3
+ module IEEE
4
+ class Parse < ::Relaton::Render::Parse
5
+ def simple_or_host_xml2hash(doc, host)
6
+ ret = super
7
+ ret.merge(home_standard: home_standard(doc, ret[:publisher_raw]))
8
+ end
9
+
10
+ def home_standard(_doc, pubs)
11
+ pubs&.any? do |r|
12
+ ["International Organization for Standardization", "ISO",
13
+ "International Electrotechnical Commission", "IEC",
14
+ "Institute of Electrical and Electronics Engineers",
15
+ "IEEE"].include?(r[:nonpersonal])
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ 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.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2023-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -279,6 +279,7 @@ files:
279
279
  - lib/metanorma/ieee/version.rb
280
280
  - lib/relaton/render/config.yml
281
281
  - lib/relaton/render/general.rb
282
+ - lib/relaton/render/parse.rb
282
283
  - metanorma-ieee.gemspec
283
284
  homepage: https://github.com/metanorma/metanorma-ieee
284
285
  licenses: