metanorma-jis 0.2.4 → 0.2.5

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: c8dc64b7e2524636baafacbeb79db166d0de7fe32390f6863c2b424b43d6a236
4
- data.tar.gz: b81a5ab243c3cde8b604a0481f17875d8931c9af92a8bdd8303a8a405e409c62
3
+ metadata.gz: 65f86c5e987c2ebb3e29e79cf4257506cb59ad2e5b80036d0814b0b7e806de52
4
+ data.tar.gz: a873f22013e0ffb53706b5615c1297adff565ee6ae0184465456f7a4a081af73
5
5
  SHA512:
6
- metadata.gz: 320ca25a90e1fe5df1f2ff17c8dee46ad4a8a9ac3b9756e07cf149a5ba16ab842fafcae3f19a12bc550235dfa589950841ba3e742e48bd844e84dfe898446927
7
- data.tar.gz: 470d48f3536cf937d52a57cacf7890fff1d29aeb52f9c21581a38ef8019268fc71e8f51f1fe0913f393a3599eb4c4c8935b7d7b7366c50cadad72d1787c3c2cf
6
+ metadata.gz: '09aaa2e07d8cc7632b463c51d83a8b7d5ddd8056c636175ec1fcc9d4ca824ae7cb3c974e0ed39891c339a15706c99989f7c8dad583d1ece3985d54431a78c581'
7
+ data.tar.gz: f8dcb73f59c6bcd1757c6ebee5f9ee53c8185eecfe0ab1f5922fa9c52e0cce65d661b9ba1647c6cca148e475b0630f52d1697c79dca13833a95cce7f398c468f
@@ -1856,6 +1856,7 @@
1856
1856
  <xsl:variable name="zero_width_space">​</xsl:variable>
1857
1857
  <xsl:variable name="hair_space"> </xsl:variable>
1858
1858
  <xsl:variable name="en_dash">–</xsl:variable>
1859
+ <xsl:variable name="em_dash">—</xsl:variable>
1859
1860
 
1860
1861
  <xsl:template name="getTitle">
1861
1862
  <xsl:param name="name"/>
@@ -2160,6 +2161,10 @@
2160
2161
 
2161
2162
  </xsl:attribute-set> <!-- example-name-style -->
2162
2163
 
2164
+ <xsl:template name="refine_example-name-style">
2165
+
2166
+ </xsl:template>
2167
+
2163
2168
  <xsl:attribute-set name="example-p-style">
2164
2169
 
2165
2170
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
@@ -2176,6 +2181,10 @@
2176
2181
 
2177
2182
  </xsl:attribute-set> <!-- termexample-name-style -->
2178
2183
 
2184
+ <xsl:template name="refine_termexample-name-style">
2185
+
2186
+ </xsl:template>
2187
+
2179
2188
  <!-- ========================== -->
2180
2189
  <!-- Table styles -->
2181
2190
  <!-- ========================== -->
@@ -2377,6 +2386,10 @@
2377
2386
 
2378
2387
  </xsl:attribute-set> <!-- table-fn-style -->
2379
2388
 
2389
+ <xsl:template name="refine_table-fn-style">
2390
+
2391
+ </xsl:template>
2392
+
2380
2393
  <xsl:attribute-set name="table-fn-number-style">
2381
2394
  <xsl:attribute name="font-size">80%</xsl:attribute>
2382
2395
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2389,6 +2402,10 @@
2389
2402
 
2390
2403
  </xsl:attribute-set> <!-- table-fn-number-style -->
2391
2404
 
2405
+ <xsl:template name="refine_table-fn-number-style">
2406
+
2407
+ </xsl:template>
2408
+
2392
2409
  <xsl:attribute-set name="fn-container-body-style">
2393
2410
  <xsl:attribute name="text-indent">0</xsl:attribute>
2394
2411
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -5860,11 +5877,16 @@
5860
5877
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5861
5878
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5862
5879
  <xsl:variable name="text" select="."/>
5863
- <fo:inline font-size="75%" role="SKIP">
5880
+ <xsl:variable name="ratio_">
5881
+ 0.75
5882
+ </xsl:variable>
5883
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5884
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5864
5885
  <xsl:if test="string-length($text) &gt; 0">
5865
5886
  <xsl:variable name="smallCapsText">
5866
5887
  <xsl:call-template name="recursiveSmallCaps">
5867
5888
  <xsl:with-param name="text" select="$text"/>
5889
+ <xsl:with-param name="ratio" select="$ratio"/>
5868
5890
  </xsl:call-template>
5869
5891
  </xsl:variable>
5870
5892
  <!-- merge neighboring fo:inline -->
@@ -5901,12 +5923,13 @@
5901
5923
 
5902
5924
  <xsl:template name="recursiveSmallCaps">
5903
5925
  <xsl:param name="text"/>
5926
+ <xsl:param name="ratio"/>
5904
5927
  <xsl:variable name="char" select="substring($text,1,1)"/>
5905
5928
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5906
5929
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5907
5930
  <xsl:choose>
5908
5931
  <xsl:when test="$char=$upperCase">
5909
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5932
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5910
5933
  <xsl:value-of select="$upperCase"/>
5911
5934
  </fo:inline>
5912
5935
  </xsl:when>
@@ -5917,6 +5940,7 @@
5917
5940
  <xsl:if test="string-length($text) &gt; 1">
5918
5941
  <xsl:call-template name="recursiveSmallCaps">
5919
5942
  <xsl:with-param name="text" select="substring($text,2)"/>
5943
+ <xsl:with-param name="ratio" select="$ratio"/>
5920
5944
  </xsl:call-template>
5921
5945
  </xsl:if>
5922
5946
  </xsl:template>
@@ -5953,6 +5977,9 @@
5953
5977
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5954
5978
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5955
5979
  </xsl:if>
5980
+ <xsl:if test="$key = 'text-indent'">
5981
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5982
+ </xsl:if>
5956
5983
  </xsl:for-each>
5957
5984
  </xsl:variable>
5958
5985
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -7359,6 +7386,11 @@
7359
7386
  </xsl:call-template>
7360
7387
  </xsl:template>
7361
7388
 
7389
+ <!-- command between two xref points to non-standard bibitem -->
7390
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
7391
+ <xsl:value-of select="."/>
7392
+ </xsl:template>
7393
+
7362
7394
  <!-- ====== -->
7363
7395
  <!-- formula -->
7364
7396
  <!-- ====== -->
@@ -8055,6 +8087,8 @@
8055
8087
  </xsl:attribute>
8056
8088
  </xsl:template>
8057
8089
 
8090
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
8091
+
8058
8092
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
8059
8093
  <xsl:copy>
8060
8094
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -8073,7 +8107,8 @@
8073
8107
 
8074
8108
  <xsl:attribute name="width">
8075
8109
  <xsl:choose>
8076
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8110
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8111
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8077
8112
  <xsl:when test="$width != ''">
8078
8113
  <xsl:value-of select="round($width)"/>
8079
8114
  </xsl:when>
@@ -8082,7 +8117,8 @@
8082
8117
  </xsl:attribute>
8083
8118
  <xsl:attribute name="height">
8084
8119
  <xsl:choose>
8085
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8120
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8121
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8086
8122
  <xsl:when test="$height != ''">
8087
8123
  <xsl:value-of select="round($height)"/>
8088
8124
  </xsl:when>
@@ -8099,7 +8135,7 @@
8099
8135
  <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8100
8136
  <xsl:attribute name="width">
8101
8137
  <xsl:choose>
8102
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8138
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8103
8139
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8104
8140
  </xsl:choose>
8105
8141
  </xsl:attribute>
@@ -8110,7 +8146,7 @@
8110
8146
  <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8111
8147
  <xsl:attribute name="height">
8112
8148
  <xsl:choose>
8113
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8149
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8114
8150
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8115
8151
  </xsl:choose>
8116
8152
  </xsl:attribute>
@@ -9571,6 +9607,7 @@
9571
9607
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
9572
9608
  <xsl:if test="normalize-space() != ''">
9573
9609
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
9610
+ <xsl:call-template name="refine_termexample-name-style"/>
9574
9611
  <xsl:apply-templates/>
9575
9612
  </fo:inline>
9576
9613
  </xsl:if>
@@ -9721,6 +9758,7 @@
9721
9758
  </xsl:when>
9722
9759
  <xsl:otherwise>
9723
9760
  <fo:inline xsl:use-attribute-sets="example-name-style">
9761
+ <xsl:call-template name="refine_example-name-style"/>
9724
9762
  <xsl:apply-templates/>
9725
9763
  </fo:inline>
9726
9764
  </xsl:otherwise>
@@ -10981,6 +11019,7 @@
10981
11019
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10982
11020
  <xsl:otherwise>
10983
11021
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11022
+
10984
11023
  <fo:list-item-label end-indent="label-end()">
10985
11024
  <fo:block role="SKIP">
10986
11025
  <fo:inline role="SKIP">
@@ -12849,4 +12888,6 @@
12849
12888
  </xsl:if>
12850
12889
  </xsl:template>
12851
12890
 
12891
+ <!-- update -->
12892
+
12852
12893
  </xsl:stylesheet>
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">
@@ -77,6 +77,11 @@ module Metanorma
77
77
  a.children.first.previous = "<name>#{@i18n.chairperson}</name>"
78
78
  end
79
79
  end
80
+
81
+ def ol_cleanup(doc)
82
+ ::Metanorma::Standoc::Converter.instance_method(:ol_cleanup).bind(self)
83
+ .call(doc)
84
+ end
80
85
  end
81
86
  end
82
87
  end
@@ -138,7 +138,8 @@ module Metanorma
138
138
 
139
139
  def metadata_id(node, xml)
140
140
  if id = node.attr("docidentifier")
141
- xml.docidentifier id.sub(/^JIS /, ""), **attr_code(type: "JIS")
141
+ xml.docidentifier id.sub(/^JIS /, ""),
142
+ **attr_code(type: "JIS", primary: "true")
142
143
  else iso_id(node, xml)
143
144
  end
144
145
  end
@@ -177,7 +178,7 @@ module Metanorma
177
178
 
178
179
  def iso_id_out(xml, params, _with_prf)
179
180
  id = iso_id_default(params).to_s(with_publisher: false)
180
- xml.docidentifier id.strip, type: "JIS"
181
+ xml.docidentifier id.strip, type: "JIS", primary: "true"
181
182
  end
182
183
 
183
184
  def iso_id_default(params)
@@ -156,44 +156,7 @@
156
156
  </define>
157
157
  <define name="xref">
158
158
  <element name="xref">
159
- <attribute name="target">
160
- <data type="string">
161
- <param name="pattern">\i\c*|\c+#\c+</param>
162
- </data>
163
- </attribute>
164
- <optional>
165
- <attribute name="to">
166
- <data type="string">
167
- <param name="pattern">\i\c*|\c+#\c+</param>
168
- </data>
169
- </attribute>
170
- </optional>
171
- <optional>
172
- <attribute name="type">
173
- <ref name="ReferenceFormat"/>
174
- </attribute>
175
- </optional>
176
- <optional>
177
- <attribute name="alt"/>
178
- </optional>
179
- <optional>
180
- <attribute name="case">
181
- <choice>
182
- <value>capital</value>
183
- <value>lowercase</value>
184
- </choice>
185
- </attribute>
186
- </optional>
187
- <optional>
188
- <attribute name="droploc">
189
- <data type="boolean"/>
190
- </attribute>
191
- </optional>
192
- <optional>
193
- <attribute name="style">
194
- <ref name="XrefStyleType"/>
195
- </attribute>
196
- </optional>
159
+ <ref name="XrefAttributes"/>
197
160
  <ref name="XrefBody"/>
198
161
  </element>
199
162
  </define>
@@ -407,23 +370,7 @@
407
370
  </define>
408
371
  <define name="figure">
409
372
  <element name="figure">
410
- <attribute name="id">
411
- <data type="ID"/>
412
- </attribute>
413
- <optional>
414
- <attribute name="unnumbered">
415
- <data type="boolean"/>
416
- </attribute>
417
- </optional>
418
- <optional>
419
- <attribute name="number"/>
420
- </optional>
421
- <optional>
422
- <attribute name="subsequence"/>
423
- </optional>
424
- <optional>
425
- <attribute name="class"/>
426
- </optional>
373
+ <ref name="FigureAttributes"/>
427
374
  <ref name="BlockAttributes"/>
428
375
  <optional>
429
376
  <ref name="tname"/>
@@ -2450,6 +2397,49 @@
2450
2397
  </zeroOrMore>
2451
2398
  </element>
2452
2399
  </define>
2400
+ <define name="XrefAttributes">
2401
+ <attribute name="target">
2402
+ <data type="string">
2403
+ <param name="pattern">\i\c*|\c+#\c+</param>
2404
+ </data>
2405
+ </attribute>
2406
+ <optional>
2407
+ <attribute name="to">
2408
+ <data type="string">
2409
+ <param name="pattern">\i\c*|\c+#\c+</param>
2410
+ </data>
2411
+ </attribute>
2412
+ </optional>
2413
+ <optional>
2414
+ <attribute name="type">
2415
+ <ref name="ReferenceFormat"/>
2416
+ </attribute>
2417
+ </optional>
2418
+ <optional>
2419
+ <attribute name="alt"/>
2420
+ </optional>
2421
+ <optional>
2422
+ <attribute name="case">
2423
+ <choice>
2424
+ <value>capital</value>
2425
+ <value>lowercase</value>
2426
+ </choice>
2427
+ </attribute>
2428
+ </optional>
2429
+ <optional>
2430
+ <attribute name="droploc">
2431
+ <data type="boolean"/>
2432
+ </attribute>
2433
+ </optional>
2434
+ <optional>
2435
+ <attribute name="style">
2436
+ <ref name="XrefStyleType"/>
2437
+ </attribute>
2438
+ </optional>
2439
+ <optional>
2440
+ <attribute name="label"/>
2441
+ </optional>
2442
+ </define>
2453
2443
  <define name="XrefBody">
2454
2444
  <zeroOrMore>
2455
2445
  <ref name="XrefTarget"/>
@@ -2528,6 +2518,28 @@
2528
2518
  <attribute name="columns"/>
2529
2519
  </optional>
2530
2520
  </define>
2521
+ <define name="FigureAttributes">
2522
+ <attribute name="id">
2523
+ <data type="ID"/>
2524
+ </attribute>
2525
+ <optional>
2526
+ <attribute name="unnumbered">
2527
+ <data type="boolean"/>
2528
+ </attribute>
2529
+ </optional>
2530
+ <optional>
2531
+ <attribute name="number"/>
2532
+ </optional>
2533
+ <optional>
2534
+ <attribute name="subsequence"/>
2535
+ </optional>
2536
+ <optional>
2537
+ <attribute name="class"/>
2538
+ </optional>
2539
+ <optional>
2540
+ <attribute name="width"/>
2541
+ </optional>
2542
+ </define>
2531
2543
  <start>
2532
2544
  <ref name="standard-document"/>
2533
2545
  </start>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.4".freeze
3
+ VERSION = "0.2.5".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-10 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar