relaton-bib 1.17.0 → 1.17.2
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/grammars/basicdoc.rng +38 -35
- data/grammars/biblio.rng +21 -0
- data/grammars/versions.json +5 -5
- data/lib/relaton_bib/bibliographic_item.rb +2 -6
- data/lib/relaton_bib/bibtex_parser.rb +34 -36
- data/lib/relaton_bib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46d18122233ea0790d42f293b18648a094be8739cac59714cdf2419a5510062b
|
|
4
|
+
data.tar.gz: 918ef1f018e38e6cdfc0f0cafdf886311794910af463a08f15e5d21088e21062
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61a55508abb720be6180365bbd839987eeadcdc38ccc6160d9c03453303f38ba4b4b16731d03236db4e5b767871bdb00b29aa5eab91ca70bf6b9e69eeab0b22f
|
|
7
|
+
data.tar.gz: 5e4400c78c97db49cbd30d4bf4f105dfa365ecc570a876a594c10389913190c2d5536412f76cc41458c18ea78ea3f0f5e90681a698f99213076a2995ced94a51
|
data/grammars/basicdoc.rng
CHANGED
|
@@ -914,44 +914,47 @@
|
|
|
914
914
|
-->
|
|
915
915
|
<define name="image">
|
|
916
916
|
<element name="image">
|
|
917
|
-
<
|
|
918
|
-
|
|
917
|
+
<ref name="Image"/>
|
|
918
|
+
</element>
|
|
919
|
+
</define>
|
|
920
|
+
<define name="Image">
|
|
921
|
+
<attribute name="id">
|
|
922
|
+
<data type="ID"/>
|
|
923
|
+
</attribute>
|
|
924
|
+
<attribute name="src">
|
|
925
|
+
<data type="anyURI"/>
|
|
926
|
+
</attribute>
|
|
927
|
+
<attribute name="mimetype"/>
|
|
928
|
+
<optional>
|
|
929
|
+
<attribute name="filename"/>
|
|
930
|
+
</optional>
|
|
931
|
+
<optional>
|
|
932
|
+
<attribute name="width">
|
|
933
|
+
<choice>
|
|
934
|
+
<data type="int"/>
|
|
935
|
+
<value>auto</value>
|
|
936
|
+
</choice>
|
|
919
937
|
</attribute>
|
|
920
|
-
|
|
938
|
+
</optional>
|
|
939
|
+
<optional>
|
|
940
|
+
<attribute name="height">
|
|
941
|
+
<choice>
|
|
942
|
+
<data type="int"/>
|
|
943
|
+
<value>auto</value>
|
|
944
|
+
</choice>
|
|
945
|
+
</attribute>
|
|
946
|
+
</optional>
|
|
947
|
+
<optional>
|
|
948
|
+
<attribute name="alt"/>
|
|
949
|
+
</optional>
|
|
950
|
+
<optional>
|
|
951
|
+
<attribute name="title"/>
|
|
952
|
+
</optional>
|
|
953
|
+
<optional>
|
|
954
|
+
<attribute name="longdesc">
|
|
921
955
|
<data type="anyURI"/>
|
|
922
956
|
</attribute>
|
|
923
|
-
|
|
924
|
-
<optional>
|
|
925
|
-
<attribute name="filename"/>
|
|
926
|
-
</optional>
|
|
927
|
-
<optional>
|
|
928
|
-
<attribute name="width">
|
|
929
|
-
<choice>
|
|
930
|
-
<data type="int"/>
|
|
931
|
-
<value>auto</value>
|
|
932
|
-
</choice>
|
|
933
|
-
</attribute>
|
|
934
|
-
</optional>
|
|
935
|
-
<optional>
|
|
936
|
-
<attribute name="height">
|
|
937
|
-
<choice>
|
|
938
|
-
<data type="int"/>
|
|
939
|
-
<value>auto</value>
|
|
940
|
-
</choice>
|
|
941
|
-
</attribute>
|
|
942
|
-
</optional>
|
|
943
|
-
<optional>
|
|
944
|
-
<attribute name="alt"/>
|
|
945
|
-
</optional>
|
|
946
|
-
<optional>
|
|
947
|
-
<attribute name="title"/>
|
|
948
|
-
</optional>
|
|
949
|
-
<optional>
|
|
950
|
-
<attribute name="longdesc">
|
|
951
|
-
<data type="anyURI"/>
|
|
952
|
-
</attribute>
|
|
953
|
-
</optional>
|
|
954
|
-
</element>
|
|
957
|
+
</optional>
|
|
955
958
|
</define>
|
|
956
959
|
<define name="video">
|
|
957
960
|
<element name="video">
|
data/grammars/biblio.rng
CHANGED
|
@@ -348,6 +348,9 @@
|
|
|
348
348
|
<zeroOrMore>
|
|
349
349
|
<ref name="contact"/>
|
|
350
350
|
</zeroOrMore>
|
|
351
|
+
<optional>
|
|
352
|
+
<ref name="logo"/>
|
|
353
|
+
</optional>
|
|
351
354
|
</element>
|
|
352
355
|
</define>
|
|
353
356
|
<define name="orgname">
|
|
@@ -366,6 +369,21 @@
|
|
|
366
369
|
</choice>
|
|
367
370
|
</element>
|
|
368
371
|
</define>
|
|
372
|
+
<define name="logo">
|
|
373
|
+
<element name="logo">
|
|
374
|
+
<ref name="image"/>
|
|
375
|
+
</element>
|
|
376
|
+
</define>
|
|
377
|
+
<define name="depiction">
|
|
378
|
+
<element name="depiction">
|
|
379
|
+
<optional>
|
|
380
|
+
<attribute name="scope"/>
|
|
381
|
+
</optional>
|
|
382
|
+
<zeroOrMore>
|
|
383
|
+
<ref name="image"/>
|
|
384
|
+
</zeroOrMore>
|
|
385
|
+
</element>
|
|
386
|
+
</define>
|
|
369
387
|
<define name="NameWithVariants">
|
|
370
388
|
<element name="primary">
|
|
371
389
|
<ref name="LocalizedString"/>
|
|
@@ -752,6 +770,9 @@
|
|
|
752
770
|
<optional>
|
|
753
771
|
<ref name="validity"/>
|
|
754
772
|
</optional>
|
|
773
|
+
<optional>
|
|
774
|
+
<ref name="depiction"/>
|
|
775
|
+
</optional>
|
|
755
776
|
</define>
|
|
756
777
|
<define name="ReducedBibliographicItem">
|
|
757
778
|
<optional>
|
data/grammars/versions.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"relaton-models": "v1.2.
|
|
2
|
+
"relaton-models": "v1.2.7",
|
|
3
3
|
"basicdoc-models": "v1.0.3",
|
|
4
4
|
"metanorma-requirements-models": "v1.0.0",
|
|
5
|
-
"relaton-model-ieee": "v1.0.
|
|
5
|
+
"relaton-model-ieee": "v1.0.1",
|
|
6
6
|
"relaton-model-iso": "v1.0.0",
|
|
7
7
|
"relaton-model-iec": "v1.0.0",
|
|
8
8
|
"relaton-model-bsi": "v1.0.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"relaton-model-omg": "v1.0.0",
|
|
29
29
|
"relaton-model-oasis": "v1.0.1",
|
|
30
30
|
"relaton-model-jis": "v0.0.1",
|
|
31
|
-
"relaton-model-etsi": "v0.0.
|
|
32
|
-
"metanorma-model": "v1.2.
|
|
33
|
-
"date": "2023-
|
|
31
|
+
"relaton-model-etsi": "v0.0.3",
|
|
32
|
+
"metanorma-model": "v1.2.9",
|
|
33
|
+
"date": "2023-12-04T16:12:14Z"
|
|
34
34
|
}
|
|
@@ -324,7 +324,7 @@ module RelatonBib
|
|
|
324
324
|
end
|
|
325
325
|
end
|
|
326
326
|
|
|
327
|
-
# @param identifier [RelatonBib::DocumentIdentifier]
|
|
327
|
+
# @param identifier [RelatonBib::DocumentIdentifier, nil]
|
|
328
328
|
# @param attribute [Boolean, nil]
|
|
329
329
|
# @return [String]
|
|
330
330
|
def makeid(identifier, attribute)
|
|
@@ -333,11 +333,7 @@ module RelatonBib
|
|
|
333
333
|
identifier ||= @docidentifier.reject { |i| i.type == "DOI" }[0]
|
|
334
334
|
return unless identifier
|
|
335
335
|
|
|
336
|
-
|
|
337
|
-
# idstr = "#{contribs}#{delim}#{id.project_number}"
|
|
338
|
-
# idstr = id.project_number.to_s
|
|
339
|
-
idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/\s/, "")
|
|
340
|
-
# if id.part_number&.size&.positive? then idstr += "-#{id.part_number}"
|
|
336
|
+
idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/[\s\(\)]/, "")
|
|
341
337
|
idstr.strip
|
|
342
338
|
end
|
|
343
339
|
|
|
@@ -78,54 +78,50 @@ module RelatonBib
|
|
|
78
78
|
|
|
79
79
|
# @param bibtex [BibTeX::Entry]
|
|
80
80
|
# @return [Array<Hash>]
|
|
81
|
-
def fetch_contributor(bibtex) # rubocop:disable Metrics/AbcSize
|
|
82
|
-
|
|
83
|
-
fetch_person(bibtex
|
|
84
|
-
|
|
85
|
-
end
|
|
81
|
+
def fetch_contributor(bibtex) # rubocop:disable Metrics/AbcSize
|
|
82
|
+
contribs = []
|
|
83
|
+
fetch_person(bibtex, "author") { |author| contribs << author }
|
|
84
|
+
fetch_person(bibtex, "editor") { |editor| contribs << editor }
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
fetch_org(bibtex["publisher"], "publisher") { |pub| contribs << pub }
|
|
87
|
+
fetch_org(bibtex["institution"], "distributor", "sponsor") { |distr| contribs << distr }
|
|
88
|
+
fetch_org(bibtex["organization"], "distributor", "sponsor") { |org| contribs << org }
|
|
89
|
+
fetch_org(bibtex["school"], "distributor", "sponsor") { |school| contribs << school }
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
contributor << { entity: { name: bibtex.publisher.to_s }, role: [{ type: "publisher" }] }
|
|
93
|
-
end
|
|
91
|
+
fetch_howpublished(bibtex) { |pub| contribs << pub }
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
entity: { name: bibtex.institution.to_s },
|
|
98
|
-
role: [{ type: "distributor", description: ["sponsor"] }],
|
|
99
|
-
}
|
|
100
|
-
end
|
|
93
|
+
contribs
|
|
94
|
+
end
|
|
101
95
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
entity: { name: bibtex.organization.to_s },
|
|
105
|
-
role: [{ type: "distributor", description: ["sponsor"] }],
|
|
106
|
-
}
|
|
107
|
-
end
|
|
96
|
+
def fetch_howpublished(bibtex, &_)
|
|
97
|
+
return unless bibtex["howpublished"]
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
99
|
+
/\\publisher\{(?<name>.+)\},\\url\{(?<url>.+)\}/ =~ bibtex.howpublished.to_s
|
|
100
|
+
return unless name && url
|
|
101
|
+
|
|
102
|
+
name.gsub!(/\{\\?([^\\]+)\}/, '\1')
|
|
103
|
+
org = Organization.new(name: name, url: url)
|
|
104
|
+
yield entity: org, role: [{ type: "publisher" }]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def fetch_org(org, type, desc = nil, &_)
|
|
108
|
+
return unless org
|
|
109
|
+
|
|
110
|
+
role = { type: type }
|
|
111
|
+
role[:description] = [desc] if desc
|
|
112
|
+
yield entity: Organization.new(name: org.to_s), role: [role]
|
|
116
113
|
end
|
|
117
114
|
|
|
118
115
|
# @param bibtex [BibTeX::Entry]
|
|
119
116
|
# @return [Array<RelatonBib::Person>]
|
|
120
|
-
def fetch_person(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
person.map do |name|
|
|
117
|
+
def fetch_person(bibtex, role, &_) # rubocop:disable Metrics/AbcSize
|
|
118
|
+
bibtex[role]&.each do |name|
|
|
124
119
|
parts = name.split ", "
|
|
125
120
|
surname = LocalizedString.new parts.first
|
|
126
121
|
fname = parts.size > 1 ? parts[1].split : []
|
|
127
122
|
forename = fname.map { |fn| Forename.new content: fn }
|
|
128
|
-
|
|
123
|
+
name = FullName.new(surname: surname, forename: forename)
|
|
124
|
+
yield entity: Person.new(name: name), role: [{ type: role }]
|
|
129
125
|
end
|
|
130
126
|
end
|
|
131
127
|
|
|
@@ -147,7 +143,7 @@ module RelatonBib
|
|
|
147
143
|
|
|
148
144
|
# @param bibtex [BibTeX::Entry]
|
|
149
145
|
# @return [RelatonBib::BiblioNoteCollection]
|
|
150
|
-
def fetch_note(bibtex)
|
|
146
|
+
def fetch_note(bibtex) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
151
147
|
bibtex.select do |k, _v|
|
|
152
148
|
%i[annote howpublished comment note content].include? k
|
|
153
149
|
end.reduce(BiblioNoteCollection.new([])) do |mem, note|
|
|
@@ -156,6 +152,8 @@ module RelatonBib
|
|
|
156
152
|
when :content then "tableOfContents"
|
|
157
153
|
else note[0].to_s
|
|
158
154
|
end
|
|
155
|
+
next mem if type == "howpublished" && note[1].to_s.match?(/^\\publisher\{.+\},\\url\{.+\}$/)
|
|
156
|
+
|
|
159
157
|
mem << BiblioNote.new(type: type, content: note[1].to_s)
|
|
160
158
|
end
|
|
161
159
|
end
|
data/lib/relaton_bib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.17.
|
|
4
|
+
version: 1.17.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|