pubid 2.0.0.pre.alpha.41 → 2.0.0.pre.alpha.43
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 +4 -4
- data/lib/pubid/bsi/CLAUDE.md +1 -1
- data/lib/pubid/identifier.rb +40 -3
- data/lib/pubid/parser/grammar.rb +0 -1
- data/lib/pubid/urn_parser/errors.rb +0 -2
- data/lib/pubid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c915fac429239e42864c114fd0dca2785ad263d1627c89ee39a6f3c256715e3
|
|
4
|
+
data.tar.gz: c0be866761e0cd25618b3a64de4b31a3cf411224cf3fa36777d252b62b94c38b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95dd99ebb2fd768ad3722805233f1cfb9ae7787a576fdb02c5848d978340dc4367266065213381335ea5c5149d40489ea2614df075c98354290f3b816ac9f77f
|
|
7
|
+
data.tar.gz: 2bc35c15d575a6952cf820d7ede48fb0439ccd4bd181a4c9cd5d2a5231c945520363be3d2000676c9ec52b03eece14c3f082ba1625ede01115208e83451f2bf8
|
data/lib/pubid/bsi/CLAUDE.md
CHANGED
|
@@ -90,4 +90,4 @@ The general fix (`metanorma__pubid__exclude-recursion-depth` hand-off) promotes
|
|
|
90
90
|
|
|
91
91
|
Verified: `spec/pubid/supplement_date_attributes_spec.rb` exercises the mechanism directly; `spec/pubid/bsi/parse_gaps_spec.rb`, `match_primitives_spec.rb` and `adoption_base_spec.rb`, and `spec/pubid/cen_cenelec/relaton_blockers_spec.rb`'s 10 pinned `:supplement_year` cases, all pass unchanged. Because the new logic only fires when `supplement_date_attributes` is non-empty, every other flavor (including ISO/IEC, which deliberately keep a supplement's year in `date` with no protection — see `lib/pubid/cen_cenelec/CLAUDE.md`) is untouched.
|
|
92
92
|
|
|
93
|
-
**Open question, not resolved here: `#dated_version_of?`/`#draft_of?` on a bare BSI supplement.** Both
|
|
93
|
+
**Open question, not resolved here: `#dated_version_of?`/`#draft_of?` on a bare BSI supplement.** Both compare `exclude(:date, :year[, …])`, which — like every other bare `:date`/`:year` exclusion — now protects a supplement's own date unless `:supplement_year` is also passed. Two standalone `BS 7273-4:2015+A1:2021`/`...+A1:2022` objects were `dated_version_of?` each other before this branch (BSI's old `year`-attribute dodge never protected against `exclude(:year)`) and are not after. **Whether that's the right answer is genuinely unclear and deliberately left open pending feedback** — one reading is that this just makes BSI consistent with CEN/CENELEC, which already behaved this way before this branch (its pre-existing per-flavor `#exclude` override had the same protection); the other is that these two generic relational predicates should be widened to accept a `:supplement_year`-aware exclusion set so they can still recognize two differently-dated editions of the *same supplement* as related. (The predicates switched from `matches?(other, ignore: …)` to the equivalent `exclude(…)` comparison so NIST's asymmetric `#matches?` override no longer breaks them; BSI behavior is unchanged.) Locked (as current behavior, not as a verdict) by `spec/pubid/supplement_date_attributes_spec.rb`.
|
data/lib/pubid/identifier.rb
CHANGED
|
@@ -1177,10 +1177,46 @@ module Pubid
|
|
|
1177
1177
|
|
|
1178
1178
|
# Self and +other+ refer to the same document but differ only in the
|
|
1179
1179
|
# trailing date / year — the "dated vs undated" reference pattern.
|
|
1180
|
+
# Compares #exclude, not #matches?: NIST overrides #matches? as an
|
|
1181
|
+
# asymmetric wildcard query (and takes no ignore: keyword).
|
|
1180
1182
|
def dated_version_of?(other)
|
|
1181
1183
|
return false unless other.is_a?(::Pubid::Identifier)
|
|
1182
1184
|
|
|
1183
|
-
|
|
1185
|
+
exclude(:date, :year) == other.exclude(:date, :year) && self != other
|
|
1186
|
+
end
|
|
1187
|
+
|
|
1188
|
+
# The attributes that carry a revision marker. Flavors spell it
|
|
1189
|
+
# differently: OGC and IEEE hold a string (+revision+), NIST folds the
|
|
1190
|
+
# lettered revision and its date into an +update+ component.
|
|
1191
|
+
REVISION_ATTRIBUTES = %i[revision update update_component].freeze
|
|
1192
|
+
|
|
1193
|
+
# The revision marker this identifier carries, or nil. See
|
|
1194
|
+
# REVISION_ATTRIBUTES.
|
|
1195
|
+
# @return [String, Components::Update, nil]
|
|
1196
|
+
def revision_marker
|
|
1197
|
+
REVISION_ATTRIBUTES.each do |name|
|
|
1198
|
+
next unless self.class.attributes.key?(name)
|
|
1199
|
+
|
|
1200
|
+
value = public_send(name)
|
|
1201
|
+
return value unless value.nil? || value == ""
|
|
1202
|
+
end
|
|
1203
|
+
nil
|
|
1204
|
+
end
|
|
1205
|
+
|
|
1206
|
+
# Self is a revision of +other+: the same document, where self carries a
|
|
1207
|
+
# revision marker ("OGC 06-121r9", "NBS LC 800 rJun1992") that +other+
|
|
1208
|
+
# lacks or spells differently. A document whose revision is modelled as
|
|
1209
|
+
# an edition is covered by #edition_of? instead.
|
|
1210
|
+
def revision_of?(other)
|
|
1211
|
+
return false unless other.is_a?(::Pubid::Identifier)
|
|
1212
|
+
return false if self == other
|
|
1213
|
+
return false if revision_marker.nil?
|
|
1214
|
+
|
|
1215
|
+
# #exclude, not #matches?: NIST overrides #matches? as an asymmetric
|
|
1216
|
+
# wildcard query (and takes no ignore: keyword), which would compare a
|
|
1217
|
+
# query against a candidate rather than two concrete documents.
|
|
1218
|
+
exclude(*REVISION_ATTRIBUTES) == other.exclude(*REVISION_ATTRIBUTES) &&
|
|
1219
|
+
revision_marker != other.revision_marker
|
|
1184
1220
|
end
|
|
1185
1221
|
|
|
1186
1222
|
# The document a wrapper stands in front of: a supplement's base, or
|
|
@@ -1289,7 +1325,8 @@ module Pubid
|
|
|
1289
1325
|
|
|
1290
1326
|
root == other.root &&
|
|
1291
1327
|
self != other &&
|
|
1292
|
-
|
|
1328
|
+
exclude(:date, :year, :stage, :typed_stage) ==
|
|
1329
|
+
other.exclude(:date, :year, :stage, :typed_stage)
|
|
1293
1330
|
end
|
|
1294
1331
|
|
|
1295
1332
|
# Self and +other+ are editions of the same document: the edition-year
|
|
@@ -1315,7 +1352,7 @@ module Pubid
|
|
|
1315
1352
|
# Any relational predicate holds.
|
|
1316
1353
|
def related_to?(other)
|
|
1317
1354
|
%i[supplement_of? has_supplement? dated_version_of? edition_of?
|
|
1318
|
-
sibling_of? includes? draft_of?].any? do |m|
|
|
1355
|
+
revision_of? sibling_of? includes? draft_of?].any? do |m|
|
|
1319
1356
|
public_send(m, other)
|
|
1320
1357
|
end
|
|
1321
1358
|
end
|
data/lib/pubid/parser/grammar.rb
CHANGED
data/lib/pubid/version.rb
CHANGED