relaton-iso 2.1.4 → 2.1.6

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: 4e06532fd1563bdae0e1137e3e842ec270a4f0e45d42e7fc532428a0766bf008
4
- data.tar.gz: 6ad087eaf95601391cd4ebc3d8b1f3cc2f0912e7d1bfdce98ed11cd2d14d8100
3
+ metadata.gz: dfc58ff6f6e1879fa58edcadc327b4c09091c44b67b361d9498269615f9aff3d
4
+ data.tar.gz: 20effb98b3a9610b3ee266a6a84ac8c765162f3453eda27020d80b7ed7edae53
5
5
  SHA512:
6
- metadata.gz: 6bf56824fb8031231bd6d27a83d5a2e098c042ae5b97df76f5e03e37b0f6756d5bff18087655cd234668bf4785fae93f05a46be7a9cd1f29a5c6b15866a372f0
7
- data.tar.gz: bfbdda43f52afd0a5cae3a2d509026e46a9ef2422534a7e48baecea7f239b6c832099eba829dd4034e6d7b72123d3268eade771c6a0bae985a3999d92cb98036
6
+ metadata.gz: c878b64ec8647beae4b96572a7bb1866b11996d1dd6c785006cd0bd636da7d4344af5492992b2056824179e197d0cb51e6e4763d2ebe7b64f39bb12a05b994e1
7
+ data.tar.gz: f03a1cfec87b3593dbf19d7f7d08f07ceb35d5ee1fafbb3295866027d9e31e09f6a5f2dbf547fff5af16adec285ffa9466426be2b9dd83c20317c3a2b438d3f1
@@ -57,12 +57,14 @@ module Relaton
57
57
 
58
58
  response_pubid = ret.docidentifier.find(&:primary) # .sub(" (all parts)", "")
59
59
  Util.info "Found: `#{response_pubid}`", key: query_pubid.to_s
60
- get_all = (query_pubid.root.year && opts[:keep_year].nil?) || opts[:keep_year] || opts[:all_parts] ||
61
- opts[:publication_date_before] || opts[:publication_date_after]
62
- if get_all
63
- filter_item_by_date(ret, opts) if date_filter
64
- return ret
65
- end
60
+ # A publication-date cutoff only bounds which edition is selected; it must
61
+ # not by itself retain the year. An undated citation stays undated (year
62
+ # stripped) unless the citation genuinely asks for a year via an explicit
63
+ # year, keep_year, or all_parts.
64
+ filter_item_by_date(ret, opts) if date_filter
65
+ get_all = (query_pubid.root.year && opts[:keep_year].nil?) ||
66
+ opts[:keep_year] || opts[:all_parts]
67
+ return ret if get_all
66
68
 
67
69
  ret.to_most_recent_reference
68
70
  rescue ::Pubid::Core::Errors::ParseError
@@ -126,6 +128,7 @@ module Relaton
126
128
  # @param opts [Hash]
127
129
  def filter_item_by_date(item, opts)
128
130
  if item.relation&.any?
131
+ rewind_withdrawn_status(item, opts)
129
132
  item.relation.reject! { |rel| relation_outside_date_range?(rel, opts) }
130
133
  end
131
134
 
@@ -140,6 +143,29 @@ module Relaton
140
143
  end
141
144
  end
142
145
 
146
+ # ISO harmonized stage 95.99 = withdrawn, 60.60 = published. relaton stores
147
+ # only the current stage with no history, but a standard withdrawn by a
148
+ # successor published *after* the cutoff was, as of the cutoff, still the
149
+ # current (published) edition. Rewind 95 -> 60 in that case so a citing
150
+ # document does not render an anachronistic "withdrawn/replaced" annotation.
151
+ # A withdrawal with no obsoletedBy successor (or one that predates the
152
+ # cutoff) is left untouched. metanorma/metanorma-standoc#941.
153
+ # @param item [Relaton::Iso::ItemData]
154
+ # @param opts [Hash]
155
+ def rewind_withdrawn_status(item, opts)
156
+ cutoff = opts[:publication_date_before] or return
157
+ st = item.status or return
158
+ (st.stage&.content == "95" && st.substage&.content == "99") or return
159
+
160
+ obs = item.relation.select { |rel| rel.type == "obsoletedBy" }
161
+ return if obs.empty?
162
+ # Only rewind when every obsoleting successor postdates the cutoff.
163
+ obs.all? { |rel| (d = relation_date(rel)) && d >= cutoff } or return
164
+
165
+ st.stage.content = "60"
166
+ st.substage.content = "60"
167
+ end
168
+
143
169
  # Check if a relation's bibitem date falls outside the given date range.
144
170
  # @param rel [Relaton::Iso::Relation]
145
171
  # @param opts [Hash]
@@ -37,6 +37,7 @@ module Relaton
37
37
  "Cor" => "technical-corrigendum",
38
38
  "Add" => "addendum",
39
39
  "Suppl" => "supplement",
40
+ "Ext" => "extract",
40
41
  }.freeze
41
42
 
42
43
  DOC_URL = "https://www.iso.org/standard/%d.html"
@@ -4,7 +4,7 @@ module Relaton
4
4
  TYPES = %w[
5
5
  international-standard technical-specification technical-report publicly-available-specification
6
6
  international-workshop-agreement guide recommendation amendment technical-corrigendum directive
7
- committee-document addendum supplement
7
+ committee-document addendum supplement extract
8
8
  ].freeze
9
9
 
10
10
  attribute :content, :string, values: TYPES
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Iso
5
- VERSION = "2.1.4"
5
+ VERSION = "2.1.6"
6
6
  end
7
7
  end
data/relaton-iso.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
28
28
 
29
29
  spec.add_dependency "isoics", "~> 0.1.6"
30
- spec.add_dependency "pubid-iso", "~> 1.15.8"
30
+ spec.add_dependency "pubid-iso", "~> 1.15.20"
31
31
  spec.add_dependency "relaton-bib", "~> 2.1.0"
32
32
  spec.add_dependency "relaton-core", "~> 0.0.12"
33
33
  spec.add_dependency "relaton-index", "~> 0.2.12"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-17 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isoics
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.15.8
33
+ version: 1.15.20
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: 1.15.8
40
+ version: 1.15.20
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaton-bib
43
43
  requirement: !ruby/object:Gem::Requirement