relaton-iso 2.1.5 → 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: 36e773a9fdc9851a0b9efa4fdbbcf9d34c22ad2cb55ac34fb1af86974273a48c
4
- data.tar.gz: 587a6518297383f705e02cf9db43f28fa3824c6129b379e25fd5aaaa24c9db91
3
+ metadata.gz: dfc58ff6f6e1879fa58edcadc327b4c09091c44b67b361d9498269615f9aff3d
4
+ data.tar.gz: 20effb98b3a9610b3ee266a6a84ac8c765162f3453eda27020d80b7ed7edae53
5
5
  SHA512:
6
- metadata.gz: 58c4fe78b4a8b42272a6d24f3ad72f4e3308d0536913ab910f60b734aeaea2dea7f036d60733923566998bef6e1b2980fa718aea3fcdf7e08d97475876e7a833
7
- data.tar.gz: f269f06947f7051219053f4247a7c1bc664b46cbd430e43567d5a76f6c94371a5224c26ff93102380ceb42100d96b618b168a51319847b0203d3fe875ce5582c
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]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Iso
5
- VERSION = "2.1.5"
5
+ VERSION = "2.1.6"
6
6
  end
7
7
  end
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.5
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-27 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