metanorma-bipm 2.2.7 → 2.2.8

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.
@@ -2363,11 +2363,17 @@
2363
2363
  <!-- ========================== -->
2364
2364
  <!-- Definition's list styles -->
2365
2365
  <!-- ========================== -->
2366
+
2367
+ <xsl:attribute-set name="dl-block-style">
2368
+
2369
+ </xsl:attribute-set>
2370
+
2366
2371
  <xsl:attribute-set name="dt-row-style">
2367
2372
 
2368
2373
  </xsl:attribute-set>
2369
2374
 
2370
2375
  <xsl:attribute-set name="dt-cell-style">
2376
+
2371
2377
  </xsl:attribute-set>
2372
2378
 
2373
2379
  <xsl:attribute-set name="dt-block-style">
@@ -2385,6 +2391,7 @@
2385
2391
 
2386
2392
  <xsl:attribute-set name="dd-cell-style">
2387
2393
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
2394
+
2388
2395
  </xsl:attribute-set>
2389
2396
 
2390
2397
  <!-- ========================== -->
@@ -2527,6 +2534,10 @@
2527
2534
 
2528
2535
  </xsl:attribute-set>
2529
2536
 
2537
+ <xsl:attribute-set name="figure-source-style">
2538
+
2539
+ </xsl:attribute-set>
2540
+
2530
2541
  <!-- Formula's styles -->
2531
2542
  <xsl:attribute-set name="formula-style">
2532
2543
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3066,7 +3077,7 @@
3066
3077
 
3067
3078
  <xsl:template name="processTables_Contents">
3068
3079
  <tables>
3069
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3080
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3070
3081
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3071
3082
  <xsl:copy-of select="*[local-name() = 'name']"/>
3072
3083
  </table>
@@ -3410,7 +3421,7 @@
3410
3421
  </xsl:attribute>
3411
3422
  </xsl:for-each>
3412
3423
 
3413
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3424
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3414
3425
  <xsl:if test="$isNoteOrFnExist = 'true'">
3415
3426
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3416
3427
  </xsl:if>
@@ -3454,7 +3465,7 @@
3454
3465
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3455
3466
  </xsl:when>
3456
3467
  <xsl:otherwise>
3457
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
3468
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3458
3469
  </xsl:otherwise>
3459
3470
  </xsl:choose>
3460
3471
 
@@ -3560,6 +3571,11 @@
3560
3571
  </xsl:if>
3561
3572
  </xsl:template> <!-- table/name -->
3562
3573
 
3574
+ <!-- SOURCE: ... -->
3575
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3576
+ <xsl:call-template name="termsource"/>
3577
+ </xsl:template>
3578
+
3563
3579
  <xsl:template name="calculate-columns-numbers">
3564
3580
  <xsl:param name="table-row"/>
3565
3581
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3920,7 +3936,7 @@
3920
3936
  </fo:table-header>
3921
3937
  </xsl:template> <!-- thead -->
3922
3938
 
3923
- <!-- template is using for iso, jcgm, bsi only -->
3939
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3924
3940
  <xsl:template name="table-header-title">
3925
3941
  <xsl:param name="cols-count"/>
3926
3942
  <!-- row for title -->
@@ -3972,7 +3988,7 @@
3972
3988
  <xsl:param name="colwidths"/>
3973
3989
  <xsl:param name="colgroup"/>
3974
3990
 
3975
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3991
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3976
3992
 
3977
3993
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3978
3994
 
@@ -4042,6 +4058,7 @@
4042
4058
 
4043
4059
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4044
4060
  <xsl:apply-templates select="../*[local-name()='note']"/>
4061
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4045
4062
 
4046
4063
  <xsl:variable name="isDisplayRowSeparator">
4047
4064
 
@@ -4738,7 +4755,7 @@
4738
4755
  <xsl:variable name="isAdded" select="@added"/>
4739
4756
  <xsl:variable name="isDeleted" select="@deleted"/>
4740
4757
  <!-- <dl><xsl:copy-of select="."/></dl> -->
4741
- <fo:block-container>
4758
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
4742
4759
 
4743
4760
  <xsl:call-template name="setBlockSpanAll"/>
4744
4761
 
@@ -4746,6 +4763,18 @@
4746
4763
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4747
4764
  </xsl:if>
4748
4765
 
4766
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
4767
+ <!-- set font-size as sourcecode font-size -->
4768
+ <xsl:variable name="sourcecode_attributes">
4769
+ <xsl:call-template name="get_sourcecode_attributes"/>
4770
+ </xsl:variable>
4771
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
4772
+ <xsl:attribute name="{local-name()}">
4773
+ <xsl:value-of select="."/>
4774
+ </xsl:attribute>
4775
+ </xsl:for-each>
4776
+ </xsl:if>
4777
+
4749
4778
  <xsl:if test="parent::*[local-name() = 'note']">
4750
4779
  <xsl:attribute name="margin-left">
4751
4780
  <xsl:choose>
@@ -5193,6 +5222,7 @@
5193
5222
  <xsl:param name="split_keep-within-line"/>
5194
5223
 
5195
5224
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5225
+
5196
5226
  <xsl:call-template name="insert_dt_cell">
5197
5227
  <xsl:with-param name="key_iso" select="$key_iso"/>
5198
5228
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5214,6 +5244,7 @@
5214
5244
  <!-- border is mandatory, to calculate real width -->
5215
5245
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5216
5246
  <xsl:attribute name="text-align">left</xsl:attribute>
5247
+
5217
5248
  </xsl:if>
5218
5249
 
5219
5250
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -5659,6 +5690,7 @@
5659
5690
  <fo:inline>
5660
5691
  <xsl:for-each select="$styles/style">
5661
5692
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5693
+
5662
5694
  </xsl:for-each>
5663
5695
  <xsl:apply-templates/>
5664
5696
  </fo:inline>
@@ -7165,6 +7197,13 @@
7165
7197
  </fo:block>
7166
7198
  </xsl:template>
7167
7199
 
7200
+ <!-- SOURCE: ... -->
7201
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7202
+
7203
+ <xsl:call-template name="termsource"/>
7204
+
7205
+ </xsl:template>
7206
+
7168
7207
  <xsl:template match="*[local-name() = 'image']">
7169
7208
  <xsl:variable name="isAdded" select="../@added"/>
7170
7209
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -8295,9 +8334,11 @@
8295
8334
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8296
8335
  </xsl:if>
8297
8336
 
8298
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8337
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
8299
8338
  </fo:block>
8300
8339
 
8340
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
8341
+
8301
8342
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8302
8343
 
8303
8344
  </fo:block-container>
@@ -8329,11 +8370,22 @@
8329
8370
  <!-- add sourcecode highlighting -->
8330
8371
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8331
8372
  <xsl:variable name="class" select="@class"/>
8373
+
8374
+ <!-- Example: <1> -->
8375
+ <xsl:variable name="is_callout">
8376
+ <xsl:if test="parent::*[local-name() = 'dt']">
8377
+ <xsl:variable name="dt_id" select="../@id"/>
8378
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
8379
+ </xsl:if>
8380
+ </xsl:variable>
8381
+
8332
8382
  <xsl:choose>
8333
8383
  <xsl:when test="$sourcecode_css//class[@name = $class]">
8334
8384
  <fo:inline>
8335
8385
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8386
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
8336
8387
  <xsl:apply-templates/>
8388
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
8337
8389
  </fo:inline>
8338
8390
  </xsl:when>
8339
8391
  <xsl:otherwise>
@@ -8757,6 +8809,10 @@
8757
8809
  </fo:block>
8758
8810
  </xsl:template>
8759
8811
 
8812
+ <xsl:template match="*[local-name() = 'div']">
8813
+ <fo:block><xsl:apply-templates/></fo:block>
8814
+ </xsl:template>
8815
+
8760
8816
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
8761
8817
  <fo:block xsl:use-attribute-sets="inherit-style">
8762
8818
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -9463,13 +9519,8 @@
9463
9519
  </xsl:template>
9464
9520
 
9465
9521
  <xsl:template match="*[local-name() = 'deprecates']">
9466
- <xsl:variable name="title-deprecated">
9467
- <xsl:call-template name="getLocalizedString">
9468
- <xsl:with-param name="key">deprecated</xsl:with-param>
9469
- </xsl:call-template>
9470
- </xsl:variable>
9471
9522
  <fo:block xsl:use-attribute-sets="deprecates-style">
9472
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
9523
+ <xsl:apply-templates/>
9473
9524
  </fo:block>
9474
9525
  </xsl:template>
9475
9526
 
@@ -10709,6 +10760,23 @@
10709
10760
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
10710
10761
  <xsl:copy-of select="."/>
10711
10762
  </xsl:template>
10763
+
10764
+ <!-- add @id, redundant for table auto-layout algorithm -->
10765
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10766
+ <xsl:copy>
10767
+ <xsl:copy-of select="@*"/>
10768
+ <xsl:call-template name="add_id"/>
10769
+ <xsl:apply-templates mode="update_xml_step1"/>
10770
+ </xsl:copy>
10771
+ </xsl:template>
10772
+
10773
+ <xsl:template name="add_id">
10774
+ <xsl:if test="not(@id)">
10775
+ <!-- add @id - first element with @id plus '_element_name' -->
10776
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10777
+ </xsl:if>
10778
+ </xsl:template>
10779
+
10712
10780
  <!-- =========================================================================== -->
10713
10781
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10714
10782
  <!-- =========================================================================== -->
@@ -382,6 +382,9 @@
382
382
  <optional>
383
383
  <ref name="dl"/>
384
384
  </optional>
385
+ <optional>
386
+ <ref name="source"/>
387
+ </optional>
385
388
  </element>
386
389
  </define>
387
390
  <define name="figure">
@@ -404,9 +407,6 @@
404
407
  <attribute name="class"/>
405
408
  </optional>
406
409
  <ref name="BlockAttributes"/>
407
- <optional>
408
- <ref name="source"/>
409
- </optional>
410
410
  <optional>
411
411
  <ref name="tname"/>
412
412
  </optional>
@@ -431,6 +431,20 @@
431
431
  <zeroOrMore>
432
432
  <ref name="note"/>
433
433
  </zeroOrMore>
434
+ <optional>
435
+ <ref name="source"/>
436
+ </optional>
437
+ </element>
438
+ </define>
439
+ <define name="source">
440
+ <element name="source">
441
+ <attribute name="status">
442
+ <ref name="SourceStatusType"/>
443
+ </attribute>
444
+ <ref name="origin"/>
445
+ <optional>
446
+ <ref name="modification"/>
447
+ </optional>
434
448
  </element>
435
449
  </define>
436
450
  <define name="sourcecode">
@@ -2099,10 +2113,7 @@
2099
2113
  <define name="termsource">
2100
2114
  <element name="termsource">
2101
2115
  <attribute name="status">
2102
- <choice>
2103
- <value>identical</value>
2104
- <value>modified</value>
2105
- </choice>
2116
+ <ref name="SourceStatusType"/>
2106
2117
  </attribute>
2107
2118
  <attribute name="type">
2108
2119
  <choice>
@@ -2116,6 +2127,17 @@
2116
2127
  </optional>
2117
2128
  </element>
2118
2129
  </define>
2130
+ <define name="SourceStatusType">
2131
+ <choice>
2132
+ <value>identical</value>
2133
+ <value>modified</value>
2134
+ <value>restyled</value>
2135
+ <value>context-added</value>
2136
+ <value>generalisation</value>
2137
+ <value>specialisation</value>
2138
+ <value>unspecified</value>
2139
+ </choice>
2140
+ </define>
2119
2141
  <define name="origin">
2120
2142
  <element name="origin">
2121
2143
  <choice>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.2.7".freeze
3
+ VERSION = "2.2.8".freeze
4
4
  end
5
5
  end
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
29
29
 
30
- spec.add_dependency "metanorma-generic", "~> 2.4.0"
31
- spec.add_dependency "metanorma-iso", "~> 2.4.0"
30
+ spec.add_dependency "metanorma-generic", "~> 2.4.1"
31
+ spec.add_dependency "metanorma-iso", "~> 2.4.2"
32
32
 
33
33
  spec.add_development_dependency "debug"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.7
4
+ version: 2.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 2.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 2.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-iso
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.0
33
+ version: 2.4.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.0
40
+ version: 2.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement