relaton-bib 2.0.0 → 2.1.7
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/.github/workflows/integration-tests.yml +1 -1
- data/.github/workflows/rake.yml +1 -1
- data/CLAUDE.md +12 -0
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +2 -2
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +5 -2
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +7 -4
- data/lib/relaton/bib/hash_parser_v1.rb +17 -4
- data/lib/relaton/bib/model/bibdata.rb +2 -17
- data/lib/relaton/bib/model/bibdata_shared.rb +10 -0
- data/lib/relaton/bib/model/bibitem.rb +2 -16
- data/lib/relaton/bib/model/bibitem_shared.rb +10 -0
- data/lib/relaton/bib/model/contact.rb +0 -4
- data/lib/relaton/bib/model/contributor.rb +2 -44
- data/lib/relaton/bib/model/date.rb +0 -2
- data/lib/relaton/bib/model/docidentifier.rb +1 -0
- data/lib/relaton/bib/model/ext.rb +15 -6
- data/lib/relaton/bib/model/ics.rb +29 -3
- data/lib/relaton/bib/model/item.rb +24 -117
- data/lib/relaton/bib/model/item_base.rb +12 -19
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/localized_string.rb +11 -20
- data/lib/relaton/bib/model/organization.rb +0 -2
- data/lib/relaton/bib/model/organization_type.rb +0 -2
- data/lib/relaton/bib/model/relation.rb +1 -3
- data/lib/relaton/bib/model/series.rb +0 -2
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/version.rb +30 -1
- data/lib/relaton/bib/model_autoload.rb +85 -0
- data/lib/relaton/bib/sanitizer.rb +74 -0
- data/lib/relaton/bib/version.rb +1 -1
- data/{grammars → lib/relaton/bib}/versions.json +1 -1
- data/lib/relaton/bib.rb +5 -9
- data/relaton-bib.gemspec +2 -2
- metadata +17 -12
- data/grammars/basicdoc.rng +0 -2140
- data/grammars/biblio-compile.rng +0 -11
- data/grammars/biblio-standoc.rng +0 -268
- data/grammars/biblio.rng +0 -2129
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
# Shared attribute and XML mapping declarations for Item/Bibitem/Bibdata/ItemBase.
|
|
4
|
+
# Each class composes these with its own header (id/schema_version/fetched/ext)
|
|
5
|
+
# via instance_exec, so subtractive monkey-patching of inherited mappings is
|
|
6
|
+
# not needed.
|
|
7
|
+
module ItemShared
|
|
8
|
+
ATTRIBUTES = lambda do # rubocop:disable Metrics/BlockLength
|
|
9
|
+
attribute :type, :string, values: %W[
|
|
10
|
+
article book booklet manual proceedings presentation thesis techreport standard
|
|
11
|
+
unpublished map electronic\sresource audiovisual film video boradcast software
|
|
12
|
+
graphic_work music patent inbook incollection inproceedings journal website
|
|
13
|
+
webresource dataset archival social_media alert message convesation misc
|
|
14
|
+
]
|
|
15
|
+
attribute :formattedref, Formattedref
|
|
16
|
+
attribute :title, Title, collection: true, initialize_empty: true
|
|
17
|
+
attribute :source, Uri, collection: true, initialize_empty: true
|
|
18
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
19
|
+
attribute :docnumber, :string
|
|
20
|
+
attribute :date, Date, collection: true, initialize_empty: true
|
|
21
|
+
attribute :contributor, Contributor, collection: true, initialize_empty: true
|
|
22
|
+
attribute :edition, Edition
|
|
23
|
+
attribute :version, Version, collection: true, initialize_empty: true
|
|
24
|
+
attribute :note, Note, collection: true, initialize_empty: true
|
|
25
|
+
attribute :language, :string, collection: true, initialize_empty: true
|
|
26
|
+
attribute :locale, :string, collection: true, initialize_empty: true
|
|
27
|
+
attribute :script, :string, collection: true, initialize_empty: true
|
|
28
|
+
attribute :abstract, Abstract, collection: true, initialize_empty: true
|
|
29
|
+
attribute :status, Status
|
|
30
|
+
attribute :copyright, Copyright, collection: true, initialize_empty: true
|
|
31
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
32
|
+
attribute :series, Series, collection: true, initialize_empty: true
|
|
33
|
+
attribute :medium, Medium
|
|
34
|
+
attribute :place, Place, collection: true, initialize_empty: true
|
|
35
|
+
attribute :price, Price, collection: true, initialize_empty: true
|
|
36
|
+
attribute :extent, Extent, collection: true, initialize_empty: true
|
|
37
|
+
attribute :size, Size
|
|
38
|
+
attribute :accesslocation, :string, collection: true, initialize_empty: true
|
|
39
|
+
attribute :license, :string, collection: true, initialize_empty: true
|
|
40
|
+
attribute :classification, Docidentifier, collection: true, initialize_empty: true
|
|
41
|
+
attribute :keyword, Keyword, collection: true, initialize_empty: true
|
|
42
|
+
attribute :validity, Validity
|
|
43
|
+
attribute :depiction, Depiction, collection: true, initialize_empty: true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.prune_attribute(base, attr_name, xml_name)
|
|
47
|
+
return unless base.attributes.key?(attr_name)
|
|
48
|
+
|
|
49
|
+
xml_mapping = base.mappings[:xml]
|
|
50
|
+
xml_mapping.instance_variable_get(:@elements).delete(xml_name)
|
|
51
|
+
xml_mapping.instance_variable_get(:@attributes).delete(xml_name)
|
|
52
|
+
base.attributes.delete(attr_name)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
XML_BODY = lambda do # rubocop:disable Metrics/BlockLength
|
|
56
|
+
map_element "formattedref", to: :formattedref
|
|
57
|
+
map_element "title", to: :title
|
|
58
|
+
map_element "uri", to: :source
|
|
59
|
+
map_element "docidentifier", to: :docidentifier
|
|
60
|
+
map_element "docnumber", to: :docnumber
|
|
61
|
+
map_element "date", to: :date
|
|
62
|
+
map_element "contributor", to: :contributor
|
|
63
|
+
map_element "edition", to: :edition
|
|
64
|
+
map_element "version", to: :version
|
|
65
|
+
map_element "note", to: :note
|
|
66
|
+
map_element "language", to: :language
|
|
67
|
+
map_element "locale", to: :locale
|
|
68
|
+
map_element "script", to: :script
|
|
69
|
+
map_element "abstract", to: :abstract
|
|
70
|
+
map_element "status", to: :status
|
|
71
|
+
map_element "copyright", to: :copyright
|
|
72
|
+
map_element "relation", to: :relation
|
|
73
|
+
map_element "series", to: :series
|
|
74
|
+
map_element "medium", to: :medium
|
|
75
|
+
map_element "place", to: :place
|
|
76
|
+
map_element "price", to: :price
|
|
77
|
+
map_element "extent", to: :extent
|
|
78
|
+
map_element "size", to: :size
|
|
79
|
+
map_element "accesslocation", to: :accesslocation
|
|
80
|
+
map_element "license", to: :license
|
|
81
|
+
map_element "classification", to: :classification
|
|
82
|
+
map_element "keyword", to: :keyword
|
|
83
|
+
map_element "validity", to: :validity
|
|
84
|
+
map_element "depiction", to: :depiction
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -8,7 +8,7 @@ module Relaton
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
key_value do
|
|
11
|
-
map "content", to: :content
|
|
11
|
+
map "content", to: :content
|
|
12
12
|
map "language", to: :language
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -26,32 +26,23 @@ module Relaton
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
class LocalizedMarkedUpString < LocalizedStringAttrs
|
|
29
|
-
|
|
29
|
+
module ContentSanitization
|
|
30
|
+
def content=(value)
|
|
31
|
+
super(Relaton::Bib::Sanitizer.sanitize(value))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
attribute :content, :string, raw: true
|
|
36
|
+
prepend ContentSanitization
|
|
30
37
|
|
|
31
38
|
xml do
|
|
32
|
-
map_all to: :content
|
|
39
|
+
map_all to: :content
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
key_value do
|
|
36
|
-
map "content", to: :content
|
|
43
|
+
map "content", to: :content
|
|
37
44
|
map "language", to: :language
|
|
38
45
|
end
|
|
39
|
-
|
|
40
|
-
def content_from_xml(model, value)
|
|
41
|
-
model.content = value
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def content_to_xml(model, parent, doc)
|
|
45
|
-
doc.add_xml_fragment parent, model.content
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def content_from_key_value(model, value)
|
|
49
|
-
model.content = value
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def content_to_key_value(model, doc)
|
|
53
|
-
doc["content"] = model.content
|
|
54
|
-
end
|
|
55
46
|
end
|
|
56
47
|
end
|
|
57
48
|
end
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
require_relative "item_base"
|
|
2
|
-
|
|
3
1
|
module Relaton
|
|
4
2
|
module Bib
|
|
5
|
-
class Relation
|
|
3
|
+
class Relation < Lutaml::Model::Serializable
|
|
6
4
|
attribute :type, :string, values: %w[
|
|
7
5
|
includes includedIn hasPart partOf merges mergedInto splits splitInto
|
|
8
6
|
instanceOf hasInstance exemplarOf hasExemplar manifestationOf
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "date"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
# xs:date value type that always casts to ::Date, dropping any time and
|
|
6
|
+
# timezone component. Without this, lutaml-model's built-in Date type
|
|
7
|
+
# promotes inputs like "2018-04-15T00:00:00Z" to ::DateTime and serializes
|
|
8
|
+
# them back as "2018-04-15Z" — valid xs:date, but not valid ISO 8601.
|
|
9
|
+
class PlainDate < Lutaml::Model::Type::Date
|
|
10
|
+
def self.cast(value, options = {})
|
|
11
|
+
result = super
|
|
12
|
+
result.is_a?(::DateTime) ? result.to_date : result
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
module Relaton
|
|
2
2
|
module Bib
|
|
3
3
|
class Version < Lutaml::Model::Serializable
|
|
4
|
-
attribute :
|
|
4
|
+
attribute :type, :string
|
|
5
|
+
attribute :content, :string
|
|
6
|
+
attribute :revision_date, :string
|
|
5
7
|
attribute :draft, :string
|
|
6
8
|
|
|
7
9
|
xml do
|
|
8
10
|
root "version"
|
|
11
|
+
map_attribute "type", to: :type
|
|
12
|
+
map_content to: :content
|
|
9
13
|
map_element "revision-date", to: :revision_date
|
|
10
14
|
map_element "draft", to: :draft
|
|
11
15
|
end
|
|
16
|
+
|
|
17
|
+
key_value do
|
|
18
|
+
map "type", to: :type
|
|
19
|
+
map "content", to: :content
|
|
20
|
+
map "revision_date", to: :revision_date
|
|
21
|
+
map "draft", to: :draft
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def content
|
|
25
|
+
return @content if @content && !@content.empty?
|
|
26
|
+
|
|
27
|
+
parts = [@draft, @revision_date].compact
|
|
28
|
+
case parts.size
|
|
29
|
+
when 2 then "#{@draft} (#{@revision_date})"
|
|
30
|
+
when 1 then parts.first
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def revision_date
|
|
35
|
+
nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def draft
|
|
39
|
+
nil
|
|
40
|
+
end
|
|
12
41
|
end
|
|
13
42
|
end
|
|
14
43
|
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Central autoload manifest for the model + converter layer.
|
|
2
|
+
#
|
|
3
|
+
# Declaring these as autoloads (instead of a require_relative chain) makes load
|
|
4
|
+
# order irrelevant and removes the circular require between OrganizationType and
|
|
5
|
+
# Subdivision (issue #120): a constant is loaded on first reference rather than
|
|
6
|
+
# at file-load time, so mutually-referencing classes resolve each other lazily.
|
|
7
|
+
#
|
|
8
|
+
# lutaml-model must be available before the first model autoload fires, and the
|
|
9
|
+
# XML adapter must be configured eagerly here (not inside item.rb) so that
|
|
10
|
+
# serializing through any model class works regardless of which one is
|
|
11
|
+
# referenced first.
|
|
12
|
+
require "lutaml/model"
|
|
13
|
+
require "lutaml/xml"
|
|
14
|
+
|
|
15
|
+
Lutaml::Model::Config.configure do |config|
|
|
16
|
+
config.xml_adapter_type = :nokogiri
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module Relaton
|
|
20
|
+
module Bib
|
|
21
|
+
autoload :Abstract, "relaton/bib/model/abstract"
|
|
22
|
+
autoload :Address, "relaton/bib/model/address"
|
|
23
|
+
autoload :Affiliation, "relaton/bib/model/affiliation"
|
|
24
|
+
autoload :Bibdata, "relaton/bib/model/bibdata"
|
|
25
|
+
autoload :BibdataShared, "relaton/bib/model/bibdata_shared"
|
|
26
|
+
autoload :Bibitem, "relaton/bib/model/bibitem"
|
|
27
|
+
autoload :BibitemShared, "relaton/bib/model/bibitem_shared"
|
|
28
|
+
autoload :Contact, "relaton/bib/model/contact"
|
|
29
|
+
autoload :ContributionInfo, "relaton/bib/model/contribution_info"
|
|
30
|
+
autoload :Contributor, "relaton/bib/model/contributor"
|
|
31
|
+
autoload :Copyright, "relaton/bib/model/copyright"
|
|
32
|
+
autoload :Date, "relaton/bib/model/date"
|
|
33
|
+
autoload :Depiction, "relaton/bib/model/depiction"
|
|
34
|
+
autoload :Docidentifier, "relaton/bib/model/docidentifier"
|
|
35
|
+
autoload :Doctype, "relaton/bib/model/doctype"
|
|
36
|
+
autoload :Edition, "relaton/bib/model/edition"
|
|
37
|
+
autoload :Ext, "relaton/bib/model/ext"
|
|
38
|
+
autoload :Extent, "relaton/bib/model/extent"
|
|
39
|
+
autoload :Formattedref, "relaton/bib/model/formattedref"
|
|
40
|
+
autoload :FullName, "relaton/bib/model/fullname"
|
|
41
|
+
autoload :FullNameType, "relaton/bib/model/full_name_type"
|
|
42
|
+
autoload :ICS, "relaton/bib/model/ics"
|
|
43
|
+
autoload :Image, "relaton/bib/model/image"
|
|
44
|
+
autoload :Item, "relaton/bib/model/item"
|
|
45
|
+
autoload :ItemBase, "relaton/bib/model/item_base"
|
|
46
|
+
autoload :ItemShared, "relaton/bib/model/item_shared"
|
|
47
|
+
autoload :Keyword, "relaton/bib/model/keyword"
|
|
48
|
+
autoload :Locality, "relaton/bib/model/locality"
|
|
49
|
+
autoload :LocalityStack, "relaton/bib/model/locality_stack"
|
|
50
|
+
# localized_string.rb defines three top-level constants:
|
|
51
|
+
autoload :LocalizedString, "relaton/bib/model/localized_string"
|
|
52
|
+
autoload :TypedLocalizedString, "relaton/bib/model/localized_string"
|
|
53
|
+
autoload :LocalizedMarkedUpString, "relaton/bib/model/localized_string"
|
|
54
|
+
autoload :LocalizedStringAttrs, "relaton/bib/model/localized_string_attrs"
|
|
55
|
+
autoload :Logo, "relaton/bib/model/logo"
|
|
56
|
+
autoload :Medium, "relaton/bib/model/medium"
|
|
57
|
+
autoload :Note, "relaton/bib/model/note"
|
|
58
|
+
autoload :Organization, "relaton/bib/model/organization"
|
|
59
|
+
autoload :OrganizationType, "relaton/bib/model/organization_type"
|
|
60
|
+
autoload :Person, "relaton/bib/model/person"
|
|
61
|
+
autoload :Phone, "relaton/bib/model/phone"
|
|
62
|
+
autoload :Place, "relaton/bib/model/place"
|
|
63
|
+
# type/ is only a directory; these constants are top-level under Bib:
|
|
64
|
+
autoload :PlainDate, "relaton/bib/model/type/plain_date"
|
|
65
|
+
autoload :StringDate, "relaton/bib/model/type/string_date"
|
|
66
|
+
autoload :Price, "relaton/bib/model/price"
|
|
67
|
+
autoload :Relation, "relaton/bib/model/relation"
|
|
68
|
+
autoload :Series, "relaton/bib/model/series"
|
|
69
|
+
autoload :Size, "relaton/bib/model/size"
|
|
70
|
+
autoload :SourceLocalityStack, "relaton/bib/model/source_locality_stack"
|
|
71
|
+
autoload :Status, "relaton/bib/model/status"
|
|
72
|
+
autoload :StructuredIdentifier, "relaton/bib/model/structured_identifier"
|
|
73
|
+
autoload :Subdivision, "relaton/bib/model/subdivision"
|
|
74
|
+
autoload :Title, "relaton/bib/model/title"
|
|
75
|
+
autoload :Uri, "relaton/bib/model/uri"
|
|
76
|
+
autoload :Validity, "relaton/bib/model/validity"
|
|
77
|
+
autoload :Version, "relaton/bib/model/version"
|
|
78
|
+
|
|
79
|
+
module Converter
|
|
80
|
+
autoload :BibXml, "relaton/bib/converter/bibxml"
|
|
81
|
+
autoload :Bibtex, "relaton/bib/converter/bibtex"
|
|
82
|
+
autoload :Asciibib, "relaton/bib/converter/asciibib"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
require "nokogiri"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
# Strips inline markup not in the basicdoc PureTextElement set
|
|
6
|
+
# (plus <p>, <eref>, <xref>, <fn>, <link>) from raw marked-up content
|
|
7
|
+
# strings. Disallowed elements are unwrapped: tags removed, inner text
|
|
8
|
+
# kept.
|
|
9
|
+
#
|
|
10
|
+
# <link> is admitted because basicdoc expresses external hyperlinks as
|
|
11
|
+
# <link target="...">; without it a from_xml -> to_xml round-trip drops
|
|
12
|
+
# the tag and its target URL, keeping only the link text (see #122,
|
|
13
|
+
# which broke metanorma amend()).
|
|
14
|
+
#
|
|
15
|
+
# <fn> is admitted beyond strict PureTextElement because bibliographic
|
|
16
|
+
# titles in real Metanorma input routinely carry footnotes (e.g. ISO
|
|
17
|
+
# standards titles with a disclaimer footnote), and downstream
|
|
18
|
+
# consumers — notably relaton-render's own inline-tag allow-list —
|
|
19
|
+
# already accept <fn> as a legitimate child of <title>. Stripping it
|
|
20
|
+
# here would break the round-trip.
|
|
21
|
+
#
|
|
22
|
+
# OPAQUE elements (currently <stem>) are also allowed, but the
|
|
23
|
+
# sanitiser does not descend into them: their contents are out-of-band
|
|
24
|
+
# inline notation (MathML, AsciiMath, LaTeX) rather than basicdoc
|
|
25
|
+
# markup, and must be preserved verbatim. Without the opaque-skip,
|
|
26
|
+
# the recursive walk would unwrap MathML / AsciiMath elements down to
|
|
27
|
+
# bare text nodes — see #116 for the round-trip-loss symptom.
|
|
28
|
+
module Sanitizer
|
|
29
|
+
ALLOWED = %w[
|
|
30
|
+
em strong sub sup tt underline strike smallcap br stem
|
|
31
|
+
p eref xref fn link
|
|
32
|
+
].freeze
|
|
33
|
+
|
|
34
|
+
# Elements whose children are non-basicdoc inline notation
|
|
35
|
+
# (MathML, AsciiMath, LaTeX, …) and must be preserved verbatim
|
|
36
|
+
# rather than sanitised against ALLOWED.
|
|
37
|
+
OPAQUE = %w[stem].freeze
|
|
38
|
+
|
|
39
|
+
RENAME = {
|
|
40
|
+
"italic" => "em",
|
|
41
|
+
}.freeze
|
|
42
|
+
|
|
43
|
+
TAG_RX = %r{<[a-zA-Z/!?]}
|
|
44
|
+
|
|
45
|
+
def self.sanitize(content)
|
|
46
|
+
return content unless sanitizable?(content)
|
|
47
|
+
|
|
48
|
+
fragment = Nokogiri::XML::DocumentFragment.parse(content)
|
|
49
|
+
return content if fragment.errors.any?
|
|
50
|
+
|
|
51
|
+
sanitize_children(fragment)
|
|
52
|
+
fragment.children.map { |c| c.to_xml(encoding: "UTF-8") }.join
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.sanitizable?(content)
|
|
56
|
+
content.is_a?(::String) && !content.empty? && content.match?(TAG_RX)
|
|
57
|
+
end
|
|
58
|
+
private_class_method :sanitizable?
|
|
59
|
+
|
|
60
|
+
def self.sanitize_children(node)
|
|
61
|
+
node.children.to_a.each do |child|
|
|
62
|
+
next unless child.element?
|
|
63
|
+
|
|
64
|
+
child.name = RENAME[child.name] if RENAME.key?(child.name)
|
|
65
|
+
next if OPAQUE.include?(child.name)
|
|
66
|
+
|
|
67
|
+
sanitize_children(child)
|
|
68
|
+
child.replace(child.children) unless ALLOWED.include?(child.name)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
private_class_method :sanitize_children
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/relaton/bib/version.rb
CHANGED
data/lib/relaton/bib.rb
CHANGED
|
@@ -7,16 +7,12 @@ require "rfcxml"
|
|
|
7
7
|
require "relaton/core"
|
|
8
8
|
require_relative "bib/version"
|
|
9
9
|
require_relative "bib/util"
|
|
10
|
+
require_relative "bib/sanitizer"
|
|
10
11
|
require_relative "bib/namespace_helper"
|
|
12
|
+
# Model and converter classes are wired via autoload (see model_autoload.rb) so
|
|
13
|
+
# that load order is irrelevant and mutually-referencing classes resolve lazily.
|
|
14
|
+
require_relative "bib/model_autoload"
|
|
11
15
|
require_relative "bib/item_data"
|
|
12
|
-
require_relative "bib/model/item"
|
|
13
|
-
require_relative "bib/model/item_base"
|
|
14
|
-
require_relative "bib/model/bibitem"
|
|
15
|
-
require_relative "bib/model/bibdata"
|
|
16
|
-
require_relative "bib/converter/bibxml"
|
|
17
|
-
require_relative "bib/converter/bibtex"
|
|
18
|
-
require_relative "bib/converter/asciibib"
|
|
19
|
-
require_relative "bib/model/relation"
|
|
20
16
|
|
|
21
17
|
module Relaton
|
|
22
18
|
# class Error < StandardError; end
|
|
@@ -30,7 +26,7 @@ module Relaton
|
|
|
30
26
|
# @return [Hash{String=>String}] schema versions
|
|
31
27
|
#
|
|
32
28
|
def schema_versions
|
|
33
|
-
@@schema_versions ||= JSON.parse File.read(File.join(__dir__, "
|
|
29
|
+
@@schema_versions ||= JSON.parse File.read(File.join(__dir__, "bib/versions.json"))
|
|
34
30
|
end
|
|
35
31
|
end
|
|
36
32
|
|
data/relaton-bib.gemspec
CHANGED
|
@@ -26,10 +26,10 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.add_dependency "bibtex-ruby"
|
|
27
27
|
spec.add_dependency "iso639"
|
|
28
28
|
spec.add_dependency "isoics", "~> 0.1.0"
|
|
29
|
-
spec.add_dependency "lutaml-model", "~> 0.
|
|
29
|
+
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
30
30
|
spec.add_dependency "nokogiri", ">= 1.16"
|
|
31
31
|
spec.add_dependency "psych", "~> 5.2.0" # versin 5.3.0 crashes
|
|
32
32
|
spec.add_dependency "relaton-core", "~> 0.0.8"
|
|
33
33
|
spec.add_dependency "relaton-logger", "~> 0.2.0"
|
|
34
|
-
spec.add_dependency "rfcxml", "~> 0.
|
|
34
|
+
spec.add_dependency "rfcxml", "~> 0.4.3"
|
|
35
35
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-07-31 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: bibtex-ruby
|
|
@@ -57,14 +58,14 @@ dependencies:
|
|
|
57
58
|
requirements:
|
|
58
59
|
- - "~>"
|
|
59
60
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
61
|
+
version: 0.8.0
|
|
61
62
|
type: :runtime
|
|
62
63
|
prerelease: false
|
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
65
|
requirements:
|
|
65
66
|
- - "~>"
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
68
|
+
version: 0.8.0
|
|
68
69
|
- !ruby/object:Gem::Dependency
|
|
69
70
|
name: nokogiri
|
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -127,14 +128,14 @@ dependencies:
|
|
|
127
128
|
requirements:
|
|
128
129
|
- - "~>"
|
|
129
130
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: 0.
|
|
131
|
+
version: 0.4.3
|
|
131
132
|
type: :runtime
|
|
132
133
|
prerelease: false
|
|
133
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
134
135
|
requirements:
|
|
135
136
|
- - "~>"
|
|
136
137
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: 0.
|
|
138
|
+
version: 0.4.3
|
|
138
139
|
description: 'Relaton::Bib: Ruby XMLDOC impementation.'
|
|
139
140
|
email:
|
|
140
141
|
- open.source@ribose.com
|
|
@@ -159,11 +160,6 @@ files:
|
|
|
159
160
|
- bin/rspec
|
|
160
161
|
- bin/setup
|
|
161
162
|
- docs/hash.adoc
|
|
162
|
-
- grammars/basicdoc.rng
|
|
163
|
-
- grammars/biblio-compile.rng
|
|
164
|
-
- grammars/biblio-standoc.rng
|
|
165
|
-
- grammars/biblio.rng
|
|
166
|
-
- grammars/versions.json
|
|
167
163
|
- lib/relaton/bib.rb
|
|
168
164
|
- lib/relaton/bib/converter/asciibib.rb
|
|
169
165
|
- lib/relaton/bib/converter/asciibib/to_asciibib.rb
|
|
@@ -181,7 +177,9 @@ files:
|
|
|
181
177
|
- lib/relaton/bib/model/address.rb
|
|
182
178
|
- lib/relaton/bib/model/affiliation.rb
|
|
183
179
|
- lib/relaton/bib/model/bibdata.rb
|
|
180
|
+
- lib/relaton/bib/model/bibdata_shared.rb
|
|
184
181
|
- lib/relaton/bib/model/bibitem.rb
|
|
182
|
+
- lib/relaton/bib/model/bibitem_shared.rb
|
|
185
183
|
- lib/relaton/bib/model/contact.rb
|
|
186
184
|
- lib/relaton/bib/model/contribution_info.rb
|
|
187
185
|
- lib/relaton/bib/model/contributor.rb
|
|
@@ -200,6 +198,7 @@ files:
|
|
|
200
198
|
- lib/relaton/bib/model/image.rb
|
|
201
199
|
- lib/relaton/bib/model/item.rb
|
|
202
200
|
- lib/relaton/bib/model/item_base.rb
|
|
201
|
+
- lib/relaton/bib/model/item_shared.rb
|
|
203
202
|
- lib/relaton/bib/model/keyword.rb
|
|
204
203
|
- lib/relaton/bib/model/locality.rb
|
|
205
204
|
- lib/relaton/bib/model/locality_stack.rb
|
|
@@ -222,18 +221,23 @@ files:
|
|
|
222
221
|
- lib/relaton/bib/model/structured_identifier.rb
|
|
223
222
|
- lib/relaton/bib/model/subdivision.rb
|
|
224
223
|
- lib/relaton/bib/model/title.rb
|
|
224
|
+
- lib/relaton/bib/model/type/plain_date.rb
|
|
225
225
|
- lib/relaton/bib/model/type/string_date.rb
|
|
226
226
|
- lib/relaton/bib/model/uri.rb
|
|
227
227
|
- lib/relaton/bib/model/validity.rb
|
|
228
228
|
- lib/relaton/bib/model/version.rb
|
|
229
|
+
- lib/relaton/bib/model_autoload.rb
|
|
229
230
|
- lib/relaton/bib/namespace_helper.rb
|
|
231
|
+
- lib/relaton/bib/sanitizer.rb
|
|
230
232
|
- lib/relaton/bib/util.rb
|
|
231
233
|
- lib/relaton/bib/version.rb
|
|
234
|
+
- lib/relaton/bib/versions.json
|
|
232
235
|
- relaton-bib.gemspec
|
|
233
236
|
homepage: https://github.com/relaton/relaton-bib
|
|
234
237
|
licenses:
|
|
235
238
|
- BSD-2-Clause
|
|
236
239
|
metadata: {}
|
|
240
|
+
post_install_message:
|
|
237
241
|
rdoc_options: []
|
|
238
242
|
require_paths:
|
|
239
243
|
- lib
|
|
@@ -248,7 +252,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
248
252
|
- !ruby/object:Gem::Version
|
|
249
253
|
version: '0'
|
|
250
254
|
requirements: []
|
|
251
|
-
rubygems_version: 3.
|
|
255
|
+
rubygems_version: 3.5.22
|
|
256
|
+
signing_key:
|
|
252
257
|
specification_version: 4
|
|
253
258
|
summary: 'Relaton::Bib: Ruby XMLDOC impementation.'
|
|
254
259
|
test_files: []
|