metanorma-iso 2.4.1 → 2.4.2

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: 63f76b4a2d9cc268099b20ca2fa32965d1baa2573dbd696170412ba717ae726b
4
- data.tar.gz: 4d7c46a0cedf41d5466030d6e4e5ea8956cdce2081d4d24be581eafae3a71c4d
3
+ metadata.gz: d8bfb0d40024d23c0e4bcf6f7e5d7a9b59066f3ac7288d16f232203a39a00b6c
4
+ data.tar.gz: 13262faed4ac013f95881bc6cdac14f702f61b44d62275c88d5e1bcf1de13397
5
5
  SHA512:
6
- metadata.gz: 1651fd7ed1c7216292a542dd4a1e5be937807afe1728675633287e507100b0c9979fd58afb682e6ba271d0021313ef1e92f04dc8a14f6d9ad2778fc6cd7eed2a
7
- data.tar.gz: 5c195c5207ca60ea89789d9ba82723788f01e85ac9e576d03d27c2449a2fe6ee1bf2fd479809a7813865821e1107b257cc64cdf0f7bb6e59603696602bc30b28
6
+ metadata.gz: aaa40bf853a800144371bb0419a818ef26806308622fba26f79169c533fcc24e29206c20b11538e71d903c3d05a0d873b75e6ad348bf7c72bd2944bed37f55e9
7
+ data.tar.gz: 5bc24e5f4fa220d136f3d71be7096e0660b1c37bcdde1a104fc3c3f9ba91c308f5921d8fa7e2a6971659800e219bb511aeea9f5ca6f0aa7464943da0d24cf8a3
@@ -183,13 +183,19 @@ module IsoDoc
183
183
  measurement_units(node, out)
184
184
  out.table **table_attrs(node) do |t|
185
185
  table_parse_core(node, t)
186
- (dl = node.at(ns("./dl"))) && parse(dl, out)
187
- node.xpath(ns("./note[not(@type = 'units')]"))
188
- .each { |n| parse(n, out) }
186
+ table_parse_tail(node, t)
189
187
  end
190
188
  @in_table = false
191
189
  end
192
190
 
191
+ def table_parse_tail(node, out)
192
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
193
+ node.xpath(ns("./source")).each { |n| parse(n, out) }
194
+ node.xpath(ns("./note[not(@type = 'units')]")).each do |n|
195
+ parse(n, out)
196
+ end
197
+ end
198
+
193
199
  def figure_parse1(node, out)
194
200
  measurement_units(node, out)
195
201
  out.div **figure_attrs(node) do |div|
@@ -2974,11 +2974,17 @@
2974
2974
  <!-- ========================== -->
2975
2975
  <!-- Definition's list styles -->
2976
2976
  <!-- ========================== -->
2977
+
2978
+ <xsl:attribute-set name="dl-block-style">
2979
+
2980
+ </xsl:attribute-set>
2981
+
2977
2982
  <xsl:attribute-set name="dt-row-style">
2978
2983
 
2979
2984
  </xsl:attribute-set>
2980
2985
 
2981
2986
  <xsl:attribute-set name="dt-cell-style">
2987
+
2982
2988
  </xsl:attribute-set>
2983
2989
 
2984
2990
  <xsl:attribute-set name="dt-block-style">
@@ -2996,6 +3002,7 @@
2996
3002
 
2997
3003
  <xsl:attribute-set name="dd-cell-style">
2998
3004
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
3005
+
2999
3006
  </xsl:attribute-set>
3000
3007
 
3001
3008
  <!-- ========================== -->
@@ -3136,6 +3143,10 @@
3136
3143
 
3137
3144
  </xsl:attribute-set>
3138
3145
 
3146
+ <xsl:attribute-set name="figure-source-style">
3147
+
3148
+ </xsl:attribute-set>
3149
+
3139
3150
  <!-- Formula's styles -->
3140
3151
  <xsl:attribute-set name="formula-style">
3141
3152
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3671,7 +3682,7 @@
3671
3682
 
3672
3683
  <xsl:template name="processTables_Contents">
3673
3684
  <tables>
3674
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3685
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3675
3686
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3676
3687
  <xsl:copy-of select="*[local-name() = 'name']"/>
3677
3688
  </table>
@@ -4027,7 +4038,7 @@
4027
4038
  </xsl:attribute>
4028
4039
  </xsl:for-each>
4029
4040
 
4030
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4041
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4031
4042
  <xsl:if test="$isNoteOrFnExist = 'true'">
4032
4043
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4033
4044
  </xsl:if>
@@ -4071,7 +4082,7 @@
4071
4082
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4072
4083
  </xsl:when>
4073
4084
  <xsl:otherwise>
4074
- <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 -->
4085
+ <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 -->
4075
4086
  </xsl:otherwise>
4076
4087
  </xsl:choose>
4077
4088
 
@@ -4194,6 +4205,11 @@
4194
4205
  </xsl:if>
4195
4206
  </xsl:template> <!-- table/name -->
4196
4207
 
4208
+ <!-- SOURCE: ... -->
4209
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4210
+ <xsl:call-template name="termsource"/>
4211
+ </xsl:template>
4212
+
4197
4213
  <xsl:template name="calculate-columns-numbers">
4198
4214
  <xsl:param name="table-row"/>
4199
4215
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -4554,7 +4570,7 @@
4554
4570
  </fo:table-header>
4555
4571
  </xsl:template> <!-- thead -->
4556
4572
 
4557
- <!-- template is using for iso, jcgm, bsi only -->
4573
+ <!-- template is using for iec, iso, jcgm, bsi only -->
4558
4574
  <xsl:template name="table-header-title">
4559
4575
  <xsl:param name="cols-count"/>
4560
4576
  <!-- row for title -->
@@ -4607,7 +4623,7 @@
4607
4623
  <xsl:param name="colwidths"/>
4608
4624
  <xsl:param name="colgroup"/>
4609
4625
 
4610
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4626
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4611
4627
 
4612
4628
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4613
4629
 
@@ -4677,6 +4693,7 @@
4677
4693
 
4678
4694
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4679
4695
  <xsl:apply-templates select="../*[local-name()='note']"/>
4696
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4680
4697
 
4681
4698
  <xsl:variable name="isDisplayRowSeparator">
4682
4699
 
@@ -5391,7 +5408,7 @@
5391
5408
  <xsl:variable name="isAdded" select="@added"/>
5392
5409
  <xsl:variable name="isDeleted" select="@deleted"/>
5393
5410
  <!-- <dl><xsl:copy-of select="."/></dl> -->
5394
- <fo:block-container>
5411
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
5395
5412
 
5396
5413
  <xsl:call-template name="setBlockSpanAll"/>
5397
5414
 
@@ -5399,6 +5416,18 @@
5399
5416
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5400
5417
  </xsl:if>
5401
5418
 
5419
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5420
+ <!-- set font-size as sourcecode font-size -->
5421
+ <xsl:variable name="sourcecode_attributes">
5422
+ <xsl:call-template name="get_sourcecode_attributes"/>
5423
+ </xsl:variable>
5424
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
5425
+ <xsl:attribute name="{local-name()}">
5426
+ <xsl:value-of select="."/>
5427
+ </xsl:attribute>
5428
+ </xsl:for-each>
5429
+ </xsl:if>
5430
+
5402
5431
  <xsl:if test="parent::*[local-name() = 'note']">
5403
5432
  <xsl:attribute name="margin-left">
5404
5433
  <xsl:choose>
@@ -5850,6 +5879,7 @@
5850
5879
  <xsl:param name="split_keep-within-line"/>
5851
5880
 
5852
5881
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5882
+
5853
5883
  <xsl:call-template name="insert_dt_cell">
5854
5884
  <xsl:with-param name="key_iso" select="$key_iso"/>
5855
5885
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5871,6 +5901,7 @@
5871
5901
  <!-- border is mandatory, to calculate real width -->
5872
5902
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5873
5903
  <xsl:attribute name="text-align">left</xsl:attribute>
5904
+
5874
5905
  </xsl:if>
5875
5906
 
5876
5907
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -6384,6 +6415,7 @@
6384
6415
  <fo:inline>
6385
6416
  <xsl:for-each select="$styles/style">
6386
6417
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6418
+
6387
6419
  </xsl:for-each>
6388
6420
  <xsl:apply-templates/>
6389
6421
  </fo:inline>
@@ -7900,6 +7932,13 @@
7900
7932
  </fo:block>
7901
7933
  </xsl:template>
7902
7934
 
7935
+ <!-- SOURCE: ... -->
7936
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7937
+
7938
+ <xsl:call-template name="termsource"/>
7939
+
7940
+ </xsl:template>
7941
+
7903
7942
  <xsl:template match="*[local-name() = 'image']">
7904
7943
  <xsl:variable name="isAdded" select="../@added"/>
7905
7944
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -9029,9 +9068,11 @@
9029
9068
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9030
9069
  </xsl:if>
9031
9070
 
9032
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9071
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
9033
9072
  </fo:block>
9034
9073
 
9074
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
9075
+
9035
9076
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9036
9077
 
9037
9078
  </fo:block-container>
@@ -9063,11 +9104,22 @@
9063
9104
  <!-- add sourcecode highlighting -->
9064
9105
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
9065
9106
  <xsl:variable name="class" select="@class"/>
9107
+
9108
+ <!-- Example: <1> -->
9109
+ <xsl:variable name="is_callout">
9110
+ <xsl:if test="parent::*[local-name() = 'dt']">
9111
+ <xsl:variable name="dt_id" select="../@id"/>
9112
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
9113
+ </xsl:if>
9114
+ </xsl:variable>
9115
+
9066
9116
  <xsl:choose>
9067
9117
  <xsl:when test="$sourcecode_css//class[@name = $class]">
9068
9118
  <fo:inline>
9069
9119
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
9120
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
9070
9121
  <xsl:apply-templates/>
9122
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
9071
9123
  </fo:inline>
9072
9124
  </xsl:when>
9073
9125
  <xsl:otherwise>
@@ -9493,6 +9545,10 @@
9493
9545
  </fo:block>
9494
9546
  </xsl:template>
9495
9547
 
9548
+ <xsl:template match="*[local-name() = 'div']">
9549
+ <fo:block><xsl:apply-templates/></fo:block>
9550
+ </xsl:template>
9551
+
9496
9552
  <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']">
9497
9553
  <fo:block xsl:use-attribute-sets="inherit-style">
9498
9554
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -10194,13 +10250,8 @@
10194
10250
  </xsl:template>
10195
10251
 
10196
10252
  <xsl:template match="*[local-name() = 'deprecates']">
10197
- <xsl:variable name="title-deprecated">
10198
- <xsl:call-template name="getLocalizedString">
10199
- <xsl:with-param name="key">deprecated</xsl:with-param>
10200
- </xsl:call-template>
10201
- </xsl:variable>
10202
10253
  <fo:block xsl:use-attribute-sets="deprecates-style">
10203
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
10254
+ <xsl:apply-templates/>
10204
10255
  </fo:block>
10205
10256
  </xsl:template>
10206
10257
 
@@ -11430,6 +11481,23 @@
11430
11481
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
11431
11482
  <xsl:copy-of select="."/>
11432
11483
  </xsl:template>
11484
+
11485
+ <!-- add @id, redundant for table auto-layout algorithm -->
11486
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11487
+ <xsl:copy>
11488
+ <xsl:copy-of select="@*"/>
11489
+ <xsl:call-template name="add_id"/>
11490
+ <xsl:apply-templates mode="update_xml_step1"/>
11491
+ </xsl:copy>
11492
+ </xsl:template>
11493
+
11494
+ <xsl:template name="add_id">
11495
+ <xsl:if test="not(@id)">
11496
+ <!-- add @id - first element with @id plus '_element_name' -->
11497
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
11498
+ </xsl:if>
11499
+ </xsl:template>
11500
+
11433
11501
  <!-- =========================================================================== -->
11434
11502
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11435
11503
  <!-- =========================================================================== -->
@@ -2974,11 +2974,17 @@
2974
2974
  <!-- ========================== -->
2975
2975
  <!-- Definition's list styles -->
2976
2976
  <!-- ========================== -->
2977
+
2978
+ <xsl:attribute-set name="dl-block-style">
2979
+
2980
+ </xsl:attribute-set>
2981
+
2977
2982
  <xsl:attribute-set name="dt-row-style">
2978
2983
 
2979
2984
  </xsl:attribute-set>
2980
2985
 
2981
2986
  <xsl:attribute-set name="dt-cell-style">
2987
+
2982
2988
  </xsl:attribute-set>
2983
2989
 
2984
2990
  <xsl:attribute-set name="dt-block-style">
@@ -2996,6 +3002,7 @@
2996
3002
 
2997
3003
  <xsl:attribute-set name="dd-cell-style">
2998
3004
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
3005
+
2999
3006
  </xsl:attribute-set>
3000
3007
 
3001
3008
  <!-- ========================== -->
@@ -3136,6 +3143,10 @@
3136
3143
 
3137
3144
  </xsl:attribute-set>
3138
3145
 
3146
+ <xsl:attribute-set name="figure-source-style">
3147
+
3148
+ </xsl:attribute-set>
3149
+
3139
3150
  <!-- Formula's styles -->
3140
3151
  <xsl:attribute-set name="formula-style">
3141
3152
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3671,7 +3682,7 @@
3671
3682
 
3672
3683
  <xsl:template name="processTables_Contents">
3673
3684
  <tables>
3674
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3685
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3675
3686
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3676
3687
  <xsl:copy-of select="*[local-name() = 'name']"/>
3677
3688
  </table>
@@ -4027,7 +4038,7 @@
4027
4038
  </xsl:attribute>
4028
4039
  </xsl:for-each>
4029
4040
 
4030
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4041
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4031
4042
  <xsl:if test="$isNoteOrFnExist = 'true'">
4032
4043
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4033
4044
  </xsl:if>
@@ -4071,7 +4082,7 @@
4071
4082
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4072
4083
  </xsl:when>
4073
4084
  <xsl:otherwise>
4074
- <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 -->
4085
+ <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 -->
4075
4086
  </xsl:otherwise>
4076
4087
  </xsl:choose>
4077
4088
 
@@ -4194,6 +4205,11 @@
4194
4205
  </xsl:if>
4195
4206
  </xsl:template> <!-- table/name -->
4196
4207
 
4208
+ <!-- SOURCE: ... -->
4209
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4210
+ <xsl:call-template name="termsource"/>
4211
+ </xsl:template>
4212
+
4197
4213
  <xsl:template name="calculate-columns-numbers">
4198
4214
  <xsl:param name="table-row"/>
4199
4215
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -4554,7 +4570,7 @@
4554
4570
  </fo:table-header>
4555
4571
  </xsl:template> <!-- thead -->
4556
4572
 
4557
- <!-- template is using for iso, jcgm, bsi only -->
4573
+ <!-- template is using for iec, iso, jcgm, bsi only -->
4558
4574
  <xsl:template name="table-header-title">
4559
4575
  <xsl:param name="cols-count"/>
4560
4576
  <!-- row for title -->
@@ -4607,7 +4623,7 @@
4607
4623
  <xsl:param name="colwidths"/>
4608
4624
  <xsl:param name="colgroup"/>
4609
4625
 
4610
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4626
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4611
4627
 
4612
4628
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4613
4629
 
@@ -4677,6 +4693,7 @@
4677
4693
 
4678
4694
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4679
4695
  <xsl:apply-templates select="../*[local-name()='note']"/>
4696
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4680
4697
 
4681
4698
  <xsl:variable name="isDisplayRowSeparator">
4682
4699
 
@@ -5391,7 +5408,7 @@
5391
5408
  <xsl:variable name="isAdded" select="@added"/>
5392
5409
  <xsl:variable name="isDeleted" select="@deleted"/>
5393
5410
  <!-- <dl><xsl:copy-of select="."/></dl> -->
5394
- <fo:block-container>
5411
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
5395
5412
 
5396
5413
  <xsl:call-template name="setBlockSpanAll"/>
5397
5414
 
@@ -5399,6 +5416,18 @@
5399
5416
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5400
5417
  </xsl:if>
5401
5418
 
5419
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5420
+ <!-- set font-size as sourcecode font-size -->
5421
+ <xsl:variable name="sourcecode_attributes">
5422
+ <xsl:call-template name="get_sourcecode_attributes"/>
5423
+ </xsl:variable>
5424
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
5425
+ <xsl:attribute name="{local-name()}">
5426
+ <xsl:value-of select="."/>
5427
+ </xsl:attribute>
5428
+ </xsl:for-each>
5429
+ </xsl:if>
5430
+
5402
5431
  <xsl:if test="parent::*[local-name() = 'note']">
5403
5432
  <xsl:attribute name="margin-left">
5404
5433
  <xsl:choose>
@@ -5850,6 +5879,7 @@
5850
5879
  <xsl:param name="split_keep-within-line"/>
5851
5880
 
5852
5881
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5882
+
5853
5883
  <xsl:call-template name="insert_dt_cell">
5854
5884
  <xsl:with-param name="key_iso" select="$key_iso"/>
5855
5885
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5871,6 +5901,7 @@
5871
5901
  <!-- border is mandatory, to calculate real width -->
5872
5902
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5873
5903
  <xsl:attribute name="text-align">left</xsl:attribute>
5904
+
5874
5905
  </xsl:if>
5875
5906
 
5876
5907
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -6384,6 +6415,7 @@
6384
6415
  <fo:inline>
6385
6416
  <xsl:for-each select="$styles/style">
6386
6417
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6418
+
6387
6419
  </xsl:for-each>
6388
6420
  <xsl:apply-templates/>
6389
6421
  </fo:inline>
@@ -7900,6 +7932,13 @@
7900
7932
  </fo:block>
7901
7933
  </xsl:template>
7902
7934
 
7935
+ <!-- SOURCE: ... -->
7936
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7937
+
7938
+ <xsl:call-template name="termsource"/>
7939
+
7940
+ </xsl:template>
7941
+
7903
7942
  <xsl:template match="*[local-name() = 'image']">
7904
7943
  <xsl:variable name="isAdded" select="../@added"/>
7905
7944
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -9029,9 +9068,11 @@
9029
9068
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9030
9069
  </xsl:if>
9031
9070
 
9032
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9071
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
9033
9072
  </fo:block>
9034
9073
 
9074
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
9075
+
9035
9076
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9036
9077
 
9037
9078
  </fo:block-container>
@@ -9063,11 +9104,22 @@
9063
9104
  <!-- add sourcecode highlighting -->
9064
9105
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
9065
9106
  <xsl:variable name="class" select="@class"/>
9107
+
9108
+ <!-- Example: <1> -->
9109
+ <xsl:variable name="is_callout">
9110
+ <xsl:if test="parent::*[local-name() = 'dt']">
9111
+ <xsl:variable name="dt_id" select="../@id"/>
9112
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
9113
+ </xsl:if>
9114
+ </xsl:variable>
9115
+
9066
9116
  <xsl:choose>
9067
9117
  <xsl:when test="$sourcecode_css//class[@name = $class]">
9068
9118
  <fo:inline>
9069
9119
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
9120
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
9070
9121
  <xsl:apply-templates/>
9122
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
9071
9123
  </fo:inline>
9072
9124
  </xsl:when>
9073
9125
  <xsl:otherwise>
@@ -9493,6 +9545,10 @@
9493
9545
  </fo:block>
9494
9546
  </xsl:template>
9495
9547
 
9548
+ <xsl:template match="*[local-name() = 'div']">
9549
+ <fo:block><xsl:apply-templates/></fo:block>
9550
+ </xsl:template>
9551
+
9496
9552
  <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']">
9497
9553
  <fo:block xsl:use-attribute-sets="inherit-style">
9498
9554
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -10194,13 +10250,8 @@
10194
10250
  </xsl:template>
10195
10251
 
10196
10252
  <xsl:template match="*[local-name() = 'deprecates']">
10197
- <xsl:variable name="title-deprecated">
10198
- <xsl:call-template name="getLocalizedString">
10199
- <xsl:with-param name="key">deprecated</xsl:with-param>
10200
- </xsl:call-template>
10201
- </xsl:variable>
10202
10253
  <fo:block xsl:use-attribute-sets="deprecates-style">
10203
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
10254
+ <xsl:apply-templates/>
10204
10255
  </fo:block>
10205
10256
  </xsl:template>
10206
10257
 
@@ -11430,6 +11481,23 @@
11430
11481
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
11431
11482
  <xsl:copy-of select="."/>
11432
11483
  </xsl:template>
11484
+
11485
+ <!-- add @id, redundant for table auto-layout algorithm -->
11486
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11487
+ <xsl:copy>
11488
+ <xsl:copy-of select="@*"/>
11489
+ <xsl:call-template name="add_id"/>
11490
+ <xsl:apply-templates mode="update_xml_step1"/>
11491
+ </xsl:copy>
11492
+ </xsl:template>
11493
+
11494
+ <xsl:template name="add_id">
11495
+ <xsl:if test="not(@id)">
11496
+ <!-- add @id - first element with @id plus '_element_name' -->
11497
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
11498
+ </xsl:if>
11499
+ </xsl:template>
11500
+
11433
11501
  <!-- =========================================================================== -->
11434
11502
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11435
11503
  <!-- =========================================================================== -->
@@ -23,6 +23,7 @@ module IsoDoc
23
23
  sourcecode docxml
24
24
  formula docxml
25
25
  admonition docxml
26
+ source docxml
26
27
  ol docxml
27
28
  permission docxml
28
29
  requirement docxml
@@ -231,14 +231,19 @@ module IsoDoc
231
231
  out.div align: "center", class: "table_container" do |div|
232
232
  div.table **table_attrs(node) do |t|
233
233
  table_parse_core(node, t)
234
- (dl = node.at(ns("./dl"))) && parse(dl, div)
235
- node.xpath(ns("./note[not(@type = 'units')]"))
236
- .each { |n| parse(n, div) }
234
+ table_parse_tail(node, t)
237
235
  end
238
236
  end
239
237
  @in_table = false
240
238
  end
241
239
 
240
+ def table_parse_tail(node, out)
241
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
242
+ node.xpath(ns("./source")).each { |n| parse(n, out) }
243
+ node.xpath(ns("./note[not(@type = 'units')]"))
244
+ .each { |n| parse(n, out) }
245
+ end
246
+
242
247
  include BaseConvert
243
248
  include Init
244
249
  end
@@ -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 ISO
3
- VERSION = "2.4.1".freeze
3
+ VERSION = "2.4.2".freeze
4
4
  end
5
5
  end
@@ -32,9 +32,9 @@ Gem::Specification.new do |spec|
32
32
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
33
33
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 2.4.0"
35
+ spec.add_dependency "metanorma-standoc", "~> 2.4.2"
36
36
  spec.add_dependency "mnconvert", "~> 1.14"
37
- spec.add_dependency "pubid-iso", "~> 0.4.0"
37
+ spec.add_dependency "pubid-iso", "~> 0.5.0"
38
38
  spec.add_dependency "ruby-jing"
39
39
  spec.add_dependency "tokenizer", "~> 0.3.0"
40
40
  spec.add_dependency "twitter_cldr"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
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-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 2.4.2
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.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.0
47
+ version: 0.5.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.4.0
54
+ version: 0.5.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ruby-jing
57
57
  requirement: !ruby/object:Gem::Requirement