relaton-bib 1.20.8 → 2.0.0
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/.gitignore +3 -1
- data/.rubocop.yml +1 -1
- data/CLAUDE.md +96 -0
- data/Gemfile +1 -4
- data/README.adoc +195 -154
- data/bin/console +1 -1
- data/grammars/basicdoc.rng +1572 -671
- data/grammars/biblio-standoc.rng +107 -46
- data/grammars/biblio.rng +1012 -377
- data/grammars/versions.json +26 -26
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +383 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +305 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +754 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +24 -0
- data/lib/relaton/bib/model/bibitem.rb +23 -0
- data/lib/relaton/bib/model/contact.rb +18 -0
- data/lib/relaton/bib/model/contribution_info.rb +16 -0
- data/lib/relaton/bib/model/contributor.rb +71 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +31 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +33 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +26 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +23 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +137 -0
- data/lib/relaton/bib/model/item_base.rb +27 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +57 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +13 -0
- data/lib/relaton/bib/model/organization_type.rb +42 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +43 -0
- data/lib/relaton/bib/model/series.rb +34 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +14 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/version.rb +5 -0
- data/lib/relaton/bib.rb +45 -0
- data/relaton-bib.gemspec +11 -8
- metadata +125 -67
- data/lib/relaton_bib/bib_item_locality.rb +0 -175
- data/lib/relaton_bib/biblio_note.rb +0 -72
- data/lib/relaton_bib/biblio_version.rb +0 -46
- data/lib/relaton_bib/bibliographic_date.rb +0 -119
- data/lib/relaton_bib/bibliographic_item.rb +0 -668
- data/lib/relaton_bib/bibliographic_size.rb +0 -103
- data/lib/relaton_bib/bibtex_parser.rb +0 -246
- data/lib/relaton_bib/bibxml_parser.rb +0 -422
- data/lib/relaton_bib/classification.rb +0 -40
- data/lib/relaton_bib/config.rb +0 -16
- data/lib/relaton_bib/contribution_info.rb +0 -117
- data/lib/relaton_bib/contributor.rb +0 -277
- data/lib/relaton_bib/copyright_association.rb +0 -79
- data/lib/relaton_bib/deep_dup.rb +0 -30
- data/lib/relaton_bib/document_identifier.rb +0 -118
- data/lib/relaton_bib/document_relation.rb +0 -95
- data/lib/relaton_bib/document_relation_collection.rb +0 -57
- data/lib/relaton_bib/document_status.rb +0 -92
- data/lib/relaton_bib/document_type.rb +0 -52
- data/lib/relaton_bib/edition.rb +0 -55
- data/lib/relaton_bib/editorial_group.rb +0 -41
- data/lib/relaton_bib/extent.rb +0 -39
- data/lib/relaton_bib/forename.rb +0 -65
- data/lib/relaton_bib/formatted_ref.rb +0 -17
- data/lib/relaton_bib/formatted_string.rb +0 -133
- data/lib/relaton_bib/full_name.rb +0 -108
- data/lib/relaton_bib/hash_converter.rb +0 -568
- data/lib/relaton_bib/hit.rb +0 -52
- data/lib/relaton_bib/hit_collection.rb +0 -105
- data/lib/relaton_bib/ics.rb +0 -42
- data/lib/relaton_bib/image.rb +0 -95
- data/lib/relaton_bib/localized_string.rb +0 -149
- data/lib/relaton_bib/medium.rb +0 -76
- data/lib/relaton_bib/organization.rb +0 -165
- data/lib/relaton_bib/person.rb +0 -129
- data/lib/relaton_bib/place.rb +0 -203
- data/lib/relaton_bib/renderer/bibtex_builder.rb +0 -312
- data/lib/relaton_bib/renderer/bibxml.rb +0 -296
- data/lib/relaton_bib/series.rb +0 -119
- data/lib/relaton_bib/structured_identifier.rb +0 -173
- data/lib/relaton_bib/technical_committee.rb +0 -34
- data/lib/relaton_bib/typed_title_string.rb +0 -191
- data/lib/relaton_bib/typed_uri.rb +0 -57
- data/lib/relaton_bib/util.rb +0 -16
- data/lib/relaton_bib/validity.rb +0 -52
- data/lib/relaton_bib/version.rb +0 -3
- data/lib/relaton_bib/workers_pool.rb +0 -43
- data/lib/relaton_bib/workgroup.rb +0 -58
- data/lib/relaton_bib/xml_parser.rb +0 -718
- data/lib/relaton_bib.rb +0 -111
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require_relative "item_base"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
class Relation
|
|
6
|
+
attribute :type, :string, values: %w[
|
|
7
|
+
includes includedIn hasPart partOf merges mergedInto splits splitInto
|
|
8
|
+
instanceOf hasInstance exemplarOf hasExemplar manifestationOf
|
|
9
|
+
hasManifestation reproductionOf hasReproduction reprintOf hasReprint
|
|
10
|
+
expressionOf hasExpression translatedFrom hasTranslation arrangementOf
|
|
11
|
+
hasArrangement abridgementOf hasAbridgement annotationOf hasAnnotation
|
|
12
|
+
draftOf hasDraft predecessorDraftOf hasPredecessorDraft successorDraftOf
|
|
13
|
+
hasSuccessorDraft editionOf hasEdition updates updatedBy derivedFrom
|
|
14
|
+
derives describes describedBy catalogues cataloguedBy hasSuccessor
|
|
15
|
+
successorOf adaptedFrom hasAdaptation adoptedFrom adoptedAs reviewOf
|
|
16
|
+
hasReview commentaryOf hasCommentary related hasComplement complementOf
|
|
17
|
+
obsoletes obsoletedBy cites isCitedIn
|
|
18
|
+
]
|
|
19
|
+
attribute :description, LocalizedMarkedUpString
|
|
20
|
+
attribute :bibitem, ItemBase
|
|
21
|
+
choice(min: 1, max: 1) do
|
|
22
|
+
attribute :locality, Locality, collection: true, initialize_empty: true
|
|
23
|
+
attribute :locality_stack, LocalityStack, collection: true, initialize_empty: true
|
|
24
|
+
end
|
|
25
|
+
choice(min: 1, max: 1) do
|
|
26
|
+
attribute :source_locality, Locality, collection: true, initialize_empty: true
|
|
27
|
+
attribute :source_locality_stack, SourceLocalityStack, collection: true, initialize_empty: true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
xml do
|
|
31
|
+
root "relation"
|
|
32
|
+
|
|
33
|
+
map_attribute "type", to: :type
|
|
34
|
+
map_element "description", to: :description
|
|
35
|
+
map_element "bibitem", to: :bibitem
|
|
36
|
+
map_element "locality", to: :locality
|
|
37
|
+
map_element "localityStack", to: :locality_stack
|
|
38
|
+
map_element "sourceLocality", to: :source_locality
|
|
39
|
+
map_element "sourceLocalityStack", to: :source_locality_stack
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require_relative "type/string_date"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
class Series < Lutaml::Model::Serializable
|
|
6
|
+
attribute :type, :string, values: %w[main alt]
|
|
7
|
+
attribute :formattedref, Formattedref
|
|
8
|
+
attribute :title, Title, collection: (1..)
|
|
9
|
+
attribute :place, Place
|
|
10
|
+
attribute :organization, :string
|
|
11
|
+
attribute :abbreviation, LocalizedString
|
|
12
|
+
attribute :from, StringDate
|
|
13
|
+
attribute :to, StringDate
|
|
14
|
+
attribute :number, :string
|
|
15
|
+
attribute :partnumber, :string
|
|
16
|
+
attribute :run, :string
|
|
17
|
+
|
|
18
|
+
xml do
|
|
19
|
+
root "series"
|
|
20
|
+
map_attribute "type", to: :type
|
|
21
|
+
map_element "formattedref", to: :formattedref
|
|
22
|
+
map_element "title", to: :title
|
|
23
|
+
map_element "place", to: :place
|
|
24
|
+
map_element "organization", to: :organization
|
|
25
|
+
map_element "abbreviation", to: :abbreviation
|
|
26
|
+
map_element "from", to: :from
|
|
27
|
+
map_element "to", to: :to
|
|
28
|
+
map_element "number", to: :number
|
|
29
|
+
map_element "partnumber", to: :partnumber
|
|
30
|
+
map_element "run", to: :run
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Size < Lutaml::Model::Serializable
|
|
4
|
+
class Value < Lutaml::Model::Serializable
|
|
5
|
+
attribute :type, :string
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "value"
|
|
10
|
+
map_attribute "type", to: :type
|
|
11
|
+
map_content to: :content
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
attribute :value, Value, collection: (1..)
|
|
16
|
+
|
|
17
|
+
xml do
|
|
18
|
+
root "size"
|
|
19
|
+
map_element "value", to: :value
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class SourceLocalityStack < Lutaml::Model::Serializable
|
|
4
|
+
attribute :connective, :string, values: %w[and or from to]
|
|
5
|
+
attribute :source_locality, Locality, collection: true, initialize_empty: true
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
root "sourceLocalityStack"
|
|
9
|
+
map_attribute "connective", to: :connective
|
|
10
|
+
map_element "sourceLocality", to: :source_locality
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Status < Lutaml::Model::Serializable
|
|
4
|
+
class Stage < Lutaml::Model::Serializable
|
|
5
|
+
attribute :abbreviation, :string
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "stage"
|
|
10
|
+
map_attribute "abbreviation", to: :abbreviation
|
|
11
|
+
map_content to: :content
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
attribute :stage, Stage
|
|
16
|
+
attribute :substage, Stage
|
|
17
|
+
attribute :iteration, :string
|
|
18
|
+
|
|
19
|
+
xml do
|
|
20
|
+
root "status"
|
|
21
|
+
map_element "stage", to: :stage
|
|
22
|
+
map_element "substage", to: :substage
|
|
23
|
+
map_element "iteration", to: :iteration
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class StructuredIdentifier < Lutaml::Model::Serializable
|
|
4
|
+
attribute :type, :string
|
|
5
|
+
attribute :agency, :string, collection: (1..)
|
|
6
|
+
attribute :klass, :string
|
|
7
|
+
attribute :docnumber, :string
|
|
8
|
+
attribute :partnumber, :string
|
|
9
|
+
attribute :edition, :string
|
|
10
|
+
attribute :version, :string
|
|
11
|
+
attribute :supplementtype, :string
|
|
12
|
+
attribute :supplementnumber, :string
|
|
13
|
+
attribute :amendment, :string
|
|
14
|
+
attribute :corrigendum, :string
|
|
15
|
+
attribute :language, :string
|
|
16
|
+
attribute :year, :string
|
|
17
|
+
|
|
18
|
+
xml do
|
|
19
|
+
root "structuredidentifier"
|
|
20
|
+
map_attribute "type", to: :type
|
|
21
|
+
map_element "agency", to: :agency
|
|
22
|
+
map_element "class", to: :klass
|
|
23
|
+
map_element "docnumber", to: :docnumber
|
|
24
|
+
map_element "partnumber", to: :partnumber
|
|
25
|
+
map_element "edition", to: :edition
|
|
26
|
+
map_element "version", to: :version
|
|
27
|
+
map_element "supplementtype", to: :supplementtype
|
|
28
|
+
map_element "supplementnumber", to: :supplementnumber
|
|
29
|
+
map_element "amendment", to: :amendment
|
|
30
|
+
map_element "corrigendum", to: :corrigendum
|
|
31
|
+
map_element "language", to: :language
|
|
32
|
+
map_element "year", to: :year
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def remove_part!
|
|
36
|
+
raise NotImplementedError, "`remove_part!` method not implemented in #{self.class}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def to_all_parts!
|
|
40
|
+
raise NotImplementedError, "`to_all_parts!` method not implemented in #{self.class}"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def remove_date!
|
|
44
|
+
raise NotImplementedError, "`remove_date!` method not implemented in #{self.class}"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Subdivision < Lutaml::Model::Serializable
|
|
4
|
+
include OrganizationType
|
|
5
|
+
|
|
6
|
+
attribute :type, :string
|
|
7
|
+
attribute :subtype, :string
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
root "subdivision"
|
|
11
|
+
map_attribute "type", to: :type
|
|
12
|
+
map_attribute "subtype", to: :subtype
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Title < LocalizedMarkedUpString
|
|
4
|
+
attribute :type, :string
|
|
5
|
+
attribute :format, :string # @DEPRECATED
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
map_attribute "type", to: :type
|
|
9
|
+
map_attribute "format", to: :format
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
key_value do
|
|
13
|
+
map "type", to: :type
|
|
14
|
+
map "format", to: :format
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class << self
|
|
18
|
+
def from_string(title, lang = nil, script = nil)
|
|
19
|
+
types = %w[title-intro title-main title-part]
|
|
20
|
+
ttls = split_title(title)
|
|
21
|
+
tts = ttls.map.with_index do |p, i|
|
|
22
|
+
next unless p
|
|
23
|
+
|
|
24
|
+
new type: types[i], content: p, language: lang, script: script
|
|
25
|
+
end.compact
|
|
26
|
+
tts << new(type: "main", content: ttls.compact.join(" - "), language: lang, script: script)
|
|
27
|
+
tts
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
# @param title [String]
|
|
33
|
+
# @return [Array<String, nil>]
|
|
34
|
+
def split_title(title)
|
|
35
|
+
ttls = title.sub(/\w\.Imp\s?\d+\u00A0:\u00A0/, "").split " - "
|
|
36
|
+
case ttls.size
|
|
37
|
+
when 0, 1 then [nil, ttls.first.to_s, nil]
|
|
38
|
+
else intro_or_part ttls
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param ttls [Array<String>]
|
|
43
|
+
# @return [Array<String, nil>]
|
|
44
|
+
def intro_or_part(ttls)
|
|
45
|
+
if /^(Part|Partie) \d+:/.match? ttls[1]
|
|
46
|
+
[nil, ttls[0], ttls[1..].join(" -- ")]
|
|
47
|
+
else
|
|
48
|
+
parts = ttls.slice(2..-1)
|
|
49
|
+
part = parts.join " -- " if parts.any?
|
|
50
|
+
[ttls[0], ttls[1], part]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require "forwardable"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
class StringDate < Lutaml::Model::Type::Value
|
|
6
|
+
class Value
|
|
7
|
+
include Comparable
|
|
8
|
+
extend Forwardable
|
|
9
|
+
extend Core::DateParser
|
|
10
|
+
include Core::DateParser
|
|
11
|
+
|
|
12
|
+
def_delegators :@value, :split, :to_s
|
|
13
|
+
|
|
14
|
+
def initialize(value)
|
|
15
|
+
@value = value
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.parse_date(date)
|
|
19
|
+
value = super
|
|
20
|
+
new value if value
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def <=>(other)
|
|
24
|
+
return nil unless other.is_a?(Value)
|
|
25
|
+
|
|
26
|
+
@value <=> other.to_s
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_date
|
|
30
|
+
parse_date(@value, str: false)
|
|
31
|
+
rescue ArgumentError
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.cast(value)
|
|
37
|
+
case value
|
|
38
|
+
when Value then value
|
|
39
|
+
when String then Value.parse_date(value)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def to_yaml
|
|
44
|
+
value.to_s
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Uri < LocalizedStringAttrs
|
|
4
|
+
attribute :type, :string
|
|
5
|
+
attribute :content, :string
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
map_attribute "type", to: :type
|
|
9
|
+
map_content to: :content
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
key_value do
|
|
13
|
+
map "type", to: :type
|
|
14
|
+
map "content", to: :content
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Validity < Lutaml::Model::Serializable
|
|
4
|
+
attribute :begins, :date_time
|
|
5
|
+
attribute :ends, :date_time
|
|
6
|
+
attribute :revision, :date_time
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "validity"
|
|
10
|
+
map_element "validityBegins", to: :begins
|
|
11
|
+
map_element "validityEnds", to: :ends
|
|
12
|
+
map_element "revision", to: :revision
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Version < Lutaml::Model::Serializable
|
|
4
|
+
attribute :revision_date, :date
|
|
5
|
+
attribute :draft, :string
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
root "version"
|
|
9
|
+
map_element "revision-date", to: :revision_date
|
|
10
|
+
map_element "draft", to: :draft
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
module NamespaceHelper
|
|
4
|
+
def self.included(base)
|
|
5
|
+
base.extend(ClassMethods)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethods
|
|
9
|
+
def namespace
|
|
10
|
+
@namespace = Object.const_get name.split("::")[0..1].join("::")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def namespace
|
|
17
|
+
self.class.namespace
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
module Util
|
|
4
|
+
extend self
|
|
5
|
+
|
|
6
|
+
PROGNAME = "relaton-bib".freeze
|
|
7
|
+
|
|
8
|
+
def method_missing(method_name, msg = nil, prog = nil, **opts, &block)
|
|
9
|
+
prog ||= self::PROGNAME
|
|
10
|
+
Relaton.logger_pool.send method_name, msg, prog, **opts, &block
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
14
|
+
Relaton.logger_pool.respond_to?(method_name) || super
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/relaton/bib.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require "relaton/logger"
|
|
2
|
+
require "forwardable"
|
|
3
|
+
# require "htmlentities"
|
|
4
|
+
require "bibtex"
|
|
5
|
+
require "iso639"
|
|
6
|
+
require "rfcxml"
|
|
7
|
+
require "relaton/core"
|
|
8
|
+
require_relative "bib/version"
|
|
9
|
+
require_relative "bib/util"
|
|
10
|
+
require_relative "bib/namespace_helper"
|
|
11
|
+
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
|
+
|
|
21
|
+
module Relaton
|
|
22
|
+
# class Error < StandardError; end
|
|
23
|
+
|
|
24
|
+
class RequestError < StandardError; end
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
#
|
|
28
|
+
# Read schema versions from file
|
|
29
|
+
#
|
|
30
|
+
# @return [Hash{String=>String}] schema versions
|
|
31
|
+
#
|
|
32
|
+
def schema_versions
|
|
33
|
+
@@schema_versions ||= JSON.parse File.read(File.join(__dir__, "../../grammars/versions.json"))
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module Bib
|
|
38
|
+
def self.grammar_hash
|
|
39
|
+
# gem_path = File.expand_path "..", __dir__
|
|
40
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
41
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
42
|
+
Digest::MD5.hexdigest Relaton::Bib::VERSION # grammars
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/relaton-bib.gemspec
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
lib = File.expand_path("lib", __dir__)
|
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require "
|
|
3
|
+
require "relaton/bib/version"
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "relaton-bib"
|
|
7
|
-
spec.version =
|
|
7
|
+
spec.version = Relaton::Bib::VERSION
|
|
8
8
|
spec.authors = ["Ribose Inc."]
|
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
|
10
10
|
|
|
11
|
-
spec.summary = "
|
|
12
|
-
spec.description = "
|
|
11
|
+
spec.summary = "Relaton::Bib: Ruby XMLDOC impementation."
|
|
12
|
+
spec.description = "Relaton::Bib: Ruby XMLDOC impementation."
|
|
13
13
|
spec.homepage = "https://github.com/relaton/relaton-bib"
|
|
14
14
|
spec.license = "BSD-2-Clause"
|
|
15
15
|
|
|
@@ -21,12 +21,15 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.bindir = "exe"
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.require_paths = ["lib"]
|
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
25
25
|
|
|
26
|
-
spec.add_dependency "addressable"
|
|
27
26
|
spec.add_dependency "bibtex-ruby"
|
|
28
|
-
spec.add_dependency "htmlentities"
|
|
29
27
|
spec.add_dependency "iso639"
|
|
30
|
-
spec.add_dependency "
|
|
28
|
+
spec.add_dependency "isoics", "~> 0.1.0"
|
|
29
|
+
spec.add_dependency "lutaml-model", "~> 0.7"
|
|
30
|
+
spec.add_dependency "nokogiri", ">= 1.16"
|
|
31
|
+
spec.add_dependency "psych", "~> 5.2.0" # versin 5.3.0 crashes
|
|
32
|
+
spec.add_dependency "relaton-core", "~> 0.0.8"
|
|
31
33
|
spec.add_dependency "relaton-logger", "~> 0.2.0"
|
|
34
|
+
spec.add_dependency "rfcxml", "~> 0.2.1"
|
|
32
35
|
end
|