metanorma-jis 1.0.8 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b408818c892ab433c66dbe129cea0ffdbd82283755ccffce0556d4b47b8d756
4
- data.tar.gz: 2dc6d2c7e7f67e2ca89c53088efd03ca598061a0cf55a543b7c55a54799985e7
3
+ metadata.gz: e6f96c87a0bfcb04ce47eb78813f5e9bd830025f9fad83c0ed56bb77235b6c1e
4
+ data.tar.gz: 818f774a6bc9b177f5b6857e0d133300a3ef5966c51e9c2a55d35c466a95cd4e
5
5
  SHA512:
6
- metadata.gz: 0edff9c8c05ada995358ed6fdea0b6f840f554e4b052dc05e7473e6fb8e6008eccf73bcec9d619497230b5c139586fc121fbd7ac3917e7f203c083a1e5564e74
7
- data.tar.gz: efbf2c34d966ac98b7897e9eb8466902a0aaaf038535ccee4a847dd93a797bc0298fe1866dbb59aeeb5dae473d9a7b6000d1fede44bd165cfe18dc544e108e25
6
+ metadata.gz: e7591207765fde1ecd5c3060e0ba6c9ffb1da8cd7db401828226a6f3e5585b92593f55e2b8f048e6427a245ac84f3ff300d7f026a386efb7d3a72f93e59bb9fc
7
+ data.tar.gz: b156b59b6787b5f3819b2ee357bd582753f1b71d0a26e598a9ea79304ff804f104d2d95ddfd9de7406ec9a09928a87b532a9ac6405af26b281df71016dd91292
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
5
 
6
6
  # local repo-specific modifications
7
7
  # ...
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 3.4
@@ -16,7 +16,8 @@ module IsoDoc
16
16
  out.div **attr_code(annex_attrs(node)) do |s|
17
17
  node.elements.each do |c1|
18
18
  if c1.name == "fmt-title" then annex_name(node, c1, s)
19
- else parse(c1, s) end
19
+ else parse(c1, s)
20
+ end
20
21
  end
21
22
  end
22
23
  amd?(isoxml) and @suppressheadingnumbers = true
@@ -42,12 +43,17 @@ module IsoDoc
42
43
  end
43
44
 
44
45
  def table_parse_tail(node, out)
45
- node.xpath(ns("./p[@class = 'ListTitle' or @class = 'dl']"))
46
- .each { |p| parse(p, out) }
47
- node.xpath(ns("./fmt-source")).each { |n| parse(n, out) }
48
- node.xpath(ns("./note")).each { |n| parse(n, out) }
49
- node.xpath(ns("./fmt-footnote-container/fmt-fn-body"))
50
- .each { |n| parse(n, out) }
46
+ table_parse_tail?(node) or return
47
+ tfoot = table_get_or_make_tfoot(out.parent)
48
+ [["./key", "./fmt-source", "./note"],
49
+ ["./fmt-footnote-container/fmt-fn-body"]].each do |e|
50
+ e.any? { |x| node.at(ns(x)) } or next
51
+ ins = new_fullcolspan_row(out.parent, tfoot)
52
+ b = Nokogiri::XML::Builder.with(ins)
53
+ e.each do |k|
54
+ node.xpath(ns(k)).each { |n| parse(n, b) }
55
+ end
56
+ end
51
57
  end
52
58
 
53
59
  def table_thead_pt(node, name)
@@ -72,7 +78,7 @@ module IsoDoc
72
78
  name or return
73
79
  thead.add_first_child full_row(
74
80
  cols, "<fmt-name><p class='TableTitle' style='text-align:center;'> " \
75
- "#{name.remove.children.to_xml}</p></fmt-name>"
81
+ "#{name.remove.children.to_xml}</p></fmt-name>"
76
82
  )
77
83
  end
78
84
 
@@ -31,10 +31,19 @@ doctype_dict:
31
31
  stage_dict:
32
32
  international-standard: 日本産業規格
33
33
  punct:
34
- open-title:
35
- close-title:
34
+ open-title:
35
+ close-title:
36
36
  open-secondary-title:
37
37
  close-secondary-title:
38
38
  # We need the trailing half-width space, to allow it to be converted to cjk-latin-separator if Latn text follows
39
39
  biblio-field-delimiter: "。 "
40
40
  biblio-terminator: ""
41
+ date_format:
42
+ default:
43
+ year: "%EY[spellout]年"
44
+ year_month: "%EY[spellout]年%-m月"
45
+ full: "%EY[spellout]年%-m月%-d日"
46
+ japanese_numbering:
47
+ year: "%EY[spellout]年"
48
+ year_month: "%EY[spellout]年%Om[spellout]月"
49
+ full: "%EY[spellout]年%Om[spellout]月%Od[spellout]日"
@@ -18,26 +18,16 @@ module IsoDoc
18
18
  end
19
19
  end
20
20
 
21
- # use Japanese ordinals for era years
22
- def japanese_date(date)
23
- date.nil? and return date
24
- d = date.split("-").map(&:to_i)
25
- time = Date.new(*d)
26
- yr = japanese_year(time)
27
- case d.size
28
- when 1 then yr
29
- when 2 then yr + time.strftime("%-m月")
30
- when 3 then yr + time.strftime("%-m月%-d日")
31
- else date
32
- end
33
- end
34
-
35
- def japanese_year(time)
36
- era_yr = time.era_year.to_i.localize(:ja)
37
- .to_rbnf_s("SpelloutRules", "spellout-numbering-year")
38
- "#{time.strftime('%JN')}#{era_yr}年"
39
- rescue StandardError
40
- time.year.to_s
21
+ def japanese_date(date, japanese_numbering: false)
22
+ branch = japanese_numbering ? "japanese_numbering" : "default"
23
+ fmts = @labels.dig("date_format", branch) || {}
24
+ IsoDoc::ExtendedDateFormatter.format_iso_date(
25
+ date,
26
+ lang: "ja",
27
+ year: fmts["year"],
28
+ year_month: fmts["year_month"],
29
+ full: fmts["full"],
30
+ )
41
31
  end
42
32
  end
43
33
  end
@@ -13,9 +13,11 @@ module IsoDoc
13
13
  tp[:intro] and set(:doctitleintro, tp[:intro].children.to_xml)
14
14
  set(:doctitlepartlabel, title_part_prefix(isoxml, "part", lang))
15
15
  tp[:part] and set(:doctitlepart, tp[:part].children.to_xml)
16
- tn[:amd] and set(:doctitleamdlabel, title_part_prefix(isoxml, "amendment", lang))
16
+ tn[:amd] and set(:doctitleamdlabel,
17
+ title_part_prefix(isoxml, "amendment", lang))
17
18
  tp[:amd] and set(:doctitleamd, tp[:amd].children.to_xml)
18
- tn[:corr] and set(:doctitlecorrlabel, title_part_prefix(isoxml, "corrigendum", lang))
19
+ tn[:corr] and set(:doctitlecorrlabel,
20
+ title_part_prefix(isoxml, "corrigendum", lang))
19
21
  main = compose_title(tp, tn, lang)
20
22
  set(:doctitle, main)
21
23
  end
@@ -28,9 +30,11 @@ module IsoDoc
28
30
  tp[:intro] and set(:docsubtitleintro, tp[:intro].children.to_xml)
29
31
  set(:docsubtitlepartlabel, title_part_prefix(isoxml, "part", lang))
30
32
  tp[:part] and set(:docsubtitlepart, tp[:part].children.to_xml)
31
- tn[:amd] and set(:docsubtitleamdlabel, title_part_prefix(isoxml, "amendment", lang))
33
+ tn[:amd] and set(:docsubtitleamdlabel,
34
+ title_part_prefix(isoxml, "amendment", lang))
32
35
  tp[:amd] and set(:docsubtitleamd, tp[:amd].children.to_xml)
33
- tn[:corr] and set(:docsubtitlecorrlabel, title_part_prefix(isoxml, "corrigendum", lang))
36
+ tn[:corr] and set(:docsubtitlecorrlabel,
37
+ title_part_prefix(isoxml, "corrigendum", lang))
34
38
  main = compose_title(tp, tn, lang)
35
39
  set(:docsubtitle, main)
36
40
  end
@@ -53,15 +57,18 @@ module IsoDoc
53
57
  val = Common::date_range(d)
54
58
  @lang == "ja" && /^\d+[0-9-]+$/.match?(val) and
55
59
  val = @i18n.japanese_date(val)
56
- set("#{d['type'].tr('-', '_')}date".to_sym, val)
60
+ set(:"#{d['type'].tr('-', '_')}date", val)
57
61
  end
58
62
  end
59
63
 
60
64
  def version(isoxml, out)
61
65
  super
62
66
  @lang == "ja" or return
63
- revdate = @i18n.japanese_date(isoxml
64
- .at(ns("//bibdata/version/revision-date"))&.text)
67
+ revdate = if revdate = isoxml.at(ns("//bibdata/date[@type = 'updated']/on"))
68
+ @i18n.japanese_date(revdate.text)
69
+ else
70
+ isoxml.at(ns("//bibdata/date[@type = 'updated']"))&.text
71
+ end
65
72
  set(:revdate, revdate)
66
73
  set(:draftinfo, draftinfo(get[:draft], revdate))
67
74
  end
@@ -74,12 +74,8 @@ module IsoDoc
74
74
  end
75
75
 
76
76
  def date_translate1(date)
77
- j = @i18n.japanese_date(date.strip)
78
- @autonumbering_style == :japanese and
79
- j.gsub!(/(\d+)/) do
80
- $1.to_i.localize(:ja).spellout
81
- end
82
- j
77
+ ja = @autonumbering_style == :japanese
78
+ @i18n.japanese_date(date.strip, japanese_numbering: ja)
83
79
  end
84
80
 
85
81
  def edition_integer?(bibdata)
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Jis
3
- VERSION = "1.0.8".freeze
3
+ VERSION = "1.1.0".freeze
4
4
  end
5
5
  end
6
6
 
@@ -31,10 +31,10 @@ Gem::Specification.new do |spec|
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
32
32
 
33
33
  spec.add_dependency "japanese_calendar", "~> 0"
34
- spec.add_dependency "metanorma-iso", "~> 3.4.0"
34
+ spec.add_dependency "metanorma-iso", "~> 3.4.2"
35
35
  spec.add_dependency "pubid"
36
36
 
37
- spec.add_development_dependency "canon", "= 0.2.3"
37
+ spec.add_development_dependency "canon"# , "= 0.2.3"
38
38
  spec.add_development_dependency "debug"
39
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
40
40
  spec.add_development_dependency "guard", "~> 2.14"
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: 1.0.8
4
+ version: 1.1.0
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-04-27 00:00:00.000000000 Z
11
+ date: 2026-05-13 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: 3.4.0
33
+ version: 3.4.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: 3.4.0
40
+ version: 3.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pubid
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: canon
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.3
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.3
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debug
71
71
  requirement: !ruby/object:Gem::Requirement