metanorma-iho 0.6.10 → 0.6.12

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: 88630b7ecf636f3705ff06b6b7f313efb5fd3b622e85a2735b82659d170e8b6b
4
- data.tar.gz: e6b48482db3da8d4ceb13e3b8402a8d0004d3dfb1a392cc916eefbe0e5a8afa0
3
+ metadata.gz: 769a2b34f9a1bff86b6249fc1b32a9f47c54c3ce6098ed0eb2d0cdf8c4d8f5ee
4
+ data.tar.gz: 7523b2410d9fc205d2747980d02ba388f547f9f2d17ca9ca9043fc671c9c3b24
5
5
  SHA512:
6
- metadata.gz: e15ca9e2d633cbd4e2b451edf2c5358d59e0ba25902d18683ab76381bf97956da513a8df4219c167ae9a5a79972218829cd526c52c06c1d161488a193f191aad
7
- data.tar.gz: 1b1b6f84b78af8db1cb2b195feacfdb53a6a47d1d7be212b015be60f34e664f3a57717c3a1a7c3a65209a5a861396bb0abf7aa9d7acff33a82f6515b68cf95d0
6
+ metadata.gz: 2c1c9fe715119c315a023160e57c74466fff4a5903b1d544ee53ee5a778cf914c409d054569f69635196d6719c2d504a5f47825e1ef285a9113a89c10bda98af
7
+ data.tar.gz: 6b2e599718ff877827a0e564d353c92a56e7e6df441ea8b7f54afd28f5cf518a64396a75b3964e232497dca51c5619bd766057bc95378a5c419fafc2cabb8f9d
@@ -395,7 +395,7 @@ div.figure {
395
395
  font-weight: 700;
396
396
  font-size: 1em;
397
397
  text-align: center; }
398
- div.figure > img {
398
+ div.figure > img, div.figure > svg {
399
399
  margin-left: auto;
400
400
  margin-right: auto;
401
401
  display: block;
@@ -1170,6 +1170,15 @@
1170
1170
 
1171
1171
  </xsl:attribute-set>
1172
1172
 
1173
+ <xsl:attribute-set name="pre-style">
1174
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1175
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1176
+
1177
+ <xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1178
+ <xsl:attribute name="line-height">113%</xsl:attribute>
1179
+
1180
+ </xsl:attribute-set>
1181
+
1173
1182
  <xsl:attribute-set name="permission-style">
1174
1183
 
1175
1184
  </xsl:attribute-set>
@@ -1281,6 +1290,11 @@
1281
1290
  </xsl:variable>
1282
1291
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1283
1292
 
1293
+ <xsl:variable name="table-cell-border_">
1294
+
1295
+ </xsl:variable>
1296
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1297
+
1284
1298
  <xsl:attribute-set name="table-container-style">
1285
1299
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1286
1300
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1292,8 +1306,6 @@
1292
1306
  <xsl:attribute-set name="table-style">
1293
1307
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1294
1308
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1295
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1296
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1297
1309
 
1298
1310
  </xsl:attribute-set><!-- table-style -->
1299
1311
 
@@ -2405,6 +2417,12 @@
2405
2417
  <xsl:variable name="table_attributes">
2406
2418
 
2407
2419
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2420
+
2421
+ <xsl:if test="$margin-side != 0">
2422
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2423
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2424
+ </xsl:if>
2425
+
2408
2426
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2409
2427
 
2410
2428
  </xsl:element>
@@ -3161,6 +3179,10 @@
3161
3179
  <xsl:template match="*[local-name()='tr']">
3162
3180
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3163
3181
 
3182
+ <xsl:if test="*[local-name() = 'th']">
3183
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3184
+ </xsl:if>
3185
+
3164
3186
  <xsl:call-template name="setTableRowAttributes"/>
3165
3187
  <xsl:apply-templates/>
3166
3188
  </fo:table-row>
@@ -4201,8 +4223,17 @@
4201
4223
  </fo:inline>
4202
4224
  </xsl:template> <!-- tt -->
4203
4225
 
4226
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4204
4227
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4205
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4228
+ <xsl:choose>
4229
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4230
+ <!-- url -->
4231
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4232
+ </xsl:when>
4233
+ <xsl:otherwise>
4234
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4235
+ </xsl:otherwise>
4236
+ </xsl:choose>
4206
4237
  </xsl:template>
4207
4238
 
4208
4239
  <xsl:template match="*[local-name()='underline']">
@@ -4558,8 +4589,11 @@
4558
4589
 
4559
4590
  <xsl:template name="add-zero-spaces-link-java">
4560
4591
  <xsl:param name="text" select="."/>
4592
+
4593
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4594
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4561
4595
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4562
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4596
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4563
4597
  </xsl:template>
4564
4598
 
4565
4599
  <!-- add zero space after dash character (for table's entries) -->
@@ -5116,6 +5150,9 @@
5116
5150
  <xsl:value-of select="substring($str, 2)"/>
5117
5151
  </xsl:template>
5118
5152
 
5153
+ <!-- ======================================= -->
5154
+ <!-- math -->
5155
+ <!-- ======================================= -->
5119
5156
  <xsl:template match="mathml:math">
5120
5157
  <xsl:variable name="isAdded" select="@added"/>
5121
5158
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5166,14 +5203,57 @@
5166
5203
  <xsl:value-of select="$comment_text"/>
5167
5204
  </xsl:template>
5168
5205
 
5206
+ <xsl:template match="*[local-name() = 'asciimath']">
5207
+ <xsl:param name="process" select="'false'"/>
5208
+ <xsl:if test="$process = 'true'">
5209
+ <xsl:apply-templates/>
5210
+ </xsl:if>
5211
+ </xsl:template>
5212
+
5213
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5214
+
5215
+ <xsl:template name="getMathml_asciimath_text">
5216
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5217
+ <xsl:variable name="latexmath">
5218
+
5219
+ </xsl:variable>
5220
+ <xsl:variable name="asciimath_text_following">
5221
+ <xsl:choose>
5222
+ <xsl:when test="normalize-space($latexmath) != ''">
5223
+ <xsl:value-of select="$latexmath"/>
5224
+ </xsl:when>
5225
+ <xsl:when test="normalize-space($asciimath) != ''">
5226
+ <xsl:value-of select="$asciimath"/>
5227
+ </xsl:when>
5228
+ <xsl:otherwise>
5229
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5230
+ </xsl:otherwise>
5231
+ </xsl:choose>
5232
+ </xsl:variable>
5233
+ <xsl:variable name="asciimath_text_">
5234
+ <xsl:choose>
5235
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5236
+ <xsl:value-of select="$asciimath_text_following"/>
5237
+ </xsl:when>
5238
+ <xsl:otherwise>
5239
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5240
+ </xsl:otherwise>
5241
+ </xsl:choose>
5242
+ </xsl:variable>
5243
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5244
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5245
+ <xsl:value-of select="$asciimath_text"/>
5246
+ </xsl:template>
5247
+
5169
5248
  <xsl:template name="mathml_instream_object">
5170
- <xsl:param name="comment_text"/>
5249
+ <xsl:param name="asciimath_text"/>
5171
5250
  <xsl:param name="mathml_content"/>
5172
5251
 
5173
- <xsl:variable name="comment_text_">
5252
+ <xsl:variable name="asciimath_text_">
5174
5253
  <xsl:choose>
5175
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5176
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5254
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5255
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5256
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5177
5257
  </xsl:choose>
5178
5258
  </xsl:variable>
5179
5259
 
@@ -5190,10 +5270,10 @@
5190
5270
  </xsl:attribute>
5191
5271
 
5192
5272
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5193
- <xsl:if test="normalize-space($comment_text_) != ''">
5273
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5194
5274
  <!-- put Mathin Alternate Text -->
5195
5275
  <xsl:attribute name="fox:alt-text">
5196
- <xsl:value-of select="$comment_text_"/>
5276
+ <xsl:value-of select="$asciimath_text_"/>
5197
5277
  </xsl:attribute>
5198
5278
  </xsl:if>
5199
5279
  <!-- </xsl:if> -->
@@ -5266,6 +5346,29 @@
5266
5346
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5267
5347
  </xsl:template>
5268
5348
 
5349
+ <!-- Examples:
5350
+ <stem type="AsciiMath">x = 1</stem>
5351
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5352
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5353
+ -->
5354
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5355
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5356
+
5357
+ <xsl:choose>
5358
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5359
+ <xsl:otherwise>
5360
+ <xsl:apply-templates>
5361
+ <xsl:with-param name="process">true</xsl:with-param>
5362
+ </xsl:apply-templates>
5363
+ </xsl:otherwise>
5364
+ </xsl:choose>
5365
+
5366
+ </fo:inline>
5367
+ </xsl:template>
5368
+ <!-- ======================================= -->
5369
+ <!-- END: math -->
5370
+ <!-- ======================================= -->
5371
+
5269
5372
  <xsl:template match="*[local-name()='localityStack']"/>
5270
5373
 
5271
5374
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6606,9 +6709,9 @@
6606
6709
  <xsl:apply-templates mode="contents_item"/>
6607
6710
  </xsl:template>
6608
6711
 
6609
- <!-- ====== -->
6610
- <!-- sourcecode -->
6611
- <!-- ====== -->
6712
+ <!-- =============== -->
6713
+ <!-- sourcecode -->
6714
+ <!-- =============== -->
6612
6715
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6613
6716
 
6614
6717
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -6906,8 +7009,22 @@
6906
7009
  </fo:block>
6907
7010
  </xsl:if>
6908
7011
  </xsl:template>
6909
- <!-- ====== -->
6910
- <!-- ====== -->
7012
+ <!-- =============== -->
7013
+ <!-- END sourcecode -->
7014
+ <!-- =============== -->
7015
+
7016
+ <!-- =============== -->
7017
+ <!-- pre -->
7018
+ <!-- =============== -->
7019
+ <xsl:template match="*[local-name()='pre']" name="pre">
7020
+ <fo:block xsl:use-attribute-sets="pre-style">
7021
+ <xsl:copy-of select="@id"/>
7022
+ <xsl:apply-templates/>
7023
+ </fo:block>
7024
+ </xsl:template>
7025
+ <!-- =============== -->
7026
+ <!-- pre -->
7027
+ <!-- =============== -->
6911
7028
 
6912
7029
  <!-- ========== -->
6913
7030
  <!-- permission -->
@@ -8943,7 +9060,7 @@
8943
9060
 
8944
9061
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8945
9062
 
8946
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9063
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8947
9064
 
8948
9065
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8949
9066
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9419,13 +9536,14 @@
9419
9536
  </xsl:template>
9420
9537
 
9421
9538
  <xsl:template name="setId">
9539
+ <xsl:param name="prefix"/>
9422
9540
  <xsl:attribute name="id">
9423
9541
  <xsl:choose>
9424
9542
  <xsl:when test="@id">
9425
- <xsl:value-of select="@id"/>
9543
+ <xsl:value-of select="concat($prefix, @id)"/>
9426
9544
  </xsl:when>
9427
9545
  <xsl:otherwise>
9428
- <xsl:value-of select="generate-id()"/>
9546
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9429
9547
  </xsl:otherwise>
9430
9548
  </xsl:choose>
9431
9549
  </xsl:attribute>
@@ -1170,6 +1170,15 @@
1170
1170
 
1171
1171
  </xsl:attribute-set>
1172
1172
 
1173
+ <xsl:attribute-set name="pre-style">
1174
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1175
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1176
+
1177
+ <xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1178
+ <xsl:attribute name="line-height">113%</xsl:attribute>
1179
+
1180
+ </xsl:attribute-set>
1181
+
1173
1182
  <xsl:attribute-set name="permission-style">
1174
1183
 
1175
1184
  </xsl:attribute-set>
@@ -1281,6 +1290,11 @@
1281
1290
  </xsl:variable>
1282
1291
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1283
1292
 
1293
+ <xsl:variable name="table-cell-border_">
1294
+
1295
+ </xsl:variable>
1296
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1297
+
1284
1298
  <xsl:attribute-set name="table-container-style">
1285
1299
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1286
1300
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1292,8 +1306,6 @@
1292
1306
  <xsl:attribute-set name="table-style">
1293
1307
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1294
1308
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1295
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1296
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1297
1309
 
1298
1310
  </xsl:attribute-set><!-- table-style -->
1299
1311
 
@@ -2405,6 +2417,12 @@
2405
2417
  <xsl:variable name="table_attributes">
2406
2418
 
2407
2419
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2420
+
2421
+ <xsl:if test="$margin-side != 0">
2422
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2423
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2424
+ </xsl:if>
2425
+
2408
2426
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2409
2427
 
2410
2428
  </xsl:element>
@@ -3161,6 +3179,10 @@
3161
3179
  <xsl:template match="*[local-name()='tr']">
3162
3180
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3163
3181
 
3182
+ <xsl:if test="*[local-name() = 'th']">
3183
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3184
+ </xsl:if>
3185
+
3164
3186
  <xsl:call-template name="setTableRowAttributes"/>
3165
3187
  <xsl:apply-templates/>
3166
3188
  </fo:table-row>
@@ -4201,8 +4223,17 @@
4201
4223
  </fo:inline>
4202
4224
  </xsl:template> <!-- tt -->
4203
4225
 
4226
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4204
4227
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4205
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4228
+ <xsl:choose>
4229
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4230
+ <!-- url -->
4231
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4232
+ </xsl:when>
4233
+ <xsl:otherwise>
4234
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4235
+ </xsl:otherwise>
4236
+ </xsl:choose>
4206
4237
  </xsl:template>
4207
4238
 
4208
4239
  <xsl:template match="*[local-name()='underline']">
@@ -4558,8 +4589,11 @@
4558
4589
 
4559
4590
  <xsl:template name="add-zero-spaces-link-java">
4560
4591
  <xsl:param name="text" select="."/>
4592
+
4593
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4594
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4561
4595
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4562
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4596
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4563
4597
  </xsl:template>
4564
4598
 
4565
4599
  <!-- add zero space after dash character (for table's entries) -->
@@ -5116,6 +5150,9 @@
5116
5150
  <xsl:value-of select="substring($str, 2)"/>
5117
5151
  </xsl:template>
5118
5152
 
5153
+ <!-- ======================================= -->
5154
+ <!-- math -->
5155
+ <!-- ======================================= -->
5119
5156
  <xsl:template match="mathml:math">
5120
5157
  <xsl:variable name="isAdded" select="@added"/>
5121
5158
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5166,14 +5203,57 @@
5166
5203
  <xsl:value-of select="$comment_text"/>
5167
5204
  </xsl:template>
5168
5205
 
5206
+ <xsl:template match="*[local-name() = 'asciimath']">
5207
+ <xsl:param name="process" select="'false'"/>
5208
+ <xsl:if test="$process = 'true'">
5209
+ <xsl:apply-templates/>
5210
+ </xsl:if>
5211
+ </xsl:template>
5212
+
5213
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5214
+
5215
+ <xsl:template name="getMathml_asciimath_text">
5216
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5217
+ <xsl:variable name="latexmath">
5218
+
5219
+ </xsl:variable>
5220
+ <xsl:variable name="asciimath_text_following">
5221
+ <xsl:choose>
5222
+ <xsl:when test="normalize-space($latexmath) != ''">
5223
+ <xsl:value-of select="$latexmath"/>
5224
+ </xsl:when>
5225
+ <xsl:when test="normalize-space($asciimath) != ''">
5226
+ <xsl:value-of select="$asciimath"/>
5227
+ </xsl:when>
5228
+ <xsl:otherwise>
5229
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5230
+ </xsl:otherwise>
5231
+ </xsl:choose>
5232
+ </xsl:variable>
5233
+ <xsl:variable name="asciimath_text_">
5234
+ <xsl:choose>
5235
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5236
+ <xsl:value-of select="$asciimath_text_following"/>
5237
+ </xsl:when>
5238
+ <xsl:otherwise>
5239
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5240
+ </xsl:otherwise>
5241
+ </xsl:choose>
5242
+ </xsl:variable>
5243
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5244
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5245
+ <xsl:value-of select="$asciimath_text"/>
5246
+ </xsl:template>
5247
+
5169
5248
  <xsl:template name="mathml_instream_object">
5170
- <xsl:param name="comment_text"/>
5249
+ <xsl:param name="asciimath_text"/>
5171
5250
  <xsl:param name="mathml_content"/>
5172
5251
 
5173
- <xsl:variable name="comment_text_">
5252
+ <xsl:variable name="asciimath_text_">
5174
5253
  <xsl:choose>
5175
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5176
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5254
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5255
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5256
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5177
5257
  </xsl:choose>
5178
5258
  </xsl:variable>
5179
5259
 
@@ -5190,10 +5270,10 @@
5190
5270
  </xsl:attribute>
5191
5271
 
5192
5272
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5193
- <xsl:if test="normalize-space($comment_text_) != ''">
5273
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5194
5274
  <!-- put Mathin Alternate Text -->
5195
5275
  <xsl:attribute name="fox:alt-text">
5196
- <xsl:value-of select="$comment_text_"/>
5276
+ <xsl:value-of select="$asciimath_text_"/>
5197
5277
  </xsl:attribute>
5198
5278
  </xsl:if>
5199
5279
  <!-- </xsl:if> -->
@@ -5266,6 +5346,29 @@
5266
5346
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5267
5347
  </xsl:template>
5268
5348
 
5349
+ <!-- Examples:
5350
+ <stem type="AsciiMath">x = 1</stem>
5351
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5352
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5353
+ -->
5354
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5355
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5356
+
5357
+ <xsl:choose>
5358
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5359
+ <xsl:otherwise>
5360
+ <xsl:apply-templates>
5361
+ <xsl:with-param name="process">true</xsl:with-param>
5362
+ </xsl:apply-templates>
5363
+ </xsl:otherwise>
5364
+ </xsl:choose>
5365
+
5366
+ </fo:inline>
5367
+ </xsl:template>
5368
+ <!-- ======================================= -->
5369
+ <!-- END: math -->
5370
+ <!-- ======================================= -->
5371
+
5269
5372
  <xsl:template match="*[local-name()='localityStack']"/>
5270
5373
 
5271
5374
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6606,9 +6709,9 @@
6606
6709
  <xsl:apply-templates mode="contents_item"/>
6607
6710
  </xsl:template>
6608
6711
 
6609
- <!-- ====== -->
6610
- <!-- sourcecode -->
6611
- <!-- ====== -->
6712
+ <!-- =============== -->
6713
+ <!-- sourcecode -->
6714
+ <!-- =============== -->
6612
6715
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6613
6716
 
6614
6717
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -6906,8 +7009,22 @@
6906
7009
  </fo:block>
6907
7010
  </xsl:if>
6908
7011
  </xsl:template>
6909
- <!-- ====== -->
6910
- <!-- ====== -->
7012
+ <!-- =============== -->
7013
+ <!-- END sourcecode -->
7014
+ <!-- =============== -->
7015
+
7016
+ <!-- =============== -->
7017
+ <!-- pre -->
7018
+ <!-- =============== -->
7019
+ <xsl:template match="*[local-name()='pre']" name="pre">
7020
+ <fo:block xsl:use-attribute-sets="pre-style">
7021
+ <xsl:copy-of select="@id"/>
7022
+ <xsl:apply-templates/>
7023
+ </fo:block>
7024
+ </xsl:template>
7025
+ <!-- =============== -->
7026
+ <!-- pre -->
7027
+ <!-- =============== -->
6911
7028
 
6912
7029
  <!-- ========== -->
6913
7030
  <!-- permission -->
@@ -8943,7 +9060,7 @@
8943
9060
 
8944
9061
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8945
9062
 
8946
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9063
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8947
9064
 
8948
9065
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8949
9066
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9419,13 +9536,14 @@
9419
9536
  </xsl:template>
9420
9537
 
9421
9538
  <xsl:template name="setId">
9539
+ <xsl:param name="prefix"/>
9422
9540
  <xsl:attribute name="id">
9423
9541
  <xsl:choose>
9424
9542
  <xsl:when test="@id">
9425
- <xsl:value-of select="@id"/>
9543
+ <xsl:value-of select="concat($prefix, @id)"/>
9426
9544
  </xsl:when>
9427
9545
  <xsl:otherwise>
9428
- <xsl:value-of select="generate-id()"/>
9546
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9429
9547
  </xsl:otherwise>
9430
9548
  </xsl:choose>
9431
9549
  </xsl:attribute>
@@ -1,10 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <include href="biblio.rng">
4
- <start>
5
- <ref name="document"/>
6
- </start>
7
- </include>
8
3
  <define name="document">
9
4
  <element name="document">
10
5
  <optional>
@@ -1125,26 +1120,4 @@
1125
1120
  </zeroOrMore>
1126
1121
  </element>
1127
1122
  </define>
1128
- <define name="ext">
1129
- <element name="ext">
1130
- <ref name="BibDataExtensionType"/>
1131
- </element>
1132
- </define>
1133
- <define name="BibDataExtensionType">
1134
- <ref name="doctype"/>
1135
- </define>
1136
- <define name="doctype">
1137
- <element name="doctype">
1138
- <ref name="DocumentType"/>
1139
- </element>
1140
- </define>
1141
- <define name="DocumentType">
1142
- <value>document</value>
1143
- </define>
1144
- <define name="BibData">
1145
- <ref name="BibliographicItem"/>
1146
- <optional>
1147
- <ref name="ext"/>
1148
- </optional>
1149
- </define>
1150
1123
  </grammar>