metanorma-ieee 0.1.0 → 0.1.2

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: 18c5077ed8c2107193a9183fd3b3832276f47fa92f60393df76cee4ac0762ab6
4
- data.tar.gz: 2e048a76e6452e79e94b47ab97911cef4e8ead2fe72b8831f43d0d2727ef3ead
3
+ metadata.gz: 6d42117ebe0d96ef2b4b95c6be7a53e117cac1f94dc9824b827d8e304a4b5856
4
+ data.tar.gz: e4d5bf0dfa00ed20d6a0c93c22acff54481b4571ee805de9e03b2101dbfdbea5
5
5
  SHA512:
6
- metadata.gz: 95929a3a72d3a3645ff048a014c607a03ec3357644c3e2118088ff0bdfa886cc080bd72afda136c50fec7c03a63862b158d1b8f81c885682c90d2a35bd73a4ff
7
- data.tar.gz: 15ddaf907ebfcff60003841ea86aa9c5858010a59e054ace4914ce2d0ffae0591462b5233a91732521380b8ad7df04338636a58e5b768763429b60a7bed7b2b7
6
+ metadata.gz: 4e061d1fb9f157edd9ba4b333300710a666764b0f140609dcb7782c0227336a3669bb15e446393c1d4647fa3dbb1111bad040e6bc962abea6c1792af8c15f687
7
+ data.tar.gz: a4c5b133214d7cf12a0cb5035596a5c2ab56e9267ef06084204d59f2a4c55a41ce0dd3b65070795625fe503fba4406bbb151e90bccc0c30275f7b709482aebe2
@@ -579,7 +579,7 @@ div.figure {
579
579
  font-weight: 700;
580
580
  font-size: 1em;
581
581
  text-align: center; }
582
- div.figure > img {
582
+ div.figure > img, div.figure > svg {
583
583
  margin-left: auto;
584
584
  margin-right: auto;
585
585
  display: block;
@@ -16,7 +16,7 @@ doctype_abbrev:
16
16
  standard: Std.
17
17
  recommended-practice: Rec. Prac.
18
18
  guide: Gde.
19
- term_def_boilerplate: "<p>For the purposes of this document, the following terms and definitions apply. The <em>IEEE Standards Dictionary Online</em> should be consulted for terms not defined in this clause.<fn><p><em>IEEE Standards Dictionary Online</em> is available at: <link target='http://dictionary.ieee.org'/>. An IEEE Account is required for access to the dictionary, and one can be created at no charge on the dictionary sign-in page.</p></fn></p>"
19
+ term_def_boilerplate: "<p>For the purposes of this document, the following terms and definitions apply. The <em>IEEE Standards Dictionary Online</em> should be consulted for terms not defined in this clause.<fn reference='_boilerplate_term1'><p><em>IEEE Standards Dictionary Online</em> is available at: <link target='http://dictionary.ieee.org'/>. An IEEE Account is required for access to the dictionary, and one can be created at no charge on the dictionary sign-in page.</p></fn></p>"
20
20
  norm_with_refs_pref: The following referenced documents are indispensable for the application of this document (i.e., they must be understood and used, so each referenced document is cited in text and its relationship to this document is explained). For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments or corrigenda) applies.
21
21
  biblio_pref: Bibliographical references are resources that provide additional or helpful material but do not need to be understood or used to implement this standard. Reference to these resources is made for informational use only.
22
22
  note_inform_fn: Notes to text, tables, and figures are for information only and do not contain requirements needed to implement the standard.
@@ -4139,6 +4139,16 @@
4139
4139
 
4140
4140
  </xsl:attribute-set>
4141
4141
 
4142
+ <xsl:attribute-set name="pre-style">
4143
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4144
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4145
+
4146
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
4147
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
4148
+ <xsl:attribute name="font-size">95%</xsl:attribute>
4149
+
4150
+ </xsl:attribute-set>
4151
+
4142
4152
  <xsl:attribute-set name="permission-style">
4143
4153
 
4144
4154
  </xsl:attribute-set>
@@ -4246,9 +4256,15 @@
4246
4256
  <xsl:variable name="table-border_">
4247
4257
 
4248
4258
  1pt solid black
4259
+
4249
4260
  </xsl:variable>
4250
4261
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4251
4262
 
4263
+ <xsl:variable name="table-cell-border_">
4264
+
4265
+ </xsl:variable>
4266
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4267
+
4252
4268
  <xsl:attribute-set name="table-container-style">
4253
4269
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4254
4270
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4262,8 +4278,6 @@
4262
4278
  <xsl:attribute-set name="table-style">
4263
4279
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4264
4280
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4265
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4266
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4267
4281
 
4268
4282
  <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
4269
4283
 
@@ -5390,6 +5404,12 @@
5390
5404
  <xsl:variable name="table_attributes">
5391
5405
 
5392
5406
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5407
+
5408
+ <xsl:if test="$margin-side != 0">
5409
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5410
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5411
+ </xsl:if>
5412
+
5393
5413
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5394
5414
 
5395
5415
  <xsl:if test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
@@ -6194,6 +6214,10 @@
6194
6214
  <xsl:template match="*[local-name()='tr']">
6195
6215
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6196
6216
 
6217
+ <xsl:if test="*[local-name() = 'th']">
6218
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6219
+ </xsl:if>
6220
+
6197
6221
  <xsl:if test="ancestor::*[local-name() = 'feedback-statement']">
6198
6222
  <xsl:attribute name="min-height">0mm</xsl:attribute>
6199
6223
  </xsl:if>
@@ -7249,8 +7273,17 @@
7249
7273
  </fo:inline>
7250
7274
  </xsl:template> <!-- tt -->
7251
7275
 
7276
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
7252
7277
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
7253
- <xsl:call-template name="add_spaces_to_sourcecode"/>
7278
+ <xsl:choose>
7279
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
7280
+ <!-- url -->
7281
+ <xsl:call-template name="add-zero-spaces-link-java"/>
7282
+ </xsl:when>
7283
+ <xsl:otherwise>
7284
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
7285
+ </xsl:otherwise>
7286
+ </xsl:choose>
7254
7287
  </xsl:template>
7255
7288
 
7256
7289
  <xsl:template match="*[local-name()='underline']">
@@ -7606,8 +7639,11 @@
7606
7639
 
7607
7640
  <xsl:template name="add-zero-spaces-link-java">
7608
7641
  <xsl:param name="text" select="."/>
7642
+
7643
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7644
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7609
7645
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7610
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
7646
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7611
7647
  </xsl:template>
7612
7648
 
7613
7649
  <!-- add zero space after dash character (for table's entries) -->
@@ -8164,6 +8200,9 @@
8164
8200
  <xsl:value-of select="substring($str, 2)"/>
8165
8201
  </xsl:template>
8166
8202
 
8203
+ <!-- ======================================= -->
8204
+ <!-- math -->
8205
+ <!-- ======================================= -->
8167
8206
  <xsl:template match="mathml:math">
8168
8207
  <xsl:variable name="isAdded" select="@added"/>
8169
8208
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8214,14 +8253,59 @@
8214
8253
  <xsl:value-of select="$comment_text"/>
8215
8254
  </xsl:template>
8216
8255
 
8256
+ <xsl:template match="*[local-name() = 'asciimath']">
8257
+ <xsl:param name="process" select="'false'"/>
8258
+ <xsl:if test="$process = 'true'">
8259
+ <xsl:apply-templates/>
8260
+ </xsl:if>
8261
+ </xsl:template>
8262
+
8263
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8264
+
8265
+ <xsl:template name="getMathml_asciimath_text">
8266
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8267
+ <xsl:variable name="latexmath">
8268
+
8269
+ <xsl:value-of select="../*[local-name() = 'latexmath']"/>
8270
+
8271
+ </xsl:variable>
8272
+ <xsl:variable name="asciimath_text_following">
8273
+ <xsl:choose>
8274
+ <xsl:when test="normalize-space($latexmath) != ''">
8275
+ <xsl:value-of select="$latexmath"/>
8276
+ </xsl:when>
8277
+ <xsl:when test="normalize-space($asciimath) != ''">
8278
+ <xsl:value-of select="$asciimath"/>
8279
+ </xsl:when>
8280
+ <xsl:otherwise>
8281
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8282
+ </xsl:otherwise>
8283
+ </xsl:choose>
8284
+ </xsl:variable>
8285
+ <xsl:variable name="asciimath_text_">
8286
+ <xsl:choose>
8287
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8288
+ <xsl:value-of select="$asciimath_text_following"/>
8289
+ </xsl:when>
8290
+ <xsl:otherwise>
8291
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8292
+ </xsl:otherwise>
8293
+ </xsl:choose>
8294
+ </xsl:variable>
8295
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8296
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8297
+ <xsl:value-of select="$asciimath_text"/>
8298
+ </xsl:template>
8299
+
8217
8300
  <xsl:template name="mathml_instream_object">
8218
- <xsl:param name="comment_text"/>
8301
+ <xsl:param name="asciimath_text"/>
8219
8302
  <xsl:param name="mathml_content"/>
8220
8303
 
8221
- <xsl:variable name="comment_text_">
8304
+ <xsl:variable name="asciimath_text_">
8222
8305
  <xsl:choose>
8223
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8224
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8306
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8307
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8308
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8225
8309
  </xsl:choose>
8226
8310
  </xsl:variable>
8227
8311
 
@@ -8238,10 +8322,10 @@
8238
8322
  </xsl:attribute>
8239
8323
 
8240
8324
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8241
- <xsl:if test="normalize-space($comment_text_) != ''">
8325
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8242
8326
  <!-- put Mathin Alternate Text -->
8243
8327
  <xsl:attribute name="fox:alt-text">
8244
- <xsl:value-of select="$comment_text_"/>
8328
+ <xsl:value-of select="$asciimath_text_"/>
8245
8329
  </xsl:attribute>
8246
8330
  </xsl:if>
8247
8331
  <!-- </xsl:if> -->
@@ -8314,6 +8398,29 @@
8314
8398
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8315
8399
  </xsl:template>
8316
8400
 
8401
+ <!-- Examples:
8402
+ <stem type="AsciiMath">x = 1</stem>
8403
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8404
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8405
+ -->
8406
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8407
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8408
+
8409
+ <xsl:choose>
8410
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8411
+ <xsl:otherwise>
8412
+ <xsl:apply-templates>
8413
+ <xsl:with-param name="process">true</xsl:with-param>
8414
+ </xsl:apply-templates>
8415
+ </xsl:otherwise>
8416
+ </xsl:choose>
8417
+
8418
+ </fo:inline>
8419
+ </xsl:template>
8420
+ <!-- ======================================= -->
8421
+ <!-- END: math -->
8422
+ <!-- ======================================= -->
8423
+
8317
8424
  <xsl:template match="*[local-name()='localityStack']"/>
8318
8425
 
8319
8426
  <xsl:template match="*[local-name()='link']" name="link">
@@ -9673,9 +9780,9 @@
9673
9780
  <xsl:apply-templates mode="contents_item"/>
9674
9781
  </xsl:template>
9675
9782
 
9676
- <!-- ====== -->
9677
- <!-- sourcecode -->
9678
- <!-- ====== -->
9783
+ <!-- =============== -->
9784
+ <!-- sourcecode -->
9785
+ <!-- =============== -->
9679
9786
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9680
9787
 
9681
9788
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -9972,8 +10079,22 @@
9972
10079
  </fo:block>
9973
10080
  </xsl:if>
9974
10081
  </xsl:template>
9975
- <!-- ====== -->
9976
- <!-- ====== -->
10082
+ <!-- =============== -->
10083
+ <!-- END sourcecode -->
10084
+ <!-- =============== -->
10085
+
10086
+ <!-- =============== -->
10087
+ <!-- pre -->
10088
+ <!-- =============== -->
10089
+ <xsl:template match="*[local-name()='pre']" name="pre">
10090
+ <fo:block xsl:use-attribute-sets="pre-style">
10091
+ <xsl:copy-of select="@id"/>
10092
+ <xsl:apply-templates/>
10093
+ </fo:block>
10094
+ </xsl:template>
10095
+ <!-- =============== -->
10096
+ <!-- pre -->
10097
+ <!-- =============== -->
9977
10098
 
9978
10099
  <!-- ========== -->
9979
10100
  <!-- permission -->
@@ -11483,7 +11604,7 @@
11483
11604
  <xsl:apply-templates select="*[local-name() = 'note']"/>
11484
11605
 
11485
11606
  <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
11486
-
11607
+ <xsl:text>,</xsl:text>
11487
11608
  <xsl:text> </xsl:text>
11488
11609
  </xsl:if>
11489
11610
 
@@ -12208,7 +12329,7 @@
12208
12329
 
12209
12330
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12210
12331
 
12211
- <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">
12332
+ <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">
12212
12333
 
12213
12334
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12214
12335
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -12682,13 +12803,14 @@
12682
12803
  </xsl:template>
12683
12804
 
12684
12805
  <xsl:template name="setId">
12806
+ <xsl:param name="prefix"/>
12685
12807
  <xsl:attribute name="id">
12686
12808
  <xsl:choose>
12687
12809
  <xsl:when test="@id">
12688
- <xsl:value-of select="@id"/>
12810
+ <xsl:value-of select="concat($prefix, @id)"/>
12689
12811
  </xsl:when>
12690
12812
  <xsl:otherwise>
12691
- <xsl:value-of select="generate-id()"/>
12813
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12692
12814
  </xsl:otherwise>
12693
12815
  </xsl:choose>
12694
12816
  </xsl:attribute>
@@ -4139,6 +4139,16 @@
4139
4139
 
4140
4140
  </xsl:attribute-set>
4141
4141
 
4142
+ <xsl:attribute-set name="pre-style">
4143
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4144
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4145
+
4146
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
4147
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
4148
+ <xsl:attribute name="font-size">95%</xsl:attribute>
4149
+
4150
+ </xsl:attribute-set>
4151
+
4142
4152
  <xsl:attribute-set name="permission-style">
4143
4153
 
4144
4154
  </xsl:attribute-set>
@@ -4246,9 +4256,15 @@
4246
4256
  <xsl:variable name="table-border_">
4247
4257
 
4248
4258
  1pt solid black
4259
+
4249
4260
  </xsl:variable>
4250
4261
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4251
4262
 
4263
+ <xsl:variable name="table-cell-border_">
4264
+
4265
+ </xsl:variable>
4266
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4267
+
4252
4268
  <xsl:attribute-set name="table-container-style">
4253
4269
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4254
4270
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4262,8 +4278,6 @@
4262
4278
  <xsl:attribute-set name="table-style">
4263
4279
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4264
4280
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4265
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4266
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4267
4281
 
4268
4282
  <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
4269
4283
 
@@ -5390,6 +5404,12 @@
5390
5404
  <xsl:variable name="table_attributes">
5391
5405
 
5392
5406
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5407
+
5408
+ <xsl:if test="$margin-side != 0">
5409
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5410
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5411
+ </xsl:if>
5412
+
5393
5413
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5394
5414
 
5395
5415
  <xsl:if test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
@@ -6194,6 +6214,10 @@
6194
6214
  <xsl:template match="*[local-name()='tr']">
6195
6215
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6196
6216
 
6217
+ <xsl:if test="*[local-name() = 'th']">
6218
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6219
+ </xsl:if>
6220
+
6197
6221
  <xsl:if test="ancestor::*[local-name() = 'feedback-statement']">
6198
6222
  <xsl:attribute name="min-height">0mm</xsl:attribute>
6199
6223
  </xsl:if>
@@ -7249,8 +7273,17 @@
7249
7273
  </fo:inline>
7250
7274
  </xsl:template> <!-- tt -->
7251
7275
 
7276
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
7252
7277
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
7253
- <xsl:call-template name="add_spaces_to_sourcecode"/>
7278
+ <xsl:choose>
7279
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
7280
+ <!-- url -->
7281
+ <xsl:call-template name="add-zero-spaces-link-java"/>
7282
+ </xsl:when>
7283
+ <xsl:otherwise>
7284
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
7285
+ </xsl:otherwise>
7286
+ </xsl:choose>
7254
7287
  </xsl:template>
7255
7288
 
7256
7289
  <xsl:template match="*[local-name()='underline']">
@@ -7606,8 +7639,11 @@
7606
7639
 
7607
7640
  <xsl:template name="add-zero-spaces-link-java">
7608
7641
  <xsl:param name="text" select="."/>
7642
+
7643
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7644
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7609
7645
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7610
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
7646
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7611
7647
  </xsl:template>
7612
7648
 
7613
7649
  <!-- add zero space after dash character (for table's entries) -->
@@ -8164,6 +8200,9 @@
8164
8200
  <xsl:value-of select="substring($str, 2)"/>
8165
8201
  </xsl:template>
8166
8202
 
8203
+ <!-- ======================================= -->
8204
+ <!-- math -->
8205
+ <!-- ======================================= -->
8167
8206
  <xsl:template match="mathml:math">
8168
8207
  <xsl:variable name="isAdded" select="@added"/>
8169
8208
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8214,14 +8253,59 @@
8214
8253
  <xsl:value-of select="$comment_text"/>
8215
8254
  </xsl:template>
8216
8255
 
8256
+ <xsl:template match="*[local-name() = 'asciimath']">
8257
+ <xsl:param name="process" select="'false'"/>
8258
+ <xsl:if test="$process = 'true'">
8259
+ <xsl:apply-templates/>
8260
+ </xsl:if>
8261
+ </xsl:template>
8262
+
8263
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8264
+
8265
+ <xsl:template name="getMathml_asciimath_text">
8266
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8267
+ <xsl:variable name="latexmath">
8268
+
8269
+ <xsl:value-of select="../*[local-name() = 'latexmath']"/>
8270
+
8271
+ </xsl:variable>
8272
+ <xsl:variable name="asciimath_text_following">
8273
+ <xsl:choose>
8274
+ <xsl:when test="normalize-space($latexmath) != ''">
8275
+ <xsl:value-of select="$latexmath"/>
8276
+ </xsl:when>
8277
+ <xsl:when test="normalize-space($asciimath) != ''">
8278
+ <xsl:value-of select="$asciimath"/>
8279
+ </xsl:when>
8280
+ <xsl:otherwise>
8281
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8282
+ </xsl:otherwise>
8283
+ </xsl:choose>
8284
+ </xsl:variable>
8285
+ <xsl:variable name="asciimath_text_">
8286
+ <xsl:choose>
8287
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8288
+ <xsl:value-of select="$asciimath_text_following"/>
8289
+ </xsl:when>
8290
+ <xsl:otherwise>
8291
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8292
+ </xsl:otherwise>
8293
+ </xsl:choose>
8294
+ </xsl:variable>
8295
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8296
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8297
+ <xsl:value-of select="$asciimath_text"/>
8298
+ </xsl:template>
8299
+
8217
8300
  <xsl:template name="mathml_instream_object">
8218
- <xsl:param name="comment_text"/>
8301
+ <xsl:param name="asciimath_text"/>
8219
8302
  <xsl:param name="mathml_content"/>
8220
8303
 
8221
- <xsl:variable name="comment_text_">
8304
+ <xsl:variable name="asciimath_text_">
8222
8305
  <xsl:choose>
8223
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8224
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8306
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8307
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8308
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8225
8309
  </xsl:choose>
8226
8310
  </xsl:variable>
8227
8311
 
@@ -8238,10 +8322,10 @@
8238
8322
  </xsl:attribute>
8239
8323
 
8240
8324
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8241
- <xsl:if test="normalize-space($comment_text_) != ''">
8325
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8242
8326
  <!-- put Mathin Alternate Text -->
8243
8327
  <xsl:attribute name="fox:alt-text">
8244
- <xsl:value-of select="$comment_text_"/>
8328
+ <xsl:value-of select="$asciimath_text_"/>
8245
8329
  </xsl:attribute>
8246
8330
  </xsl:if>
8247
8331
  <!-- </xsl:if> -->
@@ -8314,6 +8398,29 @@
8314
8398
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8315
8399
  </xsl:template>
8316
8400
 
8401
+ <!-- Examples:
8402
+ <stem type="AsciiMath">x = 1</stem>
8403
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8404
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8405
+ -->
8406
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8407
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8408
+
8409
+ <xsl:choose>
8410
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8411
+ <xsl:otherwise>
8412
+ <xsl:apply-templates>
8413
+ <xsl:with-param name="process">true</xsl:with-param>
8414
+ </xsl:apply-templates>
8415
+ </xsl:otherwise>
8416
+ </xsl:choose>
8417
+
8418
+ </fo:inline>
8419
+ </xsl:template>
8420
+ <!-- ======================================= -->
8421
+ <!-- END: math -->
8422
+ <!-- ======================================= -->
8423
+
8317
8424
  <xsl:template match="*[local-name()='localityStack']"/>
8318
8425
 
8319
8426
  <xsl:template match="*[local-name()='link']" name="link">
@@ -9673,9 +9780,9 @@
9673
9780
  <xsl:apply-templates mode="contents_item"/>
9674
9781
  </xsl:template>
9675
9782
 
9676
- <!-- ====== -->
9677
- <!-- sourcecode -->
9678
- <!-- ====== -->
9783
+ <!-- =============== -->
9784
+ <!-- sourcecode -->
9785
+ <!-- =============== -->
9679
9786
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9680
9787
 
9681
9788
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -9972,8 +10079,22 @@
9972
10079
  </fo:block>
9973
10080
  </xsl:if>
9974
10081
  </xsl:template>
9975
- <!-- ====== -->
9976
- <!-- ====== -->
10082
+ <!-- =============== -->
10083
+ <!-- END sourcecode -->
10084
+ <!-- =============== -->
10085
+
10086
+ <!-- =============== -->
10087
+ <!-- pre -->
10088
+ <!-- =============== -->
10089
+ <xsl:template match="*[local-name()='pre']" name="pre">
10090
+ <fo:block xsl:use-attribute-sets="pre-style">
10091
+ <xsl:copy-of select="@id"/>
10092
+ <xsl:apply-templates/>
10093
+ </fo:block>
10094
+ </xsl:template>
10095
+ <!-- =============== -->
10096
+ <!-- pre -->
10097
+ <!-- =============== -->
9977
10098
 
9978
10099
  <!-- ========== -->
9979
10100
  <!-- permission -->
@@ -11483,7 +11604,7 @@
11483
11604
  <xsl:apply-templates select="*[local-name() = 'note']"/>
11484
11605
 
11485
11606
  <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
11486
-
11607
+ <xsl:text>,</xsl:text>
11487
11608
  <xsl:text> </xsl:text>
11488
11609
  </xsl:if>
11489
11610
 
@@ -12208,7 +12329,7 @@
12208
12329
 
12209
12330
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12210
12331
 
12211
- <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">
12332
+ <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">
12212
12333
 
12213
12334
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12214
12335
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -12682,13 +12803,14 @@
12682
12803
  </xsl:template>
12683
12804
 
12684
12805
  <xsl:template name="setId">
12806
+ <xsl:param name="prefix"/>
12685
12807
  <xsl:attribute name="id">
12686
12808
  <xsl:choose>
12687
12809
  <xsl:when test="@id">
12688
- <xsl:value-of select="@id"/>
12810
+ <xsl:value-of select="concat($prefix, @id)"/>
12689
12811
  </xsl:when>
12690
12812
  <xsl:otherwise>
12691
- <xsl:value-of select="generate-id()"/>
12813
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12692
12814
  </xsl:otherwise>
12693
12815
  </xsl:choose>
12694
12816
  </xsl:attribute>
@@ -42,7 +42,7 @@ module IsoDoc
42
42
 
43
43
  p = v.xpath(ns("./p"))
44
44
  v.children =
45
- "<p>#{p.map(&:children).map(&:to_xml).join("\n")}</p>"\
45
+ "<p>#{p.map(&:children).map(&:to_xml).join("\n")}</p>" \
46
46
  "#{v.xpath(ns('./termsource')).to_xml}"
47
47
  end
48
48
  super
@@ -71,17 +71,21 @@ module IsoDoc
71
71
  end
72
72
 
73
73
  def sort_terms_key(term)
74
- d = term.at(ns("./preferred/expression/name | "\
75
- "./preferred/letter-symbol/name | "\
76
- "./preferred/graphical-symbol/figure/name | "\
77
- "./preferred/graphical-symbol/figure/@id | "\
74
+ d = term.at(ns("./preferred/expression/name | " \
75
+ "./preferred/letter-symbol/name | " \
76
+ "./preferred/graphical-symbol/figure/name | " \
77
+ "./preferred/graphical-symbol/figure/@id | " \
78
78
  "./preferred"))
79
79
  f = term.at(ns("./field-of-application")) || term.at(ns("./domain"))
80
80
  HTMLEntities.new.decode("#{sort_terms_key1(d)} :: #{sort_terms_key1(f)}")
81
81
  end
82
82
 
83
83
  def sort_terms_key1(elem)
84
- elem&.text&.strip&.downcase || "zzzz"
84
+ return "zzzz" if elem.nil?
85
+
86
+ dup = elem.dup
87
+ dup.xpath(ns(".//asciimath | .//latexmath")).each(&:remove)
88
+ dup.text&.strip&.downcase || "zzzz"
85
89
  end
86
90
 
87
91
  def term_related_reorder(coll)
@@ -173,7 +177,7 @@ module IsoDoc
173
177
  def collapse_term_related(rels)
174
178
  ret = rels.map do |r|
175
179
  p = r.at(ns("./preferred"))
176
- "<em>#{@i18n.relatedterms[r['type']]}:</em> "\
180
+ "<em>#{@i18n.relatedterms[r['type']]}:</em> " \
177
181
  "#{p&.children&.to_xml || '**RELATED TERM NOT FOUND**'}"
178
182
  end.join(". ")
179
183
  ret += "." unless ret.empty?
@@ -229,7 +233,7 @@ module IsoDoc
229
233
  def merge_second_preferred(term)
230
234
  pref =
231
235
  term.at(ns("./preferred[not(abbreviation-type)]/expression/name"))
232
- x = term.xpath(ns("./preferred[expression/name][abbreviation-type] | "\
236
+ x = term.xpath(ns("./preferred[expression/name][abbreviation-type] | " \
233
237
  "./admitted[expression/name][abbreviation-type]"))
234
238
  (pref && !x.empty?) or return
235
239
  tail = x.map do |p|