relaton 3.1.0 → 3.1.1
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/relaton/cli/command.rb +6 -4
- data/lib/relaton/iec/bibliography.rb +32 -20
- data/lib/relaton/render.rb +17 -0
- data/lib/relaton/sae/CLAUDE.md +3 -1
- data/lib/relaton/sae/data_fetcher.rb +5 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton-render.rb +4 -10
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9eef3d372dd9873e179368bed9c4e49f80484881fd0e469db1e07ff2dbb7568
|
|
4
|
+
data.tar.gz: de460fda09be00fbe2580a2cb4c1fb6cb0beea9009519c84fa46b91cbb3e39fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e42b68c6b256aebf17a83184db8939e286dfd70a7274ebe918619cb966277fd89607894207ca767e1d9b2cad59810bfa719284cdbb1b26168780a476086cda2
|
|
7
|
+
data.tar.gz: 26ca0ae9cf979c22d944bc0981048668e8d035983825f49ba6915d452604e39de17f51a6a025fc8d7ca71a068c5f8694d22f7b73668adc84cc2b407f82765d69
|
data/lib/relaton/cli/command.rb
CHANGED
|
@@ -234,10 +234,12 @@ module Relaton
|
|
|
234
234
|
result = if /yaml|yml/.match?(options[:format])
|
|
235
235
|
item.to_yaml
|
|
236
236
|
elsif options[:format] == "citation"
|
|
237
|
-
#
|
|
238
|
-
# the
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
# Lazy: the render engine loads on the first citation
|
|
238
|
+
# request; the yaml/bibtex paths never pay for it. The
|
|
239
|
+
# facade file both entries resolve through (the
|
|
240
|
+
# consolidated surface, lib/relaton/render.rb) already
|
|
241
|
+
# requires iso690 — general is its autoload target.
|
|
242
|
+
require_relative "../../relaton/render"
|
|
241
243
|
Relaton::Render::General
|
|
242
244
|
.new(style: options[:style] || "author-date")
|
|
243
245
|
.render(item, embedded: true)
|
|
@@ -25,32 +25,30 @@ module Relaton
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# @param ref [String, Pubid::Iec::Identifier] the IEC standard code to
|
|
28
|
-
# look up (e.g. "IEC 8000"), or the parse
|
|
29
|
-
# with (relaton#205); a pubid is never mutated
|
|
28
|
+
# look up (e.g. "IEC 8000", "IEC 80000 (all parts)"), or the parse
|
|
29
|
+
# that Relaton::Db routed with (relaton#205); a pubid is never mutated
|
|
30
30
|
# @param year [String] the year the standard was published (optional)
|
|
31
|
-
# @param opts [Hash] options;
|
|
32
|
-
# reference is
|
|
31
|
+
# @param opts [Hash] options; `:all_parts` asks for all parts of a
|
|
32
|
+
# reference that does not say so itself. The hash is not changed.
|
|
33
33
|
# @return [Relaton::Iec::ItemData, nil]
|
|
34
|
-
def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
34
|
+
def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
35
35
|
if ref.is_a?(String)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
pubid = ::Pubid::Iec::Identifier.parse text.upcase
|
|
41
|
-
elsif ref.all_parts?
|
|
42
|
-
opts[:all_parts] = true
|
|
43
|
-
pubid = ref.identifiers.first
|
|
44
|
-
else
|
|
45
|
-
pubid = ref
|
|
36
|
+
return iev if ref.strip.casecmp?("IEV")
|
|
37
|
+
|
|
38
|
+
ref = parse_ref ref
|
|
46
39
|
end
|
|
40
|
+
# The pubid says whether all parts are asked for (relaton-iec#64):
|
|
41
|
+
# the option is folded into it, as Core::Processor#cache_key does.
|
|
42
|
+
ref = ref.to_all_parts if opts[:all_parts] && !ref.all_parts?
|
|
43
|
+
all_parts = ref.all_parts?
|
|
44
|
+
pubid = all_parts ? ref.identifiers.first : ref
|
|
47
45
|
if year
|
|
48
46
|
# Copy first: a caller's pubid is also its Db cache key.
|
|
49
47
|
pubid = pubid.class.from_hash(pubid.to_hash)
|
|
50
48
|
pubid.date = ::Pubid::Components::Date.new(year: year.to_s)
|
|
51
49
|
end
|
|
52
50
|
|
|
53
|
-
ret = iecbib_get(pubid, opts)
|
|
51
|
+
ret = iecbib_get(pubid, all_parts, opts)
|
|
54
52
|
return nil if ret.nil?
|
|
55
53
|
|
|
56
54
|
ret = ret.to_most_recent_reference unless pubid.date&.year || opts[:keep_year] ||
|
|
@@ -98,17 +96,31 @@ module Relaton
|
|
|
98
96
|
)
|
|
99
97
|
end
|
|
100
98
|
|
|
101
|
-
#
|
|
99
|
+
# The reference as written, else upcased: pubid reads the other
|
|
100
|
+
# components only in upper case, and `(all parts)` only in lower
|
|
101
|
+
# case, so the upcase keeps that suffix as pubid spells it.
|
|
102
|
+
#
|
|
103
|
+
# @param ref [String]
|
|
104
|
+
# @return [Pubid::Iec::Identifier]
|
|
105
|
+
def parse_ref(ref)
|
|
106
|
+
::Pubid::Iec::Identifier.parse ref
|
|
107
|
+
rescue ::Pubid::Errors::Error
|
|
108
|
+
::Pubid::Iec::Identifier.parse ref.upcase.sub("(ALL PARTS)", "(all parts)")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# @param pubid [Pubid::Iec::Identifier] the document (the inner
|
|
112
|
+
# identifier of an all-parts reference)
|
|
113
|
+
# @param all_parts [Boolean] all parts of the document are asked for
|
|
102
114
|
# @param opts [Hash]
|
|
103
115
|
# @return [Relaton::Iec::ItemData, nil]
|
|
104
|
-
def iecbib_get(pubid, opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
116
|
+
def iecbib_get(pubid, all_parts, opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
105
117
|
Util.info "Fetching from Relaton repository ...", key: pubid.to_s
|
|
106
118
|
# pubid 2.x splits multi-level numbers ("61326-2-6") into part +
|
|
107
119
|
# subpart, so all-parts matching must ignore subpart too.
|
|
108
|
-
exclude =
|
|
120
|
+
exclude = all_parts ? %i[year part subpart] : %i[year]
|
|
109
121
|
result = search(pubid, exclude: exclude) || return
|
|
110
122
|
|
|
111
|
-
if
|
|
123
|
+
if all_parts
|
|
112
124
|
ret = result.to_all_parts(pubid.date&.year&.to_s, opts)
|
|
113
125
|
Util.info "Found: `#{ret&.docidentifier&.first&.content}`", key: pubid.to_s if ret
|
|
114
126
|
return ret
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# The rendering surface of the consolidated gem — the `relaton/render`
|
|
4
|
+
# entry the standalone relaton-render gem served as its primary require
|
|
5
|
+
# path. `require "relaton-render"` (the hyphen umbrella in
|
|
6
|
+
# lib/relaton-render.rb) resolves to this same surface: one gem ships
|
|
7
|
+
# both codebases, so both spellings must keep working, and neither may
|
|
8
|
+
# fall through to a still-bundled retired gem.
|
|
9
|
+
require_relative "render/iso690"
|
|
10
|
+
|
|
11
|
+
module Relaton
|
|
12
|
+
module Render
|
|
13
|
+
# A bibliographic item whose style template resolves to nothing: the
|
|
14
|
+
# single-item API raises, the batch API skips
|
|
15
|
+
class Unrenderable < StandardError; end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/relaton/sae/CLAUDE.md
CHANGED
|
@@ -37,7 +37,9 @@ therefore index-based, the ECMA/IALA shape:
|
|
|
37
37
|
a partial crawl would publish a partial index). Each work goes through
|
|
38
38
|
`Relaton::Doi::Parser`, then gets SAE's code as its **primary**
|
|
39
39
|
docidentifier (type `SAE`), the DOI beside it, and `ext` doctype
|
|
40
|
-
`standard`, flavor `sae`.
|
|
40
|
+
`standard`, flavor `sae`. `fetched` is cleared: a data file carries no
|
|
41
|
+
fetch date, or every daily crawl would rewrite and commit all ~47,700
|
|
42
|
+
files. `Bibliography#fetch_doc` sets it when it reads a document.
|
|
41
43
|
- **Consumer** — `Bibliography.get` reads the `relaton-data-sae` Pages index
|
|
42
44
|
(`PAGES_URL`) and the document from `ENDPOINT` (raw GitHub).
|
|
43
45
|
|
|
@@ -153,10 +153,15 @@ module Relaton
|
|
|
153
153
|
# The `Relaton::Doi::Parser` item, with SAE's edition code (as SAE
|
|
154
154
|
# prints it) as its primary identifier and the DOI kept beside it.
|
|
155
155
|
#
|
|
156
|
+
# `Doi::Parser` stamps today as `fetched`. A data file must not carry
|
|
157
|
+
# it: the daily crawl would then rewrite every file and commit the
|
|
158
|
+
# whole corpus. `Bibliography#fetch_doc` sets `fetched` on reading.
|
|
159
|
+
#
|
|
156
160
|
# @return [Relaton::Sae::ItemData]
|
|
157
161
|
#
|
|
158
162
|
def to_item(work, code)
|
|
159
163
|
bib = Relaton::Doi::Parser.parse work
|
|
164
|
+
bib.fetched = nil
|
|
160
165
|
bib.id = code.native.delete(" /").gsub(/\W/, "")
|
|
161
166
|
bib.docidentifier = [
|
|
162
167
|
Bib::Docidentifier.new(type: "SAE", content: code.printed,
|
data/lib/relaton/version.rb
CHANGED
data/lib/relaton-render.rb
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# A bibliographic item whose style template resolves to nothing: the
|
|
8
|
-
# single-item API raises, the batch API skips
|
|
9
|
-
class Unrenderable < StandardError; end
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
end
|
|
3
|
+
# Compatibility umbrella: the standalone relaton-render gem's documented
|
|
4
|
+
# require entry. The surface lives at lib/relaton/render.rb — one gem
|
|
5
|
+
# ships both codebases, so both spellings resolve inside relaton.
|
|
6
|
+
require_relative "relaton/render"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.
|
|
4
|
+
version: 3.1.1
|
|
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-11-
|
|
11
|
+
date: 2026-11-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -1339,6 +1339,7 @@ files:
|
|
|
1339
1339
|
- lib/relaton/plateau/processor.rb
|
|
1340
1340
|
- lib/relaton/plateau/technical_report_parser.rb
|
|
1341
1341
|
- lib/relaton/plateau/util.rb
|
|
1342
|
+
- lib/relaton/render.rb
|
|
1342
1343
|
- lib/relaton/render/general.rb
|
|
1343
1344
|
- lib/relaton/render/iso690.rb
|
|
1344
1345
|
- lib/relaton/render/iso690/csl_import.rb
|