metanorma-ogc 2.2.5 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/html/htmlstyle.css +15 -0
  3. data/lib/isodoc/ogc/html/htmlstyle.scss +1 -0
  4. data/lib/isodoc/ogc/html/wordstyle.css +150 -0
  5. data/lib/isodoc/ogc/html/wordstyle.scss +144 -0
  6. data/lib/isodoc/ogc/html/wordstyle_wp.css +126 -0
  7. data/lib/isodoc/ogc/html/wordstyle_wp.scss +121 -0
  8. data/lib/isodoc/ogc/metadata.rb +7 -6
  9. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +320 -80
  10. data/lib/isodoc/ogc/ogc.best-practice.xsl +320 -80
  11. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +320 -80
  12. data/lib/isodoc/ogc/ogc.community-practice.xsl +320 -80
  13. data/lib/isodoc/ogc/ogc.community-standard.xsl +320 -80
  14. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +320 -80
  15. data/lib/isodoc/ogc/ogc.draft-standard.xsl +11036 -0
  16. data/lib/isodoc/ogc/ogc.engineering-report.xsl +320 -80
  17. data/lib/isodoc/ogc/ogc.other.xsl +320 -80
  18. data/lib/isodoc/ogc/ogc.policy.xsl +320 -80
  19. data/lib/isodoc/ogc/ogc.reference-model.xsl +320 -80
  20. data/lib/isodoc/ogc/ogc.release-notes.xsl +320 -80
  21. data/lib/isodoc/ogc/ogc.standard.xsl +320 -80
  22. data/lib/isodoc/ogc/ogc.test-suite.xsl +320 -80
  23. data/lib/isodoc/ogc/ogc.user-guide.xsl +320 -80
  24. data/lib/isodoc/ogc/ogc.white-paper.xsl +308 -69
  25. data/lib/isodoc/ogc/pdf_convert.rb +5 -4
  26. data/lib/isodoc/ogc/presentation_xml_convert.rb +5 -5
  27. data/lib/metanorma/ogc/biblio.rng +5 -0
  28. data/lib/metanorma/ogc/cleanup.rb +14 -14
  29. data/lib/metanorma/ogc/converter.rb +2 -2
  30. data/lib/metanorma/ogc/front.rb +12 -8
  31. data/lib/metanorma/ogc/isodoc.rng +47 -13
  32. data/lib/metanorma/ogc/relaton-ogc.rng +1 -0
  33. data/lib/metanorma/ogc/validate.rb +15 -15
  34. data/lib/metanorma/ogc/version.rb +1 -1
  35. data/metanorma-ogc.gemspec +3 -2
  36. metadata +5 -11
  37. data/.github/workflows/automerge.yml +0 -31
  38. data/.github/workflows/rake.yml +0 -15
  39. data/.github/workflows/release.yml +0 -24
  40. data/Rakefile +0 -8
  41. data/bin/console +0 -14
  42. data/bin/rspec +0 -17
  43. data/bin/setup +0 -8
@@ -621,6 +621,8 @@
621
621
  </xsl:choose>
622
622
  </xsl:template>
623
623
 
624
+ <xsl:strip-space elements="ogc:xref"/>
625
+
624
626
  <!-- external parameters -->
625
627
 
626
628
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -1060,6 +1062,14 @@
1060
1062
 
1061
1063
  </xsl:attribute-set>
1062
1064
 
1065
+ <xsl:attribute-set name="pre-style">
1066
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1067
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1068
+
1069
+ <xsl:attribute name="line-height">113%</xsl:attribute>
1070
+
1071
+ </xsl:attribute-set>
1072
+
1063
1073
  <xsl:attribute-set name="permission-style">
1064
1074
 
1065
1075
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1208,6 +1218,11 @@
1208
1218
  </xsl:variable>
1209
1219
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1210
1220
 
1221
+ <xsl:variable name="table-cell-border_">
1222
+
1223
+ </xsl:variable>
1224
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1225
+
1211
1226
  <xsl:attribute-set name="table-container-style">
1212
1227
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1213
1228
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1220,8 +1235,6 @@
1220
1235
  <xsl:attribute-set name="table-style">
1221
1236
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1222
1237
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1223
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1224
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1225
1238
 
1226
1239
  </xsl:attribute-set><!-- table-style -->
1227
1240
 
@@ -2104,17 +2117,22 @@
2104
2117
  </xsl:for-each>
2105
2118
  </xsl:template>
2106
2119
 
2120
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2107
2121
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2108
2122
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
2109
2123
  <xsl:template match="text()" name="text">
2110
2124
 
2111
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2112
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2113
- <xsl:call-template name="replace_fo_inline_tags">
2114
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2115
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2116
- <xsl:with-param name="text" select="$text"/>
2117
- </xsl:call-template>
2125
+ <xsl:choose>
2126
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
2127
+ <xsl:otherwise>
2128
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2129
+ <xsl:call-template name="replace_fo_inline_tags">
2130
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2131
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2132
+ <xsl:with-param name="text" select="$text"/>
2133
+ </xsl:call-template>
2134
+ </xsl:otherwise>
2135
+ </xsl:choose>
2118
2136
 
2119
2137
  </xsl:template>
2120
2138
 
@@ -2407,6 +2425,12 @@
2407
2425
  <xsl:variable name="table_attributes">
2408
2426
 
2409
2427
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2428
+
2429
+ <xsl:if test="$margin-side != 0">
2430
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2431
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2432
+ </xsl:if>
2433
+
2410
2434
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2411
2435
 
2412
2436
  </xsl:element>
@@ -3162,6 +3186,10 @@
3162
3186
  <xsl:template match="*[local-name()='tr']">
3163
3187
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3164
3188
 
3189
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
3190
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3191
+ </xsl:if>
3192
+
3165
3193
  <xsl:call-template name="setTableRowAttributes"/>
3166
3194
  <xsl:apply-templates/>
3167
3195
  </fo:table-row>
@@ -4128,7 +4156,8 @@
4128
4156
  <xsl:copy-of select="node()"/>
4129
4157
  </td>
4130
4158
  <td>
4131
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4159
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
4160
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
4132
4161
  <!-- get paragraphs from nested 'dl' -->
4133
4162
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4134
4163
  </td>
@@ -4136,6 +4165,53 @@
4136
4165
  </xsl:template>
4137
4166
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
4138
4167
 
4168
+ <xsl:template match="*" mode="dl_if">
4169
+ <xsl:copy-of select="."/>
4170
+ </xsl:template>
4171
+
4172
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
4173
+ <xsl:param name="indent"/>
4174
+ <p>
4175
+ <xsl:copy-of select="@*"/>
4176
+ <xsl:value-of select="$indent"/>
4177
+ <xsl:copy-of select="node()"/>
4178
+ </p>
4179
+
4180
+ </xsl:template>
4181
+
4182
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
4183
+ <xsl:variable name="list_rendered_">
4184
+ <xsl:apply-templates select="."/>
4185
+ </xsl:variable>
4186
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
4187
+
4188
+ <xsl:variable name="indent">
4189
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
4190
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
4191
+ </xsl:for-each>
4192
+ </xsl:variable>
4193
+
4194
+ <xsl:apply-templates mode="dl_if">
4195
+ <xsl:with-param name="indent" select="$indent"/>
4196
+ </xsl:apply-templates>
4197
+ </xsl:template>
4198
+
4199
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
4200
+ <xsl:param name="indent"/>
4201
+ <xsl:apply-templates mode="dl_if">
4202
+ <xsl:with-param name="indent" select="$indent"/>
4203
+ </xsl:apply-templates>
4204
+ </xsl:template>
4205
+
4206
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
4207
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
4208
+ <!-- emulate left indent for list item -->
4209
+ <xsl:call-template name="repeat">
4210
+ <xsl:with-param name="char" select="'x'"/>
4211
+ <xsl:with-param name="count" select="$value"/>
4212
+ </xsl:call-template>
4213
+ </xsl:template>
4214
+
4139
4215
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4140
4216
  <xsl:for-each select="*[local-name() = 'dt']">
4141
4217
  <p>
@@ -4534,6 +4610,7 @@
4534
4610
  </word>
4535
4611
  <xsl:call-template name="tokenize_with_tags">
4536
4612
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4613
+ <xsl:with-param name="tags" select="$tags"/>
4537
4614
  </xsl:call-template>
4538
4615
  </xsl:otherwise>
4539
4616
  </xsl:choose>
@@ -4573,8 +4650,18 @@
4573
4650
 
4574
4651
  <xsl:template name="add-zero-spaces-java">
4575
4652
  <xsl:param name="text" select="."/>
4576
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4577
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4653
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4654
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4655
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
4656
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
4657
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
4658
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
4659
+ <!-- add zero-width space (#x200B) before character: { -->
4660
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4661
+ <!-- add zero-width space (#x200B) after character: , -->
4662
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4663
+
4664
+ <xsl:value-of select="$text5"/>
4578
4665
  </xsl:template>
4579
4666
 
4580
4667
  <xsl:template name="add-zero-spaces-link-java">
@@ -4720,7 +4807,7 @@
4720
4807
  </xsl:copy>
4721
4808
  </xsl:template>
4722
4809
 
4723
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
4810
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
4724
4811
  <xsl:copy>
4725
4812
  <xsl:copy-of select="@*"/>
4726
4813
  <p>
@@ -4768,6 +4855,28 @@
4768
4855
  </xsl:for-each>
4769
4856
  </xsl:template>
4770
4857
 
4858
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
4859
+ <xsl:apply-templates mode="table-without-br"/>
4860
+ </xsl:template>
4861
+
4862
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
4863
+
4864
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
4865
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
4866
+ <xsl:variable name="items">
4867
+ <xsl:call-template name="split">
4868
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
4869
+ <xsl:with-param name="sep" select="$sep"/>
4870
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
4871
+ </xsl:call-template>
4872
+ </xsl:variable>
4873
+ <xsl:for-each select="xalan:nodeset($items)/*">
4874
+ <p>
4875
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
4876
+ </p>
4877
+ </xsl:for-each>
4878
+ </xsl:template>
4879
+
4771
4880
  <!-- remove redundant white spaces -->
4772
4881
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4773
4882
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -5078,6 +5187,7 @@
5078
5187
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5079
5188
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5080
5189
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5190
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
5081
5191
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5082
5192
  </tags>
5083
5193
  </xsl:template>
@@ -5140,6 +5250,9 @@
5140
5250
  <xsl:value-of select="substring($str, 2)"/>
5141
5251
  </xsl:template>
5142
5252
 
5253
+ <!-- ======================================= -->
5254
+ <!-- math -->
5255
+ <!-- ======================================= -->
5143
5256
  <xsl:template match="mathml:math">
5144
5257
  <xsl:variable name="isAdded" select="@added"/>
5145
5258
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5190,14 +5303,57 @@
5190
5303
  <xsl:value-of select="$comment_text"/>
5191
5304
  </xsl:template>
5192
5305
 
5306
+ <xsl:template match="*[local-name() = 'asciimath']">
5307
+ <xsl:param name="process" select="'false'"/>
5308
+ <xsl:if test="$process = 'true'">
5309
+ <xsl:apply-templates/>
5310
+ </xsl:if>
5311
+ </xsl:template>
5312
+
5313
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5314
+
5315
+ <xsl:template name="getMathml_asciimath_text">
5316
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5317
+ <xsl:variable name="latexmath">
5318
+
5319
+ </xsl:variable>
5320
+ <xsl:variable name="asciimath_text_following">
5321
+ <xsl:choose>
5322
+ <xsl:when test="normalize-space($latexmath) != ''">
5323
+ <xsl:value-of select="$latexmath"/>
5324
+ </xsl:when>
5325
+ <xsl:when test="normalize-space($asciimath) != ''">
5326
+ <xsl:value-of select="$asciimath"/>
5327
+ </xsl:when>
5328
+ <xsl:otherwise>
5329
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5330
+ </xsl:otherwise>
5331
+ </xsl:choose>
5332
+ </xsl:variable>
5333
+ <xsl:variable name="asciimath_text_">
5334
+ <xsl:choose>
5335
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5336
+ <xsl:value-of select="$asciimath_text_following"/>
5337
+ </xsl:when>
5338
+ <xsl:otherwise>
5339
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5340
+ </xsl:otherwise>
5341
+ </xsl:choose>
5342
+ </xsl:variable>
5343
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5344
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5345
+ <xsl:value-of select="$asciimath_text"/>
5346
+ </xsl:template>
5347
+
5193
5348
  <xsl:template name="mathml_instream_object">
5194
- <xsl:param name="comment_text"/>
5349
+ <xsl:param name="asciimath_text"/>
5195
5350
  <xsl:param name="mathml_content"/>
5196
5351
 
5197
- <xsl:variable name="comment_text_">
5352
+ <xsl:variable name="asciimath_text_">
5198
5353
  <xsl:choose>
5199
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5200
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5354
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5355
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5356
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5201
5357
  </xsl:choose>
5202
5358
  </xsl:variable>
5203
5359
 
@@ -5214,10 +5370,10 @@
5214
5370
  </xsl:attribute>
5215
5371
 
5216
5372
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5217
- <xsl:if test="normalize-space($comment_text_) != ''">
5373
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5218
5374
  <!-- put Mathin Alternate Text -->
5219
5375
  <xsl:attribute name="fox:alt-text">
5220
- <xsl:value-of select="$comment_text_"/>
5376
+ <xsl:value-of select="$asciimath_text_"/>
5221
5377
  </xsl:attribute>
5222
5378
  </xsl:if>
5223
5379
  <!-- </xsl:if> -->
@@ -5290,6 +5446,29 @@
5290
5446
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5291
5447
  </xsl:template>
5292
5448
 
5449
+ <!-- Examples:
5450
+ <stem type="AsciiMath">x = 1</stem>
5451
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5452
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5453
+ -->
5454
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5455
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5456
+
5457
+ <xsl:choose>
5458
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5459
+ <xsl:otherwise>
5460
+ <xsl:apply-templates>
5461
+ <xsl:with-param name="process">true</xsl:with-param>
5462
+ </xsl:apply-templates>
5463
+ </xsl:otherwise>
5464
+ </xsl:choose>
5465
+
5466
+ </fo:inline>
5467
+ </xsl:template>
5468
+ <!-- ======================================= -->
5469
+ <!-- END: math -->
5470
+ <!-- ======================================= -->
5471
+
5293
5472
  <xsl:template match="*[local-name()='localityStack']"/>
5294
5473
 
5295
5474
  <xsl:template match="*[local-name()='link']" name="link">
@@ -5496,6 +5675,12 @@
5496
5675
 
5497
5676
  <fo:block-container margin-left="0mm">
5498
5677
 
5678
+ <!-- <xsl:if test="$namespace = 'iho'">
5679
+ <xsl:if test="ancestor::iho:td">
5680
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
5681
+ </xsl:if>
5682
+ </xsl:if> -->
5683
+
5499
5684
  <fo:block>
5500
5685
 
5501
5686
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -6627,47 +6812,25 @@
6627
6812
  <xsl:apply-templates mode="contents_item"/>
6628
6813
  </xsl:template>
6629
6814
 
6630
- <!-- ====== -->
6631
- <!-- sourcecode -->
6632
- <!-- ====== -->
6815
+ <!-- =============== -->
6816
+ <!-- sourcecode -->
6817
+ <!-- =============== -->
6633
6818
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6634
6819
 
6635
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6636
-
6637
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6638
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
6639
- </xsl:if>
6640
-
6641
- <xsl:if test="ancestor::*[local-name() = 'example']">
6642
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
6643
- </xsl:if>
6644
-
6645
- <xsl:copy-of select="@id"/>
6646
-
6647
- <xsl:if test="parent::*[local-name() = 'note']">
6648
- <xsl:attribute name="margin-left">
6649
- <xsl:choose>
6650
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
6651
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
6652
- </xsl:choose>
6653
- </xsl:attribute>
6654
-
6655
- </xsl:if>
6656
- <fo:block-container margin-left="0mm">
6657
-
6658
- <fo:block xsl:use-attribute-sets="sourcecode-style">
6659
- <xsl:variable name="_font-size">
6820
+ <xsl:variable name="sourcecode_attributes">
6821
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6822
+ <xsl:variable name="_font-size">
6660
6823
 
6661
- <!-- 9 -->
6824
+ <!-- 9 -->
6662
6825
 
6663
- <!-- <xsl:if test="$namespace = 'ieee'">
6664
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6665
- </xsl:if> -->
6826
+ <!-- <xsl:if test="$namespace = 'ieee'">
6827
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6828
+ </xsl:if> -->
6666
6829
 
6667
- <xsl:choose>
6668
- <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6669
- <xsl:otherwise>9.5</xsl:otherwise>
6670
- </xsl:choose>
6830
+ <xsl:choose>
6831
+ <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6832
+ <xsl:otherwise>9.5</xsl:otherwise>
6833
+ </xsl:choose>
6671
6834
 
6672
6835
  </xsl:variable>
6673
6836
 
@@ -6682,14 +6845,60 @@
6682
6845
  </xsl:choose>
6683
6846
  </xsl:attribute>
6684
6847
  </xsl:if>
6848
+ </xsl:element>
6849
+ </xsl:variable>
6685
6850
 
6851
+ <xsl:choose>
6852
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6853
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
6854
+ <xsl:attribute name="{local-name()}">
6855
+ <xsl:value-of select="."/>
6856
+ </xsl:attribute>
6857
+ </xsl:for-each>
6686
6858
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6687
- </fo:block>
6859
+ </xsl:when>
6688
6860
 
6689
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
6861
+ <xsl:otherwise>
6862
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6690
6863
 
6691
- </fo:block-container>
6692
- </fo:block-container>
6864
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6865
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6866
+ </xsl:if>
6867
+
6868
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6869
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6870
+ </xsl:if>
6871
+
6872
+ <xsl:copy-of select="@id"/>
6873
+
6874
+ <xsl:if test="parent::*[local-name() = 'note']">
6875
+ <xsl:attribute name="margin-left">
6876
+ <xsl:choose>
6877
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
6878
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
6879
+ </xsl:choose>
6880
+ </xsl:attribute>
6881
+
6882
+ </xsl:if>
6883
+ <fo:block-container margin-left="0mm">
6884
+
6885
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
6886
+
6887
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
6888
+ <xsl:attribute name="{local-name()}">
6889
+ <xsl:value-of select="."/>
6890
+ </xsl:attribute>
6891
+ </xsl:for-each>
6892
+
6893
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6894
+ </fo:block>
6895
+
6896
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
6897
+
6898
+ </fo:block-container>
6899
+ </fo:block-container>
6900
+ </xsl:otherwise>
6901
+ </xsl:choose>
6693
6902
  </xsl:template>
6694
6903
 
6695
6904
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -6931,8 +7140,22 @@
6931
7140
  </fo:block>
6932
7141
  </xsl:if>
6933
7142
  </xsl:template>
6934
- <!-- ====== -->
6935
- <!-- ====== -->
7143
+ <!-- =============== -->
7144
+ <!-- END sourcecode -->
7145
+ <!-- =============== -->
7146
+
7147
+ <!-- =============== -->
7148
+ <!-- pre -->
7149
+ <!-- =============== -->
7150
+ <xsl:template match="*[local-name()='pre']" name="pre">
7151
+ <fo:block xsl:use-attribute-sets="pre-style">
7152
+ <xsl:copy-of select="@id"/>
7153
+ <xsl:apply-templates/>
7154
+ </fo:block>
7155
+ </xsl:template>
7156
+ <!-- =============== -->
7157
+ <!-- pre -->
7158
+ <!-- =============== -->
6936
7159
 
6937
7160
  <!-- ========== -->
6938
7161
  <!-- permission -->
@@ -8912,7 +9135,9 @@
8912
9135
  <!-- ===================================== -->
8913
9136
  <!-- Update xml -->
8914
9137
  <!-- ===================================== -->
9138
+ <!-- =========================================================================== -->
8915
9139
  <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9140
+ <!-- =========================================================================== -->
8916
9141
  <xsl:template match="@*|node()" mode="update_xml_step1">
8917
9142
  <xsl:copy>
8918
9143
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -9004,10 +9229,15 @@
9004
9229
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9005
9230
  <xsl:apply-templates mode="update_xml_step1"/>
9006
9231
  </xsl:template>
9007
-
9232
+ <!-- =========================================================================== -->
9008
9233
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9234
+ <!-- =========================================================================== -->
9009
9235
 
9236
+ <!-- =========================================================================== -->
9010
9237
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9238
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
9239
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9240
+ <!-- =========================================================================== -->
9011
9241
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
9012
9242
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
9013
9243
  <xsl:copy>
@@ -9023,10 +9253,15 @@
9023
9253
  <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9024
9254
 
9025
9255
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9026
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
9027
9256
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
9028
9257
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
9029
- <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
9258
+ <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
9259
+ <xsl:variable name="text_">
9260
+ <xsl:choose>
9261
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
9262
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
9263
+ </xsl:choose>
9264
+ </xsl:variable>
9030
9265
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
9031
9266
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
9032
9267
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -9042,7 +9277,11 @@
9042
9277
  </xsl:variable>
9043
9278
 
9044
9279
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
9045
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
9280
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9281
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9282
+ <!-- add &lt; and &gt; to \S -->
9283
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9284
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
9046
9285
  <xsl:variable name="text3">
9047
9286
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
9048
9287
  <xsl:choose>
@@ -9106,9 +9345,8 @@
9106
9345
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
9107
9346
  </xsl:choose>
9108
9347
  </xsl:template>
9109
-
9110
9348
  <!-- ===================================== -->
9111
- <!-- End Update xml -->
9349
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9112
9350
  <!-- ===================================== -->
9113
9351
 
9114
9352
  <!-- for correct rendering combining chars -->
@@ -9496,13 +9734,14 @@
9496
9734
  </xsl:template>
9497
9735
 
9498
9736
  <xsl:template name="setId">
9737
+ <xsl:param name="prefix"/>
9499
9738
  <xsl:attribute name="id">
9500
9739
  <xsl:choose>
9501
9740
  <xsl:when test="@id">
9502
- <xsl:value-of select="@id"/>
9741
+ <xsl:value-of select="concat($prefix, @id)"/>
9503
9742
  </xsl:when>
9504
9743
  <xsl:otherwise>
9505
- <xsl:value-of select="generate-id()"/>
9744
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9506
9745
  </xsl:otherwise>
9507
9746
  </xsl:choose>
9508
9747
  </xsl:attribute>
@@ -13,10 +13,11 @@ module IsoDoc
13
13
 
14
14
  def pdf_stylesheet(docxml)
15
15
  doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
16
- doctype = "other" unless %w(abstract-specification-topic best-practice
17
- change-request-supporting-document community-practice community-standard
18
- discussion-paper engineering-report policy reference-model release-notes
19
- standard user-guide test-suite white-paper).include? doctype
16
+ %w(abstract-specification-topic best-practice draft-standard
17
+ change-request-supporting-document community-practice
18
+ community-standard discussion-paper engineering-report policy
19
+ reference-model release-notes standard user-guide test-suite
20
+ white-paper).include? doctype or doctype = "other"
20
21
  "ogc.#{doctype}.xsl"
21
22
  end
22
23
  end
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def insert_preface_sections(doc)
15
- preface_insert(doc.at(ns("//preface/clause"\
15
+ preface_insert(doc.at(ns("//preface/clause" \
16
16
  "[@type = 'executivesummary']")),
17
17
  doc.at(ns("//preface/abstract")), doc)
18
18
  preface_insert(doc.at(ns("//preface//submitters")),
@@ -109,7 +109,7 @@ module IsoDoc
109
109
 
110
110
  def clause(docxml)
111
111
  super
112
- docxml.xpath(ns("//foreword | //preface/abstract | "\
112
+ docxml.xpath(ns("//foreword | //preface/abstract | " \
113
113
  "//submitters | //introduction | //acknowledgements"))
114
114
  .each do |f|
115
115
  clause1(f)
@@ -146,7 +146,7 @@ module IsoDoc
146
146
 
147
147
  def rename_stage(stage, doctype, _bib)
148
148
  stage&.text == "approved" &&
149
- !%w(standard abstract-specification-topic
149
+ !%w(standard abstract-specification-topic draft-standard
150
150
  community-standard).include?(doctype&.text) and
151
151
  stage.children = "published"
152
152
  end
@@ -170,7 +170,7 @@ module IsoDoc
170
170
  while elem&.next_element&.name == "termsource"
171
171
  elem << "; #{elem.next_element.remove.children.to_xml}"
172
172
  end
173
- elem.children = l10n("[<strong>#{@i18n.source}:</strong> "\
173
+ elem.children = l10n("[<strong>#{@i18n.source}:</strong> " \
174
174
  "#{elem.children.to_xml.strip}]")
175
175
  end
176
176
 
@@ -199,7 +199,7 @@ module IsoDoc
199
199
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
200
200
  i = display_order_at(docxml, "//clause[@type = 'conformance']", i)
201
201
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
202
- i = display_order_at(docxml, "//sections/terms | "\
202
+ i = display_order_at(docxml, "//sections/terms | " \
203
203
  "//sections/clause[descendant::terms]", i)
204
204
  i = display_order_at(docxml, "//sections/definitions", i)
205
205
  i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)