metanorma-iso 1.10.6 → 2.0.0

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +26 -0
  3. data/Makefile +1 -1
  4. data/lib/asciidoctor/iso/base.rb +2 -69
  5. data/lib/asciidoctor/iso/cleanup.rb +2 -175
  6. data/lib/asciidoctor/iso/converter.rb +2 -17
  7. data/lib/asciidoctor/iso/deprecated.rb +5 -0
  8. data/lib/asciidoctor/iso/front.rb +2 -169
  9. data/lib/asciidoctor/iso/front_id.rb +2 -224
  10. data/lib/asciidoctor/iso/section.rb +2 -48
  11. data/lib/asciidoctor/iso/validate.rb +2 -171
  12. data/lib/asciidoctor/iso/validate_image.rb +2 -96
  13. data/lib/asciidoctor/iso/validate_requirements.rb +2 -110
  14. data/lib/asciidoctor/iso/validate_section.rb +2 -246
  15. data/lib/asciidoctor/iso/validate_style.rb +2 -169
  16. data/lib/asciidoctor/iso/validate_title.rb +2 -104
  17. data/lib/isodoc/iso/html/htmlstyle.css +47 -0
  18. data/lib/isodoc/iso/html/isodoc.css +1327 -0
  19. data/lib/isodoc/iso/html/style-human.css +1010 -0
  20. data/lib/isodoc/iso/html/style-iso.css +1036 -0
  21. data/lib/isodoc/iso/html/wordstyle.css +1701 -0
  22. data/lib/isodoc/iso/html_convert.rb +6 -4
  23. data/lib/isodoc/iso/iso.amendment.xsl +96 -154
  24. data/lib/isodoc/iso/iso.international-standard.xsl +96 -154
  25. data/lib/metanorma/iso/base.rb +70 -0
  26. data/lib/{asciidoctor → metanorma}/iso/basicdoc.rng +0 -0
  27. data/lib/{asciidoctor → metanorma}/iso/biblio.rng +0 -0
  28. data/lib/{asciidoctor → metanorma}/iso/boilerplate-fr.xml +0 -0
  29. data/lib/{asciidoctor → metanorma}/iso/boilerplate.xml +0 -0
  30. data/lib/metanorma/iso/cleanup.rb +176 -0
  31. data/lib/metanorma/iso/converter.rb +18 -0
  32. data/lib/metanorma/iso/front.rb +170 -0
  33. data/lib/metanorma/iso/front_id.rb +225 -0
  34. data/lib/{asciidoctor → metanorma}/iso/isodoc.rng +29 -0
  35. data/lib/{asciidoctor → metanorma}/iso/isostandard-amd.rng +0 -0
  36. data/lib/{asciidoctor → metanorma}/iso/isostandard.rnc +0 -0
  37. data/lib/{asciidoctor → metanorma}/iso/isostandard.rng +0 -0
  38. data/lib/{asciidoctor → metanorma}/iso/reqt.rng +0 -0
  39. data/lib/metanorma/iso/section.rb +49 -0
  40. data/lib/metanorma/iso/validate.rb +172 -0
  41. data/lib/metanorma/iso/validate_image.rb +97 -0
  42. data/lib/metanorma/iso/validate_requirements.rb +111 -0
  43. data/lib/metanorma/iso/validate_section.rb +247 -0
  44. data/lib/metanorma/iso/validate_style.rb +170 -0
  45. data/lib/metanorma/iso/validate_title.rb +105 -0
  46. data/lib/metanorma/iso/version.rb +1 -1
  47. data/lib/metanorma-iso.rb +1 -1
  48. data/metanorma-iso.gemspec +1 -1
  49. data/spec/isodoc/ref_spec.rb +4 -2
  50. data/spec/{asciidoctor → metanorma}/amd_spec.rb +1 -1
  51. data/spec/{asciidoctor → metanorma}/base_spec.rb +1 -1
  52. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  53. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
  54. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +1 -1
  55. data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
  56. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  57. data/spec/{asciidoctor → metanorma}/refs_spec.rb +1 -1
  58. data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
  59. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  60. data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
  61. data/spec/spec_helper.rb +1 -1
  62. metadata +46 -28
@@ -457,14 +457,6 @@
457
457
  <fo:block-container>
458
458
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
459
459
  <xsl:value-of select="$stage-fullname-uppercased"/>
460
- <!-- <xsl:if test="$doctype = 'amendment'">
461
- <xsl:variable name="title-amendment">
462
- <xsl:call-template name="getTitle">
463
- <xsl:with-param name="name" select="'title-amendment'"/>
464
- </xsl:call-template>
465
- </xsl:variable>
466
- <xsl:text> </xsl:text><xsl:value-of select="$title-amendment"/>
467
- </xsl:if> -->
468
460
  </fo:block>
469
461
  <fo:block font-size="20pt" font-weight="bold" text-align="right">
470
462
  <xsl:value-of select="$docidentifierISO"/>
@@ -655,12 +647,8 @@
655
647
  <xsl:if test="$doctype = 'amendment'">
656
648
  <fo:block text-align="right" margin-right="0.5mm">
657
649
  <fo:block font-weight="bold" margin-top="4pt" role="H1">
658
- <xsl:variable name="title-amendment">
659
- <xsl:call-template name="getTitle">
660
- <xsl:with-param name="name" select="'title-amendment'"/>
661
- </xsl:call-template>
662
- </xsl:variable>
663
- <xsl:value-of select="$title-amendment"/><xsl:text> </xsl:text>
650
+ <xsl:value-of select="$doctype_uppercased"/>
651
+ <xsl:text> </xsl:text>
664
652
  <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
665
653
  <xsl:if test="normalize-space($amendment-number) != ''">
666
654
  <xsl:value-of select="$amendment-number"/><xsl:text> </xsl:text>
@@ -1193,8 +1181,13 @@
1193
1181
  <xsl:if test="normalize-space($title-part-doc-lang) != ''">
1194
1182
  <xsl:if test="$part != ''">
1195
1183
  <xsl:text> — </xsl:text>
1196
- <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1197
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$lang]),'#',$part)"/>
1184
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1185
+ <xsl:call-template name="getLocalizedString">
1186
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1187
+ </xsl:call-template>
1188
+ <xsl:text> </xsl:text>
1189
+ <xsl:value-of select="$part"/>
1190
+ <xsl:text>:</xsl:text>
1198
1191
  <!-- <xsl:value-of select="$title-part-en"/>
1199
1192
  <xsl:value-of select="$part"/>
1200
1193
  <xsl:text>:</xsl:text> -->
@@ -1334,12 +1327,7 @@
1334
1327
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1335
1328
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1336
1329
  <fo:block font-weight="normal" line-height="1.1">
1337
- <xsl:variable name="title-amendment">
1338
- <xsl:call-template name="getTitle">
1339
- <xsl:with-param name="name" select="'title-amendment'"/>
1340
- </xsl:call-template>
1341
- </xsl:variable>
1342
- <xsl:value-of select="$title-amendment"/>
1330
+ <xsl:value-of select="$doctype_uppercased"/>
1343
1331
  <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1344
1332
  <xsl:if test="normalize-space($amendment-number) != ''">
1345
1333
  <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
@@ -2122,13 +2110,6 @@
2122
2110
 
2123
2111
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2124
2112
 
2125
- <title-annex lang="en">Annex </title-annex>
2126
- <title-annex lang="fr">Annexe </title-annex>
2127
-
2128
- <title-annex lang="zh">Annex </title-annex>
2129
-
2130
-
2131
-
2132
2113
  <title-edition lang="en">
2133
2114
 
2134
2115
  <xsl:text>Edition </xsl:text>
@@ -2142,33 +2123,18 @@
2142
2123
 
2143
2124
  </title-edition>
2144
2125
 
2145
-
2126
+
2127
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2146
2128
  <title-toc lang="en">
2147
2129
 
2148
- <xsl:text>Contents</xsl:text>
2149
-
2150
2130
 
2151
2131
 
2152
2132
  </title-toc>
2153
2133
  <title-toc lang="fr">
2154
2134
 
2155
- <xsl:text>Sommaire</xsl:text>
2156
-
2157
-
2158
- </title-toc>
2159
-
2160
- <title-toc lang="zh">Contents</title-toc>
2161
-
2162
-
2135
+ </title-toc>
2163
2136
 
2164
- <title-page lang="en">Page</title-page>
2165
- <title-page lang="fr">Page</title-page>
2166
2137
 
2167
- <title-key lang="en">Key</title-key>
2168
- <title-key lang="fr">Légende</title-key>
2169
-
2170
- <title-where lang="en">where</title-where>
2171
- <title-where lang="fr">où</title-where>
2172
2138
 
2173
2139
  <title-descriptors lang="en">Descriptors</title-descriptors>
2174
2140
 
@@ -2195,25 +2161,6 @@
2195
2161
 
2196
2162
  </title-subpart>
2197
2163
 
2198
- <title-modified lang="en">modified</title-modified>
2199
- <title-modified lang="fr">modifiée</title-modified>
2200
-
2201
- <title-modified lang="zh">modified</title-modified>
2202
-
2203
-
2204
-
2205
- <title-source lang="en">
2206
-
2207
- <xsl:text>SOURCE</xsl:text>
2208
-
2209
-
2210
- </title-source>
2211
-
2212
- <title-keywords lang="en">Keywords</title-keywords>
2213
-
2214
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2215
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2216
-
2217
2164
  <title-list-tables lang="en">List of Tables</title-list-tables>
2218
2165
 
2219
2166
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2222,37 +2169,8 @@
2222
2169
 
2223
2170
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2224
2171
 
2225
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2226
-
2227
- <title-abstract lang="en">Abstract</title-abstract>
2228
-
2229
2172
  <title-summary lang="en">Summary</title-summary>
2230
2173
 
2231
- <title-in lang="en">in </title-in>
2232
-
2233
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2234
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2235
-
2236
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2237
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2238
-
2239
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2240
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2241
-
2242
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2243
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2244
-
2245
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2246
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2247
-
2248
- <title-caution lang="en">CAUTION</title-caution>
2249
- <title-caution lang="zh">注意</title-caution>
2250
-
2251
- <title-warning lang="en">WARNING</title-warning>
2252
- <title-warning lang="zh">警告</title-warning>
2253
-
2254
- <title-amendment lang="en">AMENDMENT</title-amendment>
2255
-
2256
2174
  <title-continued lang="en">(continued)</title-continued>
2257
2175
  <title-continued lang="fr">(continué)</title-continued>
2258
2176
 
@@ -2367,16 +2285,18 @@
2367
2285
 
2368
2286
 
2369
2287
 
2288
+
2370
2289
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2371
2290
 
2372
2291
 
2373
2292
 
2293
+
2374
2294
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2295
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2375
2296
 
2376
2297
 
2377
2298
 
2378
2299
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2379
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2380
2300
 
2381
2301
 
2382
2302
 
@@ -2402,6 +2322,7 @@
2402
2322
 
2403
2323
 
2404
2324
 
2325
+
2405
2326
  <xsl:attribute name="text-align">justify</xsl:attribute>
2406
2327
 
2407
2328
 
@@ -2768,7 +2689,7 @@
2768
2689
 
2769
2690
 
2770
2691
 
2771
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
2692
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
2772
2693
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2773
2694
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2774
2695
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4163,12 +4084,9 @@
4163
4084
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
4164
4085
 
4165
4086
  <xsl:variable name="title-where">
4166
-
4167
- <xsl:call-template name="getLocalizedString">
4168
- <xsl:with-param name="key">where</xsl:with-param>
4169
- </xsl:call-template>
4170
-
4171
-
4087
+ <xsl:call-template name="getLocalizedString">
4088
+ <xsl:with-param name="key">where</xsl:with-param>
4089
+ </xsl:call-template>
4172
4090
  </xsl:variable>
4173
4091
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4174
4092
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -4186,12 +4104,9 @@
4186
4104
 
4187
4105
 
4188
4106
  <xsl:variable name="title-where">
4189
-
4190
- <xsl:call-template name="getLocalizedString">
4191
- <xsl:with-param name="key">where</xsl:with-param>
4192
- </xsl:call-template>
4193
-
4194
-
4107
+ <xsl:call-template name="getLocalizedString">
4108
+ <xsl:with-param name="key">where</xsl:with-param>
4109
+ </xsl:call-template>
4195
4110
  </xsl:variable>
4196
4111
  <xsl:value-of select="$title-where"/>
4197
4112
  </fo:block>
@@ -4206,12 +4121,9 @@
4206
4121
 
4207
4122
 
4208
4123
  <xsl:variable name="title-key">
4209
-
4210
- <xsl:call-template name="getLocalizedString">
4211
- <xsl:with-param name="key">key</xsl:with-param>
4212
- </xsl:call-template>
4213
-
4214
-
4124
+ <xsl:call-template name="getLocalizedString">
4125
+ <xsl:with-param name="key">key</xsl:with-param>
4126
+ </xsl:call-template>
4215
4127
  </xsl:variable>
4216
4128
  <xsl:value-of select="$title-key"/>
4217
4129
  </fo:block>
@@ -4546,6 +4458,15 @@
4546
4458
  </fo:inline>
4547
4459
  </xsl:template><xsl:template match="*[local-name()='add']">
4548
4460
  <xsl:choose>
4461
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4462
+ <fo:inline>
4463
+ <xsl:call-template name="insertTag">
4464
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4465
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4466
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4467
+ </xsl:call-template>
4468
+ </fo:inline>
4469
+ </xsl:when>
4549
4470
  <xsl:when test="@amendment">
4550
4471
  <fo:inline>
4551
4472
  <xsl:call-template name="insertTag">
@@ -4580,7 +4501,6 @@
4580
4501
  </fo:inline>
4581
4502
  </xsl:otherwise>
4582
4503
  </xsl:choose>
4583
-
4584
4504
  </xsl:template><xsl:template name="insertTag">
4585
4505
  <xsl:param name="type"/>
4586
4506
  <xsl:param name="kind"/>
@@ -4596,14 +4516,14 @@
4596
4516
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4597
4517
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4598
4518
  <g>
4599
- <xsl:if test="$type = 'closing'">
4519
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4600
4520
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4601
4521
  </xsl:if>
4602
4522
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4603
4523
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4604
4524
  </g>
4605
4525
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4606
- <xsl:if test="$type = 'closing'">
4526
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4607
4527
  <xsl:attribute name="x">25</xsl:attribute>
4608
4528
  </xsl:if>
4609
4529
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -5103,9 +5023,9 @@
5103
5023
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
5104
5024
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
5105
5025
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
5106
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5026
+ <xsl:apply-templates select="*[local-name()='name']"/>
5107
5027
  </fo:block>
5108
- <xsl:apply-templates/>
5028
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
5109
5029
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
5110
5030
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5111
5031
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -5924,7 +5844,10 @@
5924
5844
  </fo:block>
5925
5845
  </xsl:if>
5926
5846
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item">
5927
- <xsl:apply-templates mode="contents_item"/>
5847
+ <xsl:param name="mode">bookmarks</xsl:param>
5848
+ <xsl:apply-templates mode="contents_item">
5849
+ <xsl:with-param name="mode" select="$mode"/>
5850
+ </xsl:apply-templates>
5928
5851
  <!-- <xsl:text> </xsl:text> -->
5929
5852
  </xsl:template><xsl:template name="getSection">
5930
5853
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -5997,6 +5920,18 @@
5997
5920
  <xsl:copy-of select="."/>
5998
5921
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5999
5922
  <xsl:text> </xsl:text>
5923
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
5924
+ <xsl:param name="mode">bookmarks</xsl:param>
5925
+ <xsl:apply-templates mode="contents_item">
5926
+ <xsl:with-param name="mode" select="$mode"/>
5927
+ </xsl:apply-templates>
5928
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
5929
+ <xsl:param name="mode">bookmarks</xsl:param>
5930
+ <xsl:if test="$mode = 'contents'">
5931
+ <xsl:copy>
5932
+ <xsl:apply-templates mode="contents_item"/>
5933
+ </xsl:copy>
5934
+ </xsl:if>
6000
5935
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6001
5936
 
6002
5937
  <fo:block-container margin-left="0mm">
@@ -6333,42 +6268,48 @@
6333
6268
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6334
6269
 
6335
6270
 
6336
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6337
-
6338
- <xsl:variable name="element">
6271
+ <xsl:variable name="fo_element">
6272
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6339
6273
 
6340
6274
  inline
6341
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6275
+
6342
6276
  </xsl:variable>
6343
6277
 
6278
+ <!-- display 'EXAMPLE' -->
6279
+ <xsl:apply-templates select="*[local-name()='name']">
6280
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6281
+ </xsl:apply-templates>
6282
+
6344
6283
  <xsl:choose>
6345
- <xsl:when test="contains(normalize-space($element), 'block')">
6346
- <fo:block xsl:use-attribute-sets="example-body-style">
6347
- <xsl:apply-templates/>
6348
- </fo:block>
6284
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6285
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6286
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6287
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6288
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6289
+ </xsl:apply-templates>
6290
+ </fo:block-container>
6291
+ </fo:block-container>
6349
6292
  </xsl:when>
6350
6293
  <xsl:otherwise>
6351
6294
  <fo:inline>
6352
- <xsl:apply-templates/>
6295
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6296
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6297
+ </xsl:apply-templates>
6353
6298
  </fo:inline>
6354
6299
  </xsl:otherwise>
6355
6300
  </xsl:choose>
6356
6301
 
6357
6302
  </fo:block>
6358
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6359
-
6360
- <xsl:variable name="element">
6361
-
6362
- inline
6363
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6364
- </xsl:variable>
6303
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6304
+ <xsl:param name="fo_element">block</xsl:param>
6305
+
6365
6306
  <xsl:choose>
6366
6307
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6367
6308
  <fo:inline>
6368
6309
  <xsl:apply-templates/>
6369
6310
  </fo:inline>
6370
6311
  </xsl:when>
6371
- <xsl:when test="contains(normalize-space($element), 'block')">
6312
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6372
6313
  <fo:block xsl:use-attribute-sets="example-name-style">
6373
6314
  <xsl:apply-templates/>
6374
6315
  </fo:block>
@@ -6381,19 +6322,20 @@
6381
6322
  </xsl:choose>
6382
6323
 
6383
6324
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6325
+ <xsl:param name="fo_element">block</xsl:param>
6326
+
6384
6327
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6385
6328
  <xsl:variable name="element">
6386
6329
 
6387
-
6388
6330
  <xsl:choose>
6389
6331
  <xsl:when test="$num = 1">inline</xsl:when>
6390
6332
  <xsl:otherwise>block</xsl:otherwise>
6391
6333
  </xsl:choose>
6392
6334
 
6393
-
6335
+ <xsl:value-of select="$fo_element"/>
6394
6336
  </xsl:variable>
6395
6337
  <xsl:choose>
6396
- <xsl:when test="normalize-space($element) = 'block'">
6338
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6397
6339
  <fo:block xsl:use-attribute-sets="example-p-style">
6398
6340
 
6399
6341
  <xsl:apply-templates/>
@@ -6461,12 +6403,9 @@
6461
6403
  </fo:basic-link>
6462
6404
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
6463
6405
  <xsl:variable name="title-modified">
6464
-
6465
- <xsl:call-template name="getLocalizedString">
6466
- <xsl:with-param name="key">modified</xsl:with-param>
6467
- </xsl:call-template>
6468
-
6469
-
6406
+ <xsl:call-template name="getLocalizedString">
6407
+ <xsl:with-param name="key">modified</xsl:with-param>
6408
+ </xsl:call-template>
6470
6409
  </xsl:variable>
6471
6410
 
6472
6411
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -6655,12 +6594,9 @@
6655
6594
  </fo:block>
6656
6595
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6657
6596
  <xsl:variable name="title-deprecated">
6658
-
6659
- <xsl:call-template name="getLocalizedString">
6660
- <xsl:with-param name="key">deprecated</xsl:with-param>
6661
- </xsl:call-template>
6662
-
6663
-
6597
+ <xsl:call-template name="getLocalizedString">
6598
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6599
+ </xsl:call-template>
6664
6600
  </xsl:variable>
6665
6601
  <fo:block xsl:use-attribute-sets="deprecates-style">
6666
6602
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -7644,9 +7580,15 @@
7644
7580
  </xsl:template><xsl:template name="getLocalizedString">
7645
7581
  <xsl:param name="key"/>
7646
7582
  <xsl:param name="formatted">false</xsl:param>
7583
+ <xsl:param name="lang"/>
7647
7584
 
7648
7585
  <xsl:variable name="curr_lang">
7649
- <xsl:call-template name="getLang"/>
7586
+ <xsl:choose>
7587
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7588
+ <xsl:otherwise>
7589
+ <xsl:call-template name="getLang"/>
7590
+ </xsl:otherwise>
7591
+ </xsl:choose>
7650
7592
  </xsl:variable>
7651
7593
 
7652
7594
  <xsl:variable name="data_value">
@@ -0,0 +1,70 @@
1
+ require "date"
2
+ require "nokogiri"
3
+ require "json"
4
+ require "pathname"
5
+ require "open-uri"
6
+ require "isodoc"
7
+ require "fileutils"
8
+
9
+ module Metanorma
10
+ module ISO
11
+ class Converter < Standoc::Converter
12
+ XML_ROOT_TAG = "iso-standard".freeze
13
+ XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
14
+
15
+ def html_converter(node)
16
+ IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node))
17
+ end
18
+
19
+ def html_converter_alt(node)
20
+ IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node)
21
+ .merge(alt: true))
22
+ end
23
+
24
+ def doc_converter(node)
25
+ IsoDoc::Iso::WordConvert.new(doc_extract_attributes(node))
26
+ end
27
+
28
+ def pdf_converter(node)
29
+ return nil if node.attr("no-pdf")
30
+
31
+ IsoDoc::Iso::PdfConvert.new(pdf_extract_attributes(node))
32
+ end
33
+
34
+ def sts_converter(node)
35
+ return nil if node.attr("no-pdf")
36
+
37
+ IsoDoc::Iso::StsConvert.new(html_extract_attributes(node))
38
+ end
39
+
40
+ def presentation_xml_converter(node)
41
+ IsoDoc::Iso::PresentationXMLConvert.new(html_extract_attributes(node))
42
+ end
43
+
44
+ def init(node)
45
+ super
46
+ @amd = %w(amendment technical-corrigendum).include? doctype(node)
47
+ @vocab = node.attr("docsubtype") == "vocabulary"
48
+ end
49
+
50
+ def ol_attrs(node)
51
+ attr_code(keep_attrs(node)
52
+ .merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
53
+ end
54
+
55
+ def outputs(node, ret)
56
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
57
+ presentation_xml_converter(node).convert("#{@filename}.xml")
58
+ html_converter_alt(node).convert("#{@filename}.presentation.xml",
59
+ nil, false, "#{@filename}_alt.html")
60
+ html_converter(node).convert("#{@filename}.presentation.xml",
61
+ nil, false, "#{@filename}.html")
62
+ doc_converter(node).convert("#{@filename}.presentation.xml",
63
+ nil, false, "#{@filename}.doc")
64
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
65
+ nil, false, "#{@filename}.pdf")
66
+ # sts_converter(node)&.convert(@filename + ".xml")
67
+ end
68
+ end
69
+ end
70
+ end
File without changes
File without changes
File without changes