metanorma-iec 2.8.0 → 2.8.1

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: d54425dc5dce149f69cd97abd6ffcc133eaaca52dca3ebec74ca874fd3e4bff0
4
- data.tar.gz: 527849fb1c470bb0b1e3a0e599e56623bf95e3f0b31c8cc2291f14dbd08ceef9
3
+ metadata.gz: c6defcf38222ffe2ca5af4f9369778ff3e879196a8bbde0c348d0c45f8a522d3
4
+ data.tar.gz: f1ee1d7a0938499d67c20dedc74a3a88e6ee7064afc5ab186885784ce037417a
5
5
  SHA512:
6
- metadata.gz: 3dbfdab2f070389c60c00bb3542898a5df002a6d671613bd6f1ebdbe4da48599e60e9de93a8c0a52890ebad960353971e246d1fe3dc285935f4f881287a44bcb
7
- data.tar.gz: 7f99027ac8a56eeea59a7a42cb73100bfe866d60d1cedce2fd82d5aa3ba7cabf7a85d12f45b26560d8eb5d4dc65eff5e46719340685a099253634a0dba8edaeb
6
+ metadata.gz: 0dd0dc87b5fcd7caba2e46bbe57a66b8a1e126d78d7f2a5ef44f466afa70630aacc0495d2478f9a052117cb4452d2171f9b73ee4615c5013284dd86d4cfa918c
7
+ data.tar.gz: 4a821ea60263a1f5a76be53b4732693e2e1e048ae7e927461691a7b077d7dbf32fdb3255bc28185ba579b7325657bd3533e286023ee54bc25b6e030bbec10d72
@@ -809,7 +809,7 @@ p.TermNum {
809
809
  width: 100%;
810
810
  }
811
811
  }
812
- div.figure > img, div.figure > svg {
812
+ figure > img, figure > svg {
813
813
  margin-left: auto;
814
814
  margin-right: auto;
815
815
  display: block;
@@ -817,7 +817,7 @@ div.figure > img, div.figure > svg {
817
817
  height: auto;
818
818
  }
819
819
 
820
- table div.figure {
820
+ table figure {
821
821
  padding: 0;
822
822
  margin: 0;
823
823
  }
@@ -1152,17 +1152,21 @@ p.NormRef, div.Biblio, div.NormRef {
1152
1152
  margin-left: 2em;
1153
1153
  }
1154
1154
 
1155
+ .Biblio.note, .Biblio.Note, .NormRef.note, .NormRef.Note {
1156
+ margin-left: 3.5em;
1157
+ }
1158
+
1155
1159
  /*
1156
1160
  3.6 Source Code + figures
1157
1161
  */
1158
- .figure .SourceTitle,
1162
+ figure .SourceTitle,
1159
1163
  pre .SourceTitle,
1160
1164
  .pseudocode .SourceTitle {
1161
1165
  font-weight: 700;
1162
1166
  font-size: 1em;
1163
1167
  text-align: center;
1164
1168
  }
1165
- .figure,
1169
+ figure,
1166
1170
  pre,
1167
1171
  .pseudocode {
1168
1172
  background-color: #f5faff;
@@ -1198,7 +1202,7 @@ pre {
1198
1202
  text-align: left;
1199
1203
  }
1200
1204
 
1201
- .FigureTitle,
1205
+ figcaption,
1202
1206
  .SourceTitle {
1203
1207
  font-weight: 700;
1204
1208
  font-size: 1em;
@@ -1301,7 +1305,7 @@ table th {
1301
1305
  padding: 1em !important;
1302
1306
  }
1303
1307
 
1304
- p.TableTitle {
1308
+ table > caption {
1305
1309
  text-align: center;
1306
1310
  margin-top: 2.5em;
1307
1311
  font-weight: 800;
@@ -281,7 +281,7 @@ nav {
281
281
  }
282
282
  }
283
283
 
284
- div.figure > img, div.figure > svg {
284
+ figure > img, figure > svg {
285
285
  margin-left: auto;
286
286
  margin-right: auto;
287
287
  display: block;
@@ -289,7 +289,7 @@ div.figure > img, div.figure > svg {
289
289
  height: auto;
290
290
  }
291
291
 
292
- table div.figure {
292
+ table figure {
293
293
  padding: 0;
294
294
  margin: 0;
295
295
  }
@@ -524,11 +524,15 @@ p.NormRef, div.Biblio, div.NormRef {
524
524
  margin-left: 2em;
525
525
  }
526
526
 
527
+ .Biblio.note, .Biblio.Note, .NormRef.note, .NormRef.Note {
528
+ margin-left: 3.5em;
529
+ }
530
+
527
531
  /*
528
532
  3.6 Source Code + figures
529
533
  */
530
534
 
531
- .figure,
535
+ figure,
532
536
  pre,
533
537
  .pseudocode {
534
538
  @include pseudocodeBlock(#f5faff);
@@ -543,7 +547,7 @@ pre {
543
547
  @include recommendationBlock();
544
548
  @include listBlock();
545
549
 
546
- .FigureTitle,
550
+ figcaption,
547
551
  .SourceTitle {
548
552
  @include blockTitle()
549
553
  }
@@ -613,7 +617,7 @@ table {
613
617
  }
614
618
  }
615
619
 
616
- p.TableTitle {
620
+ table > caption {
617
621
  text-align: center;
618
622
  margin-top: 2.5em;
619
623
  font-weight: 800;
@@ -1859,15 +1859,14 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
1859
1859
 
1860
1860
  <xsl:template match="mn:indexsect"/>
1861
1861
  <xsl:template match="mn:indexsect" mode="index">
1862
-
1863
1862
  <fo:page-sequence master-reference="document" force-page-count="no-force">
1864
1863
  <xsl:call-template name="insertHeaderFooter"/>
1865
1864
  <fo:flow flow-name="xsl-region-body">
1866
1865
  <fo:block id="{@id}" span="all">
1867
- <xsl:apply-templates select="mn:title"/>
1866
+ <xsl:apply-templates select="mn:fmt-title"/>
1868
1867
  </fo:block>
1869
1868
  <fo:block role="Index">
1870
- <xsl:apply-templates select="*[not(self::mn:title)]"/>
1869
+ <xsl:apply-templates select="*[not(self::mn:fmt-title)]"/>
1871
1870
  </fo:block>
1872
1871
  </fo:flow>
1873
1872
  </fo:page-sequence>
@@ -3648,7 +3647,23 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
3648
3647
  <xsl:sort select="@displayorder" data-type="number"/>
3649
3648
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
3650
3649
  <xsl:attribute name="main_page_sequence"/>
3651
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3650
+
3651
+ <!-- from common <xsl:template name="index-pages"> -->
3652
+ <xsl:variable name="docid">
3653
+ <xsl:call-template name="getDocumentId"/>
3654
+ </xsl:variable>
3655
+
3656
+ <xsl:variable name="current_document_index_id">
3657
+ <xsl:apply-templates select="." mode="index_add_id">
3658
+ <xsl:with-param name="docid" select="$docid"/>
3659
+ </xsl:apply-templates>
3660
+ </xsl:variable>
3661
+ <xsl:variable name="current_document_index">
3662
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
3663
+ </xsl:variable>
3664
+
3665
+ <!-- xalan:nodeset($current_document_index) -->
3666
+ <xsl:apply-templates select="xalan:nodeset($current_document_index)" mode="update_xml_step_move_pagebreak"/>
3652
3667
  </xsl:element>
3653
3668
  </xsl:for-each>
3654
3669
  </xsl:template>
@@ -4705,6 +4720,7 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
4705
4720
 
4706
4721
  <xsl:attribute-set name="tt-style">
4707
4722
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4723
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4708
4724
  </xsl:attribute-set>
4709
4725
 
4710
4726
  <xsl:template name="refine_tt-style">
@@ -6477,6 +6493,11 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
6477
6493
  <!-- Display table's name before table as standalone block -->
6478
6494
  <!-- $namespace = 'iso' or -->
6479
6495
  <xsl:apply-templates select="mn:fmt-name"/> <!-- table's title rendered before table -->
6496
+ <xsl:if test="not(mn:fmt-name)"> <!-- for https://github.com/metanorma/mn-samples-jis/issues/75#issuecomment-3922169930 -->
6497
+ <xsl:apply-templates select="mn:name">
6498
+ <xsl:with-param name="process">true</xsl:with-param>
6499
+ </xsl:apply-templates>
6500
+ </xsl:if>
6480
6501
  <xsl:call-template name="table_name_fn_display"/>
6481
6502
 
6482
6503
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/mn:tr[1]/mn:td)"/>
@@ -6729,7 +6750,13 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
6729
6750
  </xsl:template>
6730
6751
 
6731
6752
  <!-- table/name-->
6732
- <xsl:template match="*[local-name()='table']/mn:fmt-name">
6753
+ <xsl:template match="mn:table[not(mn:fmt-name)]/mn:name"> <!-- for https://github.com/metanorma/mn-samples-jis/issues/75#issuecomment-3922169930 -->
6754
+ <xsl:param name="process">false</xsl:param>
6755
+ <xsl:if test="$process = 'true'">
6756
+ <xsl:call-template name="table_name"/>
6757
+ </xsl:if>
6758
+ </xsl:template>
6759
+ <xsl:template match="*[local-name()='table']/mn:fmt-name" name="table_name">
6733
6760
  <xsl:param name="continued"/>
6734
6761
  <xsl:param name="cols-count"/>
6735
6762
  <xsl:if test="normalize-space() != ''">
@@ -7221,12 +7248,14 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
7221
7248
  <xsl:param name="colwidths"/>
7222
7249
  <xsl:param name="colgroup"/>
7223
7250
 
7224
- <xsl:variable name="isNoteOrFnExist" select="../mn:note[not(@type = 'units')] or ../mn:example or ../mn:dl or ../mn:key or ..//mn:fn[not(parent::mn:fmt-name)] or ../mn:fmt-source or ../mn:p"/>
7251
+ <xsl:variable name="isNoteOrFnExist" select="../mn:note[not(@type = 'units')] or ../mn:example or ../mn:dl or ../mn:key or (..//mn:fn[not(parent::mn:fmt-name)] and not(ancestor::mn:table[1]//mn:tfoot//mn:fmt-footnote-container)) or ../mn:fmt-source or ../mn:p"/>
7252
+ <!-- in JIS fmt-footnote-container renders in tfoot, so no need render fn in the separate table -->
7225
7253
 
7226
- <xsl:variable name="isNoteOrFnExistShowAfterTable">
7254
+ <xsl:variable name="isNoteOrFnExistShowAfterTable_">
7227
7255
  </xsl:variable>
7256
+ <xsl:variable name="isNoteOrFnExistShowAfterTable" select="normalize-space($isNoteOrFnExistShowAfterTable_)"/>
7228
7257
 
7229
- <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
7258
+ <xsl:if test="$isNoteOrFnExist = 'true' or $isNoteOrFnExistShowAfterTable = 'true'">
7230
7259
 
7231
7260
  <xsl:variable name="cols-count">
7232
7261
  <xsl:choose>
@@ -12853,10 +12882,22 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
12853
12882
  <!-- End Highlight syntax styles -->
12854
12883
 
12855
12884
  <!-- Index section styles -->
12885
+
12886
+ <xsl:attribute-set name="indexsect-region-body-style">
12887
+ <xsl:attribute name="column-count">2</xsl:attribute>
12888
+ <xsl:attribute name="column-gap">10mm</xsl:attribute>
12889
+ </xsl:attribute-set>
12890
+
12891
+ <xsl:attribute-set name="indexsect-title-block-style">
12892
+ <xsl:attribute name="role">SKIP</xsl:attribute>
12893
+ <xsl:attribute name="span">all</xsl:attribute>
12894
+ </xsl:attribute-set>
12895
+
12856
12896
  <xsl:attribute-set name="indexsect-title-style">
12857
12897
  <xsl:attribute name="role">H1</xsl:attribute>
12858
- <xsl:attribute name="font-size">12pt</xsl:attribute>
12859
12898
  <xsl:attribute name="font-weight">bold</xsl:attribute>
12899
+ <xsl:attribute name="margin-bottom">24pt</xsl:attribute>
12900
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
12860
12901
  <xsl:attribute name="margin-bottom">84pt</xsl:attribute>
12861
12902
  </xsl:attribute-set> <!-- indexsect-title-style -->
12862
12903
 
@@ -12886,6 +12927,27 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
12886
12927
  </xsl:for-each>
12887
12928
  </xsl:variable>
12888
12929
 
12930
+ <xsl:template name="index-pages">
12931
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
12932
+
12933
+ <xsl:variable name="docid">
12934
+ <xsl:call-template name="getDocumentId"/>
12935
+ </xsl:variable>
12936
+
12937
+ <xsl:variable name="current_document_index_id">
12938
+ <xsl:apply-templates select="//mn:indexsect" mode="index_add_id">
12939
+ <xsl:with-param name="docid" select="$docid"/>
12940
+ </xsl:apply-templates>
12941
+ </xsl:variable>
12942
+ <xsl:variable name="current_document_index">
12943
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
12944
+ </xsl:variable>
12945
+
12946
+ <xsl:apply-templates select="xalan:nodeset($current_document_index)" mode="index">
12947
+ <xsl:with-param name="num" select="$num"/>
12948
+ </xsl:apply-templates>
12949
+ </xsl:template>
12950
+
12889
12951
  <xsl:template match="@*|node()" mode="index_add_id">
12890
12952
  <xsl:param name="docid"/>
12891
12953
  <xsl:copy>
@@ -12938,7 +13000,7 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
12938
13000
  <xsl:template match="mn:indexsect//mn:li" mode="index_update">
12939
13001
  <xsl:copy>
12940
13002
  <xsl:apply-templates select="@*" mode="index_update"/>
12941
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)][1]" mode="process_li_element"/>
13003
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)][1]" mode="process_li_element"/>
12942
13004
  </xsl:copy>
12943
13005
  </xsl:template>
12944
13006
 
@@ -13146,11 +13208,24 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13146
13208
  <!-- End of Index processing -->
13147
13209
  <!-- =================== -->
13148
13210
 
13149
- <!-- =================== -->
13211
+ <xsl:attribute-set name="form-checkbox-style">
13212
+ <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
13213
+ <xsl:attribute name="background-color">yellow</xsl:attribute>
13214
+ </xsl:attribute-set>
13215
+
13216
+ <xsl:variable name="METANORMA_FORM_START_PREFIX">_metanorma_form_start</xsl:variable>
13217
+ <xsl:variable name="METANORMA_FORM_ITEM_PREFIX">_metanorma_form_item_</xsl:variable>
13218
+ <xsl:variable name="METANORMA_FORM_ITEM_BORDER">1pt solid black</xsl:variable>
13219
+
13220
+ <!-- =================== -->
13150
13221
  <!-- Form's elements processing -->
13151
13222
  <!-- =================== -->
13152
13223
  <xsl:template match="mn:form">
13153
13224
  <fo:block>
13225
+ <fo:inline>
13226
+ <xsl:attribute name="id"><xsl:value-of select="concat($METANORMA_FORM_START_PREFIX, '___', @id, '___', @name)"/></xsl:attribute>
13227
+ <xsl:value-of select="$hair_space"/>
13228
+ </fo:inline>
13154
13229
  <xsl:apply-templates/>
13155
13230
  </fo:block>
13156
13231
  </xsl:template>
@@ -13159,7 +13234,23 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13159
13234
  <fo:inline><xsl:apply-templates/></fo:inline>
13160
13235
  </xsl:template>
13161
13236
 
13162
- <xsl:template match="mn:form//mn:input[@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
13237
+ <xsl:template match="mn:form//mn:input[@type = 'text']">
13238
+ <!-- add helper id for mn2pdf class FOPIFFormsHandler (_metanorma_form_item_border_) -->
13239
+ <fo:inline>
13240
+ <xsl:call-template name="set_id_metanorma_form_item">
13241
+ <xsl:with-param name="add_border_prefix">true</xsl:with-param>
13242
+ </xsl:call-template>
13243
+ <xsl:value-of select="$hair_space"/>
13244
+ </fo:inline>
13245
+ <fo:inline border="{$METANORMA_FORM_ITEM_BORDER}"><!-- don't remove, this border needs for mn2pdf FOPIFFormsHandler -->
13246
+ <fo:inline>
13247
+ <xsl:call-template name="set_id_metanorma_form_item"/>
13248
+ <xsl:call-template name="text_input"/>
13249
+ </fo:inline>
13250
+ </fo:inline>
13251
+ </xsl:template>
13252
+
13253
+ <xsl:template match="mn:form//mn:input[@type = 'date' or @type = 'file' or @type = 'password']">
13163
13254
  <fo:inline>
13164
13255
  <xsl:call-template name="text_input"/>
13165
13256
  </fo:inline>
@@ -13191,7 +13282,20 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13191
13282
  </xsl:template>
13192
13283
 
13193
13284
  <xsl:template match="mn:form//mn:input[@type = 'checkbox']">
13194
- <fo:inline padding-right="1mm">
13285
+ <xsl:variable name="form_item_type">checkbox</xsl:variable>
13286
+ <!-- add helper id for mn2pdf class FOPIFFormsHandler (_metanorma_form_item_border_) -->
13287
+ <fo:inline>
13288
+ <xsl:call-template name="set_id_metanorma_form_item">
13289
+ <xsl:with-param name="form_item_type" select="$form_item_type"/>
13290
+ <xsl:with-param name="add_border_prefix">true</xsl:with-param>
13291
+ </xsl:call-template>
13292
+ <xsl:value-of select="$hair_space"/>
13293
+ </fo:inline>
13294
+
13295
+ <fo:inline border="{$METANORMA_FORM_ITEM_BORDER}"><!-- don't remove 'border', this border needs for mn2pdf FOPIFFormsHandler -->
13296
+ <xsl:call-template name="set_id_metanorma_form_item">
13297
+ <xsl:with-param name="form_item_type" select="$form_item_type"/>
13298
+ </xsl:call-template>
13195
13299
  <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
13196
13300
  <xsl:attribute name="height">3.5mm</xsl:attribute>
13197
13301
  <xsl:attribute name="content-width">100%</xsl:attribute>
@@ -13201,11 +13305,24 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13201
13305
  <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
13202
13306
  </svg>
13203
13307
  </fo:instream-foreign-object>
13204
- </fo:inline>
13308
+ </fo:inline><fo:inline padding-right="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13205
13309
  </xsl:template>
13206
13310
 
13207
13311
  <xsl:template match="mn:form//mn:input[@type = 'radio']">
13208
- <fo:inline padding-right="1mm">
13312
+ <xsl:variable name="form_item_type">radiobutton</xsl:variable>
13313
+ <!-- add helper id for mn2pdf class FOPIFFormsHandler (_metanorma_form_item_border_) -->
13314
+ <fo:inline>
13315
+ <xsl:call-template name="set_id_metanorma_form_item">
13316
+ <xsl:with-param name="form_item_type" select="$form_item_type"/>
13317
+ <xsl:with-param name="add_border_prefix">true</xsl:with-param>
13318
+ </xsl:call-template>
13319
+ <xsl:value-of select="$hair_space"/>
13320
+ </fo:inline>
13321
+
13322
+ <fo:inline border="{$METANORMA_FORM_ITEM_BORDER}"><!-- don't remove 'border', this border needs for mn2pdf FOPIFFormsHandler -->
13323
+ <xsl:call-template name="set_id_metanorma_form_item">
13324
+ <xsl:with-param name="form_item_type" select="$form_item_type"/>
13325
+ </xsl:call-template>
13209
13326
  <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
13210
13327
  <xsl:attribute name="height">3.5mm</xsl:attribute>
13211
13328
  <xsl:attribute name="content-width">100%</xsl:attribute>
@@ -13217,6 +13334,7 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13217
13334
  </svg>
13218
13335
  </fo:instream-foreign-object>
13219
13336
  </fo:inline>
13337
+ <fo:inline padding-right="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13220
13338
  </xsl:template>
13221
13339
 
13222
13340
  <xsl:template match="mn:form//mn:select">
@@ -13226,11 +13344,28 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13226
13344
  </xsl:template>
13227
13345
 
13228
13346
  <xsl:template match="mn:form//mn:textarea">
13229
- <fo:block-container border="1pt solid black" width="50%">
13347
+ <fo:block-container border="{$METANORMA_FORM_ITEM_BORDER}" width="50%">
13230
13348
  <fo:block> </fo:block>
13231
13349
  </fo:block-container>
13232
13350
  </xsl:template>
13233
13351
 
13352
+ <xsl:template name="set_id_metanorma_form_item">
13353
+ <xsl:param name="form_item_type">textfield</xsl:param>
13354
+ <xsl:param name="add_border_prefix">false</xsl:param>
13355
+ <xsl:variable name="border_prefix"><xsl:if test="normalize-space($add_border_prefix) = 'true'">border_</xsl:if></xsl:variable>
13356
+ <xsl:if test="@id">
13357
+ <!-- _metanorma_form_item_border____form_item_type___id___name___value -->
13358
+ <!-- split by '___': [2] - form_item_type, [3] - id, [4] - name, [5] - value -->
13359
+ <xsl:variable name="value">
13360
+ <xsl:choose>
13361
+ <xsl:when test="@type = 'checkbox'"><xsl:value-of select="normalize-space(@checked = 'true')"/><!-- true or false --></xsl:when>
13362
+ <xsl:otherwise><xsl:value-of select="@value"/></xsl:otherwise>
13363
+ </xsl:choose>
13364
+ </xsl:variable>
13365
+ <xsl:attribute name="id"><xsl:value-of select="concat($METANORMA_FORM_ITEM_PREFIX, $border_prefix, '___', $form_item_type, '___', @id, '___', @name, '___', $value)"/></xsl:attribute>
13366
+ </xsl:if>
13367
+ </xsl:template>
13368
+
13234
13369
  <!-- =================== -->
13235
13370
  <!-- End Form's elements processing -->
13236
13371
  <!-- =================== -->
@@ -13310,6 +13445,7 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
13310
13445
  </xsl:template>
13311
13446
 
13312
13447
  <xsl:attribute-set name="toc-pagenumber-style">
13448
+ <xsl:attribute name="role">SKIP</xsl:attribute>
13313
13449
  </xsl:attribute-set>
13314
13450
 
13315
13451
  <xsl:template name="refine_toc-pagenumber-style">
@@ -15187,7 +15323,12 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
15187
15323
  <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
15188
15324
  <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
15189
15325
  <xsl:choose>
15190
- <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
15326
+ <xsl:when test="$internal-destination = 'true'">
15327
+ <fo:wrapper role="Reference">
15328
+ <xsl:copy-of select="$element_node"/>
15329
+ </fo:wrapper>
15330
+ </xsl:when>
15331
+ <xsl:when test="$external-destination = 'true'">
15191
15332
  <xsl:copy-of select="$element_node"/>
15192
15333
  </xsl:when>
15193
15334
  <xsl:otherwise>
@@ -208,11 +208,15 @@ Applicable to modify and delete</a:documentation>
208
208
  </zeroOrMore>
209
209
  <optional>
210
210
  <element name="newcontent">
211
- <a:documentation>New content to be added to the document; applicable to add and modify</a:documentation>
211
+ <a:documentation>New content to be added to the document; applicable to add and modify.
212
+ Can be blocks and/or sections</a:documentation>
212
213
  <ref name="OptionalId"/>
213
214
  <zeroOrMore>
214
215
  <ref name="BasicBlock"/>
215
216
  </zeroOrMore>
217
+ <zeroOrMore>
218
+ <ref name="section"/>
219
+ </zeroOrMore>
216
220
  </element>
217
221
  </optional>
218
222
  <zeroOrMore>
@@ -0,0 +1,100 @@
1
+ module Metanorma
2
+ module Iec
3
+ class Cleanup < ::Metanorma::Iso::Cleanup
4
+ extend Forwardable
5
+ def copied_instance_variables
6
+ super + %i[is_iev]
7
+ end
8
+
9
+ def boilerplate_file(x_orig)
10
+ lang = case x_orig&.at("//bibdata/language")&.text
11
+ when "fr" then "fr"
12
+ else
13
+ "en"
14
+ end
15
+ File.join(@libdir, "boilerplate-#{lang}.adoc")
16
+ end
17
+
18
+ def term_defs_boilerplate(div, source, term, preface, isodoc)
19
+ super unless @is_iev
20
+ end
21
+
22
+ def terms_terms_cleanup(xmldoc)
23
+ @is_iev and return
24
+ super
25
+ end
26
+
27
+ def sections_names_pref_cleanup(xml)
28
+ super
29
+ @is_iev and replace_title(xml, "//introduction",
30
+ @i18n&.introduction_iev)
31
+ end
32
+
33
+ # preserve ol/@type within boilerplate, not elsewhere in doc
34
+ def ol_cleanup(doc)
35
+ doc.xpath("//ol[@type]").each { |x| x.delete("type") }
36
+ if doc.at("//metanorma-extension/semantic-metadata/" \
37
+ "headless[text() = 'true']")
38
+ doc.xpath("//ol[@explicit-type]").each do |x|
39
+ x["type"] = x["explicit-type"]
40
+ x.delete("explicit-type")
41
+ end
42
+ end
43
+ ::Metanorma::Standoc::Cleanup.instance_method(:ol_cleanup).bind(self)
44
+ .call(doc)
45
+ end
46
+
47
+ def note_cleanup(xmldoc)
48
+ super
49
+ n = xmldoc.at("//tc-sc-officers-note") and
50
+ xmldoc.at("//bibdata/ext").add_child(n.remove)
51
+ end
52
+
53
+ def toc_cleanup(xmldoc)
54
+ toc_iev_cleanup(xmldoc) if @is_iev
55
+ super
56
+ end
57
+
58
+ def toc_iev_cleanup(xmldoc)
59
+ iev_variant_titles(xmldoc)
60
+ end
61
+
62
+ def iev_variant_titles(xmldoc)
63
+ id = xmldoc&.at("//bibdata/docidentifier[@type = 'ISO']")&.text
64
+ m = /60050-(\d+)/.match(id) or return
65
+ xmldoc.xpath("//sections/clause/terms/title").each_with_index do |t, i|
66
+ num = "%02d" % [i + 1]
67
+ t.next = "<variant-title #{add_id_text} type='toc'>" \
68
+ "#{@i18n.section_iev} #{m[1]}-#{num} &#x2013; " \
69
+ "#{t.children.to_xml}</variant-title>"
70
+ end
71
+ end
72
+
73
+ def docidentifier_cleanup(xmldoc)
74
+ prefix = get_id_prefix(xmldoc)
75
+ id = xmldoc.at("//bibdata/docidentifier[@type = 'ISO']") or return
76
+ id.content = id_prefix(prefix, id)
77
+ id = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") and
78
+ id.content = id_prefix(prefix, id)
79
+ %w(iso-with-lang iso-reference iso-undated).each do |t|
80
+ id = xmldoc.at("//bibdata/docidentifier[@type = '#{t}']") and
81
+ id.content = id_prefix(prefix, id)
82
+ end
83
+ end
84
+
85
+ # TODO remove when I adopt pubid-iec
86
+ def get_id_prefix(xmldoc)
87
+ xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
88
+ "/organization").each_with_object([]) do |x, prefix|
89
+ x1 = x.at("abbreviation")&.text || x.at("name")&.text
90
+ # (x1 == "IEC" and prefix.unshift("IEC")) or prefix << x1
91
+ prefix << x1
92
+ end
93
+ end
94
+
95
+ def id_prefix(_prefix, id)
96
+ id.text
97
+ end
98
+ end
99
+ end
100
+ end
@@ -16,34 +16,6 @@ module Metanorma
16
16
  end
17
17
  end
18
18
 
19
- def boilerplate_file(x_orig)
20
- lang = case x_orig&.at("//bibdata/language")&.text
21
- when "fr" then "fr"
22
- else
23
- "en"
24
- end
25
- File.join(@libdir, "boilerplate-#{lang}.adoc")
26
- end
27
-
28
- def id_prefix(_prefix, id)
29
- id.text
30
- end
31
-
32
- def doctype_validate(xmldoc)
33
- %w(international-standard technical-specification technical-report
34
- publicly-available-specification international-workshop-agreement
35
- guide interpretation-sheet).include? @doctype or
36
- @log.add("IEC_2", nil, params: [@doctype])
37
- if function = xmldoc.at("//bibdata/ext/function")&.text
38
- %w(emc quality-assurance safety environment).include? function or
39
- @log.add("IEC_3", nil, params: [function])
40
- end
41
- end
42
-
43
- def schema_file
44
- "iec.rng"
45
- end
46
-
47
19
  def html_converter(node)
48
20
  if node.nil?
49
21
  IsoDoc::Iec::HtmlConvert.new({})
@@ -77,39 +49,10 @@ module Metanorma
77
49
  IsoDoc::Iec::PresentationXMLConvert
78
50
  .new(doc_extract_attributes(node)
79
51
  .merge(output_formats: ::Metanorma::Iec::Processor
80
- .new.output_formats))
52
+ .new.output_formats))
81
53
  end
82
54
  end
83
55
 
84
- def term_defs_boilerplate(div, source, term, preface, isodoc)
85
- super unless @is_iev
86
- end
87
-
88
- def terms_terms_cleanup(xmldoc)
89
- @is_iev and return
90
- super
91
- end
92
-
93
- def sections_names_pref_cleanup(xml)
94
- super
95
- @is_iev and replace_title(xml, "//introduction",
96
- @i18n&.introduction_iev)
97
- end
98
-
99
- # preserve ol/@type within boilerplate, not elsewhere in doc
100
- def ol_cleanup(doc)
101
- doc.xpath("//ol[@type]").each { |x| x.delete("type") }
102
- if doc.at("//metanorma-extension/semantic-metadata/" \
103
- "headless[text() = 'true']")
104
- doc.xpath("//ol[@explicit-type]").each do |x|
105
- x["type"] = x["explicit-type"]
106
- x.delete("explicit-type")
107
- end
108
- end
109
- ::Metanorma::Standoc::Converter.instance_method(:ol_cleanup).bind(self)
110
- .call(doc)
111
- end
112
-
113
56
  def note(note)
114
57
  if note.title == "Note from TC/SC Officers"
115
58
  noko do |xml|
@@ -122,59 +65,9 @@ module Metanorma
122
65
  end
123
66
  end
124
67
 
125
- def note_cleanup(xmldoc)
126
- super
127
- n = xmldoc.at("//tc-sc-officers-note") and
128
- xmldoc.at("//bibdata/ext").add_child(n.remove)
129
- end
130
-
131
- def image_name_validate(xmldoc); end
132
-
133
- def toc_cleanup(xmldoc)
134
- toc_iev_cleanup(xmldoc) if @is_iev
135
- super
136
- end
137
-
138
- def toc_iev_cleanup(xmldoc)
139
- iev_variant_titles(xmldoc)
140
- end
141
-
142
- def iev_variant_titles(xmldoc)
143
- id = xmldoc&.at("//bibdata/docidentifier[@type = 'ISO']")&.text
144
- m = /60050-(\d+)/.match(id) or return
145
- xmldoc.xpath("//sections/clause/terms/title").each_with_index do |t, i|
146
- num = "%02d" % [i + 1]
147
- t.next = "<variant-title #{add_id_text} type='toc'>" \
148
- "#{@i18n.section_iev} #{m[1]}-#{num} &#x2013; " \
149
- "#{t.children.to_xml}</variant-title>"
150
- end
151
- end
152
-
153
- # TODO remove when I adopt pubid-iec
154
- def get_id_prefix(xmldoc)
155
- xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
156
- "/organization").each_with_object([]) do |x, prefix|
157
- x1 = x.at("abbreviation")&.text || x.at("name")&.text
158
- # (x1 == "IEC" and prefix.unshift("IEC")) or prefix << x1
159
- prefix << x1
160
- end
161
- end
162
-
163
68
  def document_scheme(node)
164
69
  node.attr("document-scheme")
165
70
  end
166
-
167
- def docidentifier_cleanup(xmldoc)
168
- prefix = get_id_prefix(xmldoc)
169
- id = xmldoc.at("//bibdata/docidentifier[@type = 'ISO']") or return
170
- id.content = id_prefix(prefix, id)
171
- id = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") and
172
- id.content = id_prefix(prefix, id)
173
- %w(iso-with-lang iso-reference iso-undated).each do |t|
174
- id = xmldoc.at("//bibdata/docidentifier[@type = '#{t}']") and
175
- id.content = id_prefix(prefix, id)
176
- end
177
- end
178
71
  end
179
72
  end
180
73
  end
@@ -0,0 +1,24 @@
1
+ module Metanorma
2
+ module Iec
3
+ class Validate < ::Metanorma::Iso::Validate
4
+ extend Forwardable
5
+
6
+ def doctype_validate(xmldoc)
7
+ %w(international-standard technical-specification technical-report
8
+ publicly-available-specification international-workshop-agreement
9
+ guide interpretation-sheet).include? @doctype or
10
+ @log.add("IEC_2", nil, params: [@doctype])
11
+ if function = xmldoc.at("//bibdata/ext/function")&.text
12
+ %w(emc quality-assurance safety environment).include? function or
13
+ @log.add("IEC_3", nil, params: [function])
14
+ end
15
+ end
16
+
17
+ def schema_file
18
+ "iec.rng"
19
+ end
20
+
21
+ def image_name_validate(xmldoc); end
22
+ end
23
+ end
24
+ end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.8.0".freeze
3
+ VERSION = "2.8.1".freeze
4
4
  end
5
5
  end
6
6
 
data/lib/metanorma-iec.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "metanorma/iec/converter"
3
+ require_relative "metanorma/iec/cleanup"
4
+ require_relative "metanorma/iec/validate"
3
5
  require_relative "metanorma/iec/version"
4
6
  require "isodoc/iec/html_convert"
5
7
  require "isodoc/iec/word_convert"
@@ -27,12 +27,13 @@ Gem::Specification.new do |spec|
27
27
  f.match(%r{^(test|spec|features|bin|.github)/}) \
28
28
  || f.match(%r{Rakefile|bin/rspec})
29
29
  end
30
- spec.test_files = `git ls-files -- {spec}/*`.split("\n")
30
+ spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
32
32
 
33
- spec.add_dependency "metanorma-iso", "~> 3.3.0"
33
+ spec.add_dependency "metanorma-iso", "~> 3.3.1"
34
34
  spec.add_dependency "pubid"
35
35
 
36
+ spec.add_development_dependency "canon", "= 0.1.3"
36
37
  spec.add_development_dependency "debug"
37
38
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
38
39
  spec.add_development_dependency "guard", "~> 2.14"
@@ -41,10 +42,9 @@ Gem::Specification.new do |spec|
41
42
  spec.add_development_dependency "rake", "~> 13.0"
42
43
  spec.add_development_dependency "rspec", "~> 3.6"
43
44
  spec.add_development_dependency "rubocop", "~> 1"
44
- spec.add_development_dependency "rubocop-performance"
45
+ spec.add_development_dependency "rubocop-performance"
45
46
  spec.add_development_dependency "sassc-embedded", "~> 1"
46
47
  spec.add_development_dependency "simplecov", "~> 0.15"
47
48
  spec.add_development_dependency "timecop", "~> 0.9"
48
- spec.add_development_dependency "canon", "= 0.1.3"
49
49
  # spec.metadata["rubygems_mfa_required"] = "true"
50
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-16 00:00:00.000000000 Z
11
+ date: 2026-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0
19
+ version: 3.3.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: 3.3.0
26
+ version: 3.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: canon
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.3
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: debug
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -206,20 +220,6 @@ dependencies:
206
220
  - - "~>"
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0.9'
209
- - !ruby/object:Gem::Dependency
210
- name: canon
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - '='
214
- - !ruby/object:Gem::Version
215
- version: 0.1.3
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - '='
221
- - !ruby/object:Gem::Version
222
- version: 0.1.3
223
223
  description: |
224
224
  metanorma-iec lets you write IEC standards in AsciiDoc syntax.
225
225
 
@@ -270,6 +270,7 @@ files:
270
270
  - lib/metanorma/iec/biblio.rng
271
271
  - lib/metanorma/iec/boilerplate-en.adoc
272
272
  - lib/metanorma/iec/boilerplate-fr.adoc
273
+ - lib/metanorma/iec/cleanup.rb
273
274
  - lib/metanorma/iec/converter.rb
274
275
  - lib/metanorma/iec/front.rb
275
276
  - lib/metanorma/iec/iec.rng
@@ -279,6 +280,7 @@ files:
279
280
  - lib/metanorma/iec/processor.rb
280
281
  - lib/metanorma/iec/relaton-iec.rng
281
282
  - lib/metanorma/iec/reqt.rng
283
+ - lib/metanorma/iec/validate.rb
282
284
  - lib/metanorma/iec/version.rb
283
285
  - lib/relaton/render-iec/config.yml
284
286
  - lib/relaton/render-iec/general.rb