metanorma-jis 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 940e63ca6b0fbe0f8ffcfeb667c50207e3368f065840941e1377d172bf4b022f
4
- data.tar.gz: 7cd7632a9b316836a0e08f517a6c27cb6c12a72ba2d551a21fa29c6d542f98ff
3
+ metadata.gz: 51d33b08d2336531fafeb2cd92258ecd7f4d2ecc22789d688840fff5e3b9f4b4
4
+ data.tar.gz: 20d1c0ad57701d3cd632c1cc33964528a5e34aa646a0290af52f841081fa54a1
5
5
  SHA512:
6
- metadata.gz: ad51ac315b7537a46c60c441b3ab817f9fa028565c09dce86dd08b7a7f5ecb29b1b1abd97c27482ded83cfd0c5849465eacf68cd871f192c60366c0616110b82
7
- data.tar.gz: 457843fe15780ca34e369bc5714affcd6599d2abd3c35d4c0190bfa39be7187c49a6a67bb5fe7f9a8dc53de75637b743ffe50f267d3e5538e865d6d043cce188
6
+ metadata.gz: fc470c9a97b273a3c4989add0df8b28d87173bcca11ca7e1ac2abb46111bf89864db95b23f441970a35b7b6156929109e7b7c7ddd649017aae2ad1551bf1720a
7
+ data.tar.gz: e3192bb844ec32eab702e75891b7165b04c802e7acc3c8bc2a277a3d47e2e911427c36716559db01cbd1c81c4ba0f6f93c2bf6611655b95468513b30943022fc
@@ -2119,6 +2119,10 @@
2119
2119
 
2120
2120
  </xsl:attribute-set>
2121
2121
 
2122
+ <xsl:template name="refine_termexample-style">
2123
+
2124
+ </xsl:template>
2125
+
2122
2126
  <xsl:attribute-set name="example-style">
2123
2127
 
2124
2128
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
@@ -3238,6 +3242,36 @@
3238
3242
  </xsl:for-each>
3239
3243
  </xsl:template>
3240
3244
 
3245
+ <xsl:template name="processMainSectionsDefault_flatxml">
3246
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3247
+ <xsl:sort select="@displayorder" data-type="number"/>
3248
+ <xsl:variable name="flatxml">
3249
+ <xsl:apply-templates select="." mode="flatxml"/>
3250
+ </xsl:variable>
3251
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3252
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3253
+
3254
+ </xsl:for-each>
3255
+
3256
+ <xsl:for-each select="/*/*[local-name()='annex']">
3257
+ <xsl:sort select="@displayorder" data-type="number"/>
3258
+ <xsl:variable name="flatxml">
3259
+ <xsl:apply-templates select="." mode="flatxml"/>
3260
+ </xsl:variable>
3261
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3262
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3263
+ </xsl:for-each>
3264
+
3265
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3266
+ <xsl:sort select="@displayorder" data-type="number"/>
3267
+ <xsl:variable name="flatxml">
3268
+ <xsl:apply-templates select="." mode="flatxml"/>
3269
+ </xsl:variable>
3270
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3271
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3272
+ </xsl:for-each>
3273
+ </xsl:template>
3274
+
3241
3275
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3242
3276
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3243
3277
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5305,13 +5339,13 @@
5305
5339
  <tr>
5306
5340
  <td>
5307
5341
  <xsl:attribute name="id">
5308
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5342
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5309
5343
  </xsl:attribute>
5310
5344
  <xsl:apply-templates/>
5311
5345
  </td>
5312
5346
  <td>
5313
5347
  <xsl:attribute name="id">
5314
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
5348
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5315
5349
  </xsl:attribute>
5316
5350
 
5317
5351
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -5926,6 +5960,10 @@
5926
5960
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5927
5961
  </xsl:template>
5928
5962
 
5963
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
5964
+ <xsl:value-of select="."/>
5965
+ </xsl:template>
5966
+
5929
5967
  <!-- ========================= -->
5930
5968
  <!-- END Rich text formatting -->
5931
5969
  <!-- ========================= -->
@@ -6556,7 +6594,7 @@
6556
6594
  </xsl:choose>
6557
6595
  </xsl:variable>
6558
6596
  <xsl:attribute name="id">
6559
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
6597
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
6560
6598
  </xsl:attribute>
6561
6599
 
6562
6600
  <xsl:for-each select="*[local-name() = 'p']">
@@ -6564,7 +6602,7 @@
6564
6602
  <xsl:copy-of select="@*"/>
6565
6603
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6566
6604
  <xsl:attribute name="id">
6567
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6605
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6568
6606
  </xsl:attribute>
6569
6607
 
6570
6608
  <!-- <xsl:copy-of select="node()" /> -->
@@ -6628,7 +6666,7 @@
6628
6666
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6629
6667
  <xsl:copy>
6630
6668
  <xsl:attribute name="id">
6631
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6669
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6632
6670
  </xsl:attribute>
6633
6671
  <xsl:copy-of select="node()"/>
6634
6672
  </xsl:copy>
@@ -9422,7 +9460,7 @@
9422
9460
  <!-- ====== -->
9423
9461
  <xsl:template match="*[local-name() = 'termexample']">
9424
9462
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
9425
-
9463
+ <xsl:call-template name="refine_termexample-style"/>
9426
9464
  <xsl:call-template name="setBlockSpanAll"/>
9427
9465
 
9428
9466
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -9,14 +9,14 @@ module IsoDoc
9
9
  %w(en ja).include?(lang) or lang = "ja"
10
10
  tp = title_parts(isoxml, lang)
11
11
  tn = title_nums(isoxml)
12
- set_encoded(:doctitlemain, tp[:main])
12
+ tp[:main] and set(:doctitlemain, tp[:main].children.to_xml)
13
13
  main = compose_title(tp, tn, lang)
14
14
  set(:doctitle, main)
15
- set_encoded(:doctitleintro, tp[:intro])
15
+ tp[:intro] and set(:doctitleintro, tp[:intro].children.to_xml)
16
16
  set(:doctitlepartlabel, part_prefix(tn, lang))
17
- set_encoded(:doctitlepart, tp[:part])
17
+ tp[:part] and set(:doctitlepart, tp[:part].children.to_xml)
18
18
  set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
19
- set_encoded(:doctitleamd, tp[:amd])
19
+ tp[:amd] and set(:doctitleamd, tp[:amd].children.to_xml)
20
20
  set(:doctitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
21
21
  end
22
22
 
@@ -24,14 +24,14 @@ module IsoDoc
24
24
  lang = @lang == "ja" ? "en" : "ja"
25
25
  tp = title_parts(isoxml, lang)
26
26
  tn = title_nums(isoxml)
27
- set_encoded(:docsubtitlemain, tp[:main])
27
+ tp[:main] and set(:docsubtitlemain, tp[:main].children.to_xml)
28
28
  main = compose_title(tp, tn, lang)
29
29
  set(:docsubtitle, main)
30
- set_encoded(:docsubtitleintro, tp[:intro])
30
+ tp[:intro] and set(:docsubtitleintro, tp[:intro].children.to_xml)
31
31
  set(:docsubtitlepartlabel, part_prefix(tn, lang))
32
- set_encoded(:docsubtitlepart, tp[:part])
32
+ tp[:part] and set(:docsubtitlepart, tp[:part].children.to_xml)
33
33
  set(:docsubtitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
34
- set_encoded(:docsubtitleamd, tp[:amd])
34
+ tp[:amd] and set(:docsubtitleamd, tp[:amd].children.to_xml)
35
35
  set(:docsubtitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
36
36
  end
37
37
 
@@ -68,17 +68,16 @@ module Metanorma
68
68
  ret = node.attr(attr + suffix) and return ret
69
69
  ret = langs.each_with_object({}).each do |l, m|
70
70
  x = node.attr("#{attr}-#{l}#{suffix}") and m[l] = x
71
- end.compact
71
+ end
72
72
  ret.empty? and return nil
73
- ret
73
+ compact_blank(ret)
74
74
  end
75
75
 
76
76
  def extract_org_attrs_complex(node, opts, source, suffix)
77
- { name: multiling_docattr(node, source, suffix, LANGS),
78
- role: opts[:role], desc: opts[:desc],
79
- abbr: multiling_docattr(node, "#{source}-abbr", suffix, LANGS),
80
- logo: multiling_docattr(node, "#{source}_logo", suffix, LANGS) }
81
- .compact
77
+ compact_blank({ name: multiling_docattr(node, source, suffix, LANGS),
78
+ role: opts[:role], desc: opts[:desc],
79
+ abbr: multiling_docattr(node, "#{source}-abbr", suffix, LANGS),
80
+ logo: multiling_docattr(node, "#{source}_logo", suffix, LANGS) })
82
81
  .merge(extract_org_attrs_address(node, opts, suffix))
83
82
  end
84
83
 
@@ -142,7 +141,6 @@ module Metanorma
142
141
  xml.docidentifier id.sub(/^JIS /, ""), **attr_code(type: "JIS")
143
142
  else iso_id(node, xml)
144
143
  end
145
- xml.docnumber node.attr("docnumber")
146
144
  end
147
145
 
148
146
  def get_typeabbr(node, amd: false)
@@ -168,12 +166,13 @@ module Metanorma
168
166
  publisher: pub[0],
169
167
  copublisher: pub[1..-1] }.compact
170
168
  ret[:copublisher].empty? and ret.delete(:copublisher)
171
- ret
169
+ compact_blank(ret)
172
170
  end
173
171
 
174
172
  def iso_id_params_add(node)
175
- { number: node.attr("amendment-number"),
176
- year: iso_id_year(node) }.compact
173
+ ret = { number: node.attr("amendment-number"),
174
+ year: iso_id_year(node) }
175
+ compact_blank(ret)
177
176
  end
178
177
 
179
178
  def iso_id_out(xml, params, _with_prf)
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.1".freeze
3
+ VERSION = "0.2.2".freeze
4
4
  end
5
5
  end
6
6
 
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
33
  spec.add_dependency "japanese_calendar", "~> 0"
34
- spec.add_dependency "metanorma-iso", "~> 2.7.0"
34
+ spec.add_dependency "metanorma-iso", "~> 2.7.2"
35
35
  spec.add_dependency "pubid-jis"
36
36
 
37
37
  spec.add_development_dependency "debug"
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.7.0
33
+ version: 2.7.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.7.0
40
+ version: 2.7.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pubid-jis
43
43
  requirement: !ruby/object:Gem::Requirement