metanorma-bipm 2.1.10 → 2.1.12

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: 991c0584d9b44a0a713ffe4f48ae94c301000753eb253e8824fad17365c65410
4
- data.tar.gz: 40fd596a56184bfec825e39ba5a605eed81c6ea4d1e1955e00a8ee5f2d07d98b
3
+ metadata.gz: 9646a056278cd68248390dedde7d635cf80d4b6617fc8d5d50ddce0654a3e4e1
4
+ data.tar.gz: 3a58fd80e587e34342b9f95944f05ce38da2ef28fdeab15b9ec41d2e7d469c98
5
5
  SHA512:
6
- metadata.gz: aa53052fba1a979cc1298b3a557ca1b1b799f11f230889b6751e4c9e661392a0d727210a9721c8e5b6f811c257660b63c98fa330c7fb676e1950329bfd992b05
7
- data.tar.gz: 8bb577314adcf71b5fb2404e5130521fcdac8cc5dfd3e509b3378ef033636ef72022bd61d10129f81b13e7baed46a2bf42188c1626b518119c1eae9433d3e974
6
+ metadata.gz: bd897f8bdd06512637106113cc6f1d45a836bd9f3d18964a50187e03c6a7b6d8b17271945f26ae5dde87e410a77e244ac79de8cb121bf6bb7a93bb303226e8ed
7
+ data.tar.gz: 5dee365292ec477ebbb3d97e0eacd27fdeb1ce0999496ba999f8c336c5171e5e9d867baef20c03995339f3f2b8a4d17ba61c7c4b8c18c0288f3e5d18dfa436b7
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  end
9
9
 
10
10
  def convert1(docxml, filename, dir)
11
- @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
11
+ @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
12
12
  "@acronym"))&.value == "JCGM"
13
13
  super
14
14
  end
@@ -42,7 +42,8 @@ module IsoDoc
42
42
 
43
43
  def implicit_reference(bib)
44
44
  b = bib.at(ns("./docidentifier[@primary = 'true'][@type = 'BIPM']"))
45
- return true if /^(CGPM|CIPM|CCDS|CCTF)\s
45
+ doctype = bib.at(ns("//bibdata/ext/doctype"))&.text
46
+ return true if doctype == "brochure" && /^(CGPM|CIPM|CCDS|CCTF)\s
46
47
  (Resolution|Recommendation|Declaration|Decision|Recommendation|Meeting)/x
47
48
  .match?(b&.text)
48
49
 
@@ -1058,7 +1058,7 @@
1058
1058
  <!-- <xsl:copy-of select="$contents"/> -->
1059
1059
 
1060
1060
  <xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
1061
- <fo:table table-layout="fixed" width="100%">
1061
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}">
1062
1062
  <fo:table-column column-width="127mm"/>
1063
1063
  <fo:table-column column-width="12mm"/>
1064
1064
  <fo:table-body>
@@ -2242,8 +2242,13 @@
2242
2242
  <!-- ====== -->
2243
2243
 
2244
2244
  <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
2245
- <fo:table table-layout="fixed" width="173.5mm">
2245
+ <fo:block keep-with-next="always">
2246
2246
  <xsl:call-template name="setId"/>
2247
+ </fo:block>
2248
+ <fo:table table-layout="fixed" width="173.5mm">
2249
+ <xsl:call-template name="setId">
2250
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2251
+ </xsl:call-template>
2247
2252
  <fo:table-column column-width="137mm"/>
2248
2253
  <fo:table-column column-width="2.5mm"/>
2249
2254
  <fo:table-column column-width="34mm"/>
@@ -2386,11 +2391,16 @@
2386
2391
  </xsl:variable>
2387
2392
  <xsl:variable name="space-before-value" select="normalize-space($space-before)"/>
2388
2393
 
2394
+ <fo:block keep-with-next="always">
2395
+ <xsl:call-template name="setId"/>
2396
+ </fo:block>
2389
2397
  <fo:table table-layout="fixed" width="174mm" line-height="135%">
2390
2398
  <xsl:if test="@orientation = 'landscape'">
2391
2399
  <xsl:attribute name="width">261mm</xsl:attribute> <!-- 87 = (297 - 210) -->
2392
2400
  </xsl:if>
2393
- <xsl:call-template name="setId"/>
2401
+ <xsl:call-template name="setId">
2402
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2403
+ </xsl:call-template>
2394
2404
  <xsl:if test="$space-before-value != ''">
2395
2405
  <xsl:attribute name="space-before"><xsl:value-of select="$space-before-value"/></xsl:attribute>
2396
2406
  </xsl:if>
@@ -3743,7 +3753,7 @@
3743
3753
  </fo:block>
3744
3754
  </fo:block-container>
3745
3755
  <!-- grey opacity -->
3746
- <fo:block-container absolute-position="fixed" left="0" top="0">
3756
+ <fo:block-container absolute-position="fixed" left="0" top="0" id="{concat('__internal_layout__', 'Logo-BIPM-Metro_', generate-id())}">
3747
3757
  <fo:block>
3748
3758
  <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
3749
3759
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
@@ -4215,6 +4225,12 @@
4215
4225
 
4216
4226
  </xsl:attribute-set>
4217
4227
 
4228
+ <xsl:attribute-set name="pre-style">
4229
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4230
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4231
+
4232
+ </xsl:attribute-set>
4233
+
4218
4234
  <xsl:attribute-set name="permission-style">
4219
4235
 
4220
4236
  </xsl:attribute-set>
@@ -4313,6 +4329,11 @@
4313
4329
  </xsl:variable>
4314
4330
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4315
4331
 
4332
+ <xsl:variable name="table-cell-border_">
4333
+
4334
+ </xsl:variable>
4335
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4336
+
4316
4337
  <xsl:attribute-set name="table-container-style">
4317
4338
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4318
4339
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4325,8 +4346,6 @@
4325
4346
  <xsl:attribute-set name="table-style">
4326
4347
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4327
4348
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4328
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4329
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4330
4349
 
4331
4350
  </xsl:attribute-set><!-- table-style -->
4332
4351
 
@@ -5459,6 +5478,12 @@
5459
5478
  <xsl:variable name="table_attributes">
5460
5479
 
5461
5480
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5481
+
5482
+ <xsl:if test="$margin-side != 0">
5483
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5484
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5485
+ </xsl:if>
5486
+
5462
5487
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5463
5488
 
5464
5489
  <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
@@ -6247,6 +6272,10 @@
6247
6272
  <xsl:template match="*[local-name()='tr']">
6248
6273
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6249
6274
 
6275
+ <xsl:if test="*[local-name() = 'th']">
6276
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6277
+ </xsl:if>
6278
+
6250
6279
  <xsl:call-template name="setTableRowAttributes"/>
6251
6280
  <xsl:apply-templates/>
6252
6281
  </fo:table-row>
@@ -7342,8 +7371,17 @@
7342
7371
  </fo:inline>
7343
7372
  </xsl:template> <!-- tt -->
7344
7373
 
7374
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
7345
7375
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
7346
- <xsl:call-template name="add_spaces_to_sourcecode"/>
7376
+ <xsl:choose>
7377
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
7378
+ <!-- url -->
7379
+ <xsl:call-template name="add-zero-spaces-link-java"/>
7380
+ </xsl:when>
7381
+ <xsl:otherwise>
7382
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
7383
+ </xsl:otherwise>
7384
+ </xsl:choose>
7347
7385
  </xsl:template>
7348
7386
 
7349
7387
  <xsl:template match="*[local-name()='underline']">
@@ -7699,8 +7737,11 @@
7699
7737
 
7700
7738
  <xsl:template name="add-zero-spaces-link-java">
7701
7739
  <xsl:param name="text" select="."/>
7740
+
7741
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7742
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7702
7743
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7703
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
7744
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7704
7745
  </xsl:template>
7705
7746
 
7706
7747
  <!-- add zero space after dash character (for table's entries) -->
@@ -8257,6 +8298,9 @@
8257
8298
  <xsl:value-of select="substring($str, 2)"/>
8258
8299
  </xsl:template>
8259
8300
 
8301
+ <!-- ======================================= -->
8302
+ <!-- math -->
8303
+ <!-- ======================================= -->
8260
8304
  <xsl:template match="mathml:math">
8261
8305
  <xsl:variable name="isAdded" select="@added"/>
8262
8306
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8292,17 +8336,18 @@
8292
8336
  <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
8293
8337
  <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
8294
8338
  <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
8295
- <xsl:variable name="comment_text">
8296
- <xsl:call-template name="getMathml_comment_text"/>
8339
+ <xsl:variable name="asciimath_text">
8340
+ <!-- <xsl:call-template name="getMathml_comment_text"/> -->
8341
+ <xsl:call-template name="getMathml_asciimath_text"/>
8297
8342
  </xsl:variable>
8298
- <xsl:if test="normalize-space($comment_text) != ''">
8343
+ <xsl:if test="normalize-space($asciimath_text) != ''">
8299
8344
  <!-- put Mathin Alternate Text -->
8300
8345
  <xsl:attribute name="fox:alt-text">
8301
- <xsl:value-of select="$comment_text"/>
8346
+ <xsl:value-of select="$asciimath_text"/>
8302
8347
  </xsl:attribute>
8303
8348
  </xsl:if>
8304
8349
  <xsl:call-template name="mathml_instream_object">
8305
- <xsl:with-param name="comment_text" select="$comment_text"/>
8350
+ <xsl:with-param name="asciimath_text" select="$asciimath_text"/>
8306
8351
  <xsl:with-param name="mathml_content" select="$mathml_content"/>
8307
8352
  </xsl:call-template>
8308
8353
  </fo:basic-link>
@@ -8313,7 +8358,7 @@
8313
8358
  </xsl:call-template>
8314
8359
  </xsl:otherwise>
8315
8360
  </xsl:choose>
8316
- <!-- end BSI -->
8361
+ <!-- end BIPM -->
8317
8362
 
8318
8363
  </fo:inline>
8319
8364
  </xsl:template>
@@ -8335,14 +8380,57 @@
8335
8380
  <xsl:value-of select="$comment_text"/>
8336
8381
  </xsl:template>
8337
8382
 
8383
+ <xsl:template match="*[local-name() = 'asciimath']">
8384
+ <xsl:param name="process" select="'false'"/>
8385
+ <xsl:if test="$process = 'true'">
8386
+ <xsl:apply-templates/>
8387
+ </xsl:if>
8388
+ </xsl:template>
8389
+
8390
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8391
+
8392
+ <xsl:template name="getMathml_asciimath_text">
8393
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8394
+ <xsl:variable name="latexmath">
8395
+
8396
+ </xsl:variable>
8397
+ <xsl:variable name="asciimath_text_following">
8398
+ <xsl:choose>
8399
+ <xsl:when test="normalize-space($latexmath) != ''">
8400
+ <xsl:value-of select="$latexmath"/>
8401
+ </xsl:when>
8402
+ <xsl:when test="normalize-space($asciimath) != ''">
8403
+ <xsl:value-of select="$asciimath"/>
8404
+ </xsl:when>
8405
+ <xsl:otherwise>
8406
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8407
+ </xsl:otherwise>
8408
+ </xsl:choose>
8409
+ </xsl:variable>
8410
+ <xsl:variable name="asciimath_text_">
8411
+ <xsl:choose>
8412
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8413
+ <xsl:value-of select="$asciimath_text_following"/>
8414
+ </xsl:when>
8415
+ <xsl:otherwise>
8416
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8417
+ </xsl:otherwise>
8418
+ </xsl:choose>
8419
+ </xsl:variable>
8420
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8421
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8422
+ <xsl:value-of select="$asciimath_text"/>
8423
+ </xsl:template>
8424
+
8338
8425
  <xsl:template name="mathml_instream_object">
8339
- <xsl:param name="comment_text"/>
8426
+ <xsl:param name="asciimath_text"/>
8340
8427
  <xsl:param name="mathml_content"/>
8341
8428
 
8342
- <xsl:variable name="comment_text_">
8429
+ <xsl:variable name="asciimath_text_">
8343
8430
  <xsl:choose>
8344
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8345
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8431
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8432
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8433
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8346
8434
  </xsl:choose>
8347
8435
  </xsl:variable>
8348
8436
 
@@ -8366,10 +8454,10 @@
8366
8454
  </xsl:attribute>
8367
8455
 
8368
8456
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8369
- <xsl:if test="normalize-space($comment_text_) != ''">
8457
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8370
8458
  <!-- put Mathin Alternate Text -->
8371
8459
  <xsl:attribute name="fox:alt-text">
8372
- <xsl:value-of select="$comment_text_"/>
8460
+ <xsl:value-of select="$asciimath_text_"/>
8373
8461
  </xsl:attribute>
8374
8462
  </xsl:if>
8375
8463
  <!-- </xsl:if> -->
@@ -8442,6 +8530,33 @@
8442
8530
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8443
8531
  </xsl:template>
8444
8532
 
8533
+ <!-- Examples:
8534
+ <stem type="AsciiMath">x = 1</stem>
8535
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8536
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8537
+ -->
8538
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8539
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8540
+
8541
+ <xsl:if test="ancestor::*[local-name()='table']">
8542
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
8543
+ </xsl:if>
8544
+
8545
+ <xsl:choose>
8546
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8547
+ <xsl:otherwise>
8548
+ <xsl:apply-templates>
8549
+ <xsl:with-param name="process">true</xsl:with-param>
8550
+ </xsl:apply-templates>
8551
+ </xsl:otherwise>
8552
+ </xsl:choose>
8553
+
8554
+ </fo:inline>
8555
+ </xsl:template>
8556
+ <!-- ======================================= -->
8557
+ <!-- END: math -->
8558
+ <!-- ======================================= -->
8559
+
8445
8560
  <xsl:template match="*[local-name()='localityStack']"/>
8446
8561
 
8447
8562
  <xsl:template match="*[local-name()='link']" name="link">
@@ -9822,9 +9937,9 @@
9822
9937
  <xsl:apply-templates mode="contents_item"/>
9823
9938
  </xsl:template>
9824
9939
 
9825
- <!-- ====== -->
9826
- <!-- sourcecode -->
9827
- <!-- ====== -->
9940
+ <!-- =============== -->
9941
+ <!-- sourcecode -->
9942
+ <!-- =============== -->
9828
9943
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9829
9944
 
9830
9945
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -10121,8 +10236,22 @@
10121
10236
  </fo:block>
10122
10237
  </xsl:if>
10123
10238
  </xsl:template>
10124
- <!-- ====== -->
10125
- <!-- ====== -->
10239
+ <!-- =============== -->
10240
+ <!-- END sourcecode -->
10241
+ <!-- =============== -->
10242
+
10243
+ <!-- =============== -->
10244
+ <!-- pre -->
10245
+ <!-- =============== -->
10246
+ <xsl:template match="*[local-name()='pre']" name="pre">
10247
+ <fo:block xsl:use-attribute-sets="pre-style">
10248
+ <xsl:copy-of select="@id"/>
10249
+ <xsl:apply-templates/>
10250
+ </fo:block>
10251
+ </xsl:template>
10252
+ <!-- =============== -->
10253
+ <!-- pre -->
10254
+ <!-- =============== -->
10126
10255
 
10127
10256
  <!-- ========== -->
10128
10257
  <!-- permission -->
@@ -12202,7 +12331,7 @@
12202
12331
 
12203
12332
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12204
12333
 
12205
- <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">
12334
+ <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">
12206
12335
 
12207
12336
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12208
12337
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -12678,13 +12807,14 @@
12678
12807
  </xsl:template>
12679
12808
 
12680
12809
  <xsl:template name="setId">
12810
+ <xsl:param name="prefix"/>
12681
12811
  <xsl:attribute name="id">
12682
12812
  <xsl:choose>
12683
12813
  <xsl:when test="@id">
12684
- <xsl:value-of select="@id"/>
12814
+ <xsl:value-of select="concat($prefix, @id)"/>
12685
12815
  </xsl:when>
12686
12816
  <xsl:otherwise>
12687
- <xsl:value-of select="generate-id()"/>
12817
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12688
12818
  </xsl:otherwise>
12689
12819
  </xsl:choose>
12690
12820
  </xsl:attribute>