relaton-bib 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +44 -18
- data/grammars/isodoc.rng +130 -21
- data/grammars/reqt.rng +2 -8
- data/lib/relaton_bib/bibliographic_item.rb +18 -6
- data/lib/relaton_bib/document_identifier.rb +29 -5
- data/lib/relaton_bib/editorial_group.rb +5 -0
- 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: bd9ee52233758a976f5f9d4e549c61c899a643afddf3486215b219b868041d76
|
4
|
+
data.tar.gz: dc9878b905a4412fe8237f71a422f23252a7f9933e882e1d502333890e00ba1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07d38211e4b0e19152e0c92341902f3a93482795c4cd1b019e67b33dd95edfba630cd9c474f8b3c930bf36dee99f346f8142f49252e296a2867580ffb53082ba
|
7
|
+
data.tar.gz: 3a070a16d70d30bc72750325d314ab548938d224e58aa584748572be85b4e5e66d94b8ca204583faa40231adacd86a0eec1ea4d40c4d4261ab2dbc484492d7db
|
data/README.adoc
CHANGED
@@ -136,10 +136,13 @@ item = RelatonBib::BibliographicItem.new(
|
|
136
136
|
},
|
137
137
|
{ entity: { name: "Institution" }, role: [type: "sponsor"] }
|
138
138
|
],
|
139
|
-
copyright: {
|
140
|
-
|
141
|
-
|
142
|
-
|
139
|
+
copyright: [{
|
140
|
+
owner: [{
|
141
|
+
name: "International Organization for Standardization",
|
142
|
+
abbreviation: "ISO", url: "www.iso.org"
|
143
|
+
}],
|
144
|
+
from: "2014", to: "2020"
|
145
|
+
}],
|
143
146
|
link: [
|
144
147
|
{ type: "src", content: "https://www.iso.org/standard/53798.html" },
|
145
148
|
{ type: "obp",
|
@@ -232,6 +235,10 @@ item = RelatonBib::BibliographicItem.new(
|
|
232
235
|
revision: Time.new(2011, 3, 4, 9, 0),
|
233
236
|
)
|
234
237
|
)
|
238
|
+
|
239
|
+
=> #<RelatonBib::BibliographicItem:0x007fc8b6c796c0
|
240
|
+
@abstract=
|
241
|
+
[#<RelatonBib::FormattedString:0x007fc8b6c726b8 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
235
242
|
----
|
236
243
|
|
237
244
|
=== BibliographicItem Typed Title Strings
|
@@ -245,6 +252,11 @@ item.title
|
|
245
252
|
#<RelatonBib::TypedTitleString:0x007fa49a35bf38
|
246
253
|
@title=#<RelatonBib::FormattedString:0x007fa49a35bdd0 @content="Information géographique", @format=nil, @language=["fr"], @script=["Latn"]>,
|
247
254
|
@type=nil>]
|
255
|
+
|
256
|
+
item.title lang: "fr"
|
257
|
+
=> [#<RelatonBib::TypedTitleString:0x007fa49a35bf38
|
258
|
+
@title=#<RelatonBib::FormattedString:0x007fa49a35bdd0 @content="Information géographique", @format=nil, @language=["fr"], @script=["Latn"]>,
|
259
|
+
@type=nil>]
|
248
260
|
----
|
249
261
|
|
250
262
|
=== BibliographicItem Formatted Strings
|
@@ -252,8 +264,8 @@ item.title
|
|
252
264
|
[source,ruby]
|
253
265
|
----
|
254
266
|
item.abstract
|
255
|
-
=> [#<RelatonBib::FormattedString:
|
256
|
-
#<RelatonBib::FormattedString:
|
267
|
+
=> [#<RelatonBib::FormattedString:0x007fc8b6c726b8 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
268
|
+
#<RelatonBib::FormattedString:0x007fc8b6c725f0 @content="L'ISO 19115-1:2014 définit le schéma requis pour ...", @format="text/plain", @language=["fr"], @script=["Latn"]>]
|
257
269
|
|
258
270
|
item.abstract(lang: "en").to_s
|
259
271
|
=> "ISO 19115-1:2014 defines the schema required for ..."
|
@@ -263,8 +275,8 @@ item.abstract(lang: "en").to_s
|
|
263
275
|
|
264
276
|
[source,ruby]
|
265
277
|
----
|
266
|
-
item.shortref item
|
267
|
-
=> "
|
278
|
+
item.shortref item.docidentifier.first
|
279
|
+
=> "TC211:2014"
|
268
280
|
----
|
269
281
|
|
270
282
|
=== XML serialization
|
@@ -272,10 +284,10 @@ item.shortref item
|
|
272
284
|
[source,ruby]
|
273
285
|
----
|
274
286
|
item.to_xml
|
275
|
-
=> "<bibitem id
|
287
|
+
=> "<bibitem id="ISO/TC211" type="standard">
|
276
288
|
<fetched>2019-04-30</fetched>
|
277
|
-
<title type
|
278
|
-
<title language
|
289
|
+
<title type="main" language="en" script="Latn">Geographic information</title>
|
290
|
+
<title language="fr" script="Latn">Information géographique</title>
|
279
291
|
...
|
280
292
|
</bibitem>"
|
281
293
|
----
|
@@ -285,9 +297,9 @@ Default root element is `bibitem`. With argument `bibdata: true` the XML wrapped
|
|
285
297
|
[source,ruby]
|
286
298
|
----
|
287
299
|
item.to_xml bibdata: true
|
288
|
-
=> "<bibdata type
|
300
|
+
=> "<bibdata type="standard">
|
289
301
|
<fetched>2019-04-30</fetched>
|
290
|
-
<title type
|
302
|
+
<title type="main" language="en" script="Latn">Geographic information</title>
|
291
303
|
...
|
292
304
|
</bibdata>"
|
293
305
|
----
|
@@ -296,12 +308,12 @@ item.to_xml bibdata: true
|
|
296
308
|
|
297
309
|
By default date elements are formatted as year (yyyy). Option `:date_format` allows to output date elements in `:short` (yyyy-mm) and `:full` (yyyy-mm-dd) additiona formats.
|
298
310
|
|
299
|
-
[
|
311
|
+
[source,ruby]
|
300
312
|
----
|
301
313
|
item.to_xml date_format: :short
|
302
|
-
=> "<bibitem id
|
314
|
+
=> "<bibitem id="ISO/TC211" type="standard">
|
303
315
|
<fetched>2019-04-30</fetched>
|
304
|
-
<title type
|
316
|
+
<title type="main" language="en" script="Latn">Geographic information</title>
|
305
317
|
...
|
306
318
|
<date type="issued">
|
307
319
|
<on>2014-01</on>
|
@@ -313,9 +325,10 @@ item.to_xml date_format: :short
|
|
313
325
|
<on>2015-05</on>
|
314
326
|
</date>
|
315
327
|
...
|
328
|
+
</bibitem>"
|
316
329
|
|
317
330
|
item.to_xml date_format: :full
|
318
|
-
=> "<bibitem id
|
331
|
+
=> "<bibitem id="ISO/TC211" type="standard">
|
319
332
|
...
|
320
333
|
<date type="issued">
|
321
334
|
<on>2014-01-01</on>
|
@@ -327,6 +340,19 @@ item.to_xml date_format: :full
|
|
327
340
|
<on>2015-05-20</on>
|
328
341
|
</date>
|
329
342
|
...
|
343
|
+
</bibitem>"
|
344
|
+
----
|
345
|
+
|
346
|
+
==== Adding notes
|
347
|
+
|
348
|
+
[source,ruby]
|
349
|
+
----
|
350
|
+
item.to_xml note: [{ text: "Note", type: "note" }]
|
351
|
+
=>"<bibitem id="ISO19115-1-2014">
|
352
|
+
...
|
353
|
+
<note format="text/plain" type="note">Note</note>
|
354
|
+
...
|
355
|
+
</bibitem>"
|
330
356
|
----
|
331
357
|
|
332
358
|
=== Create bibliographic item form YAML
|
@@ -362,7 +388,7 @@ item.to_hash
|
|
362
388
|
|
363
389
|
[source,ruby]
|
364
390
|
----
|
365
|
-
RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/
|
391
|
+
RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
|
366
392
|
=> {"ISOTC211"=>
|
367
393
|
#<RelatonBib::BibliographicItem:0x007fedee0a2ab0
|
368
394
|
...
|
data/grammars/isodoc.rng
CHANGED
@@ -42,8 +42,11 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
+
<!-- attribute target { xsd:IDREF }, -->
|
45
46
|
<attribute name="target">
|
46
|
-
<data type="
|
47
|
+
<data type="string">
|
48
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
49
|
+
</data>
|
47
50
|
</attribute>
|
48
51
|
<optional>
|
49
52
|
<attribute name="type">
|
@@ -61,6 +64,11 @@
|
|
61
64
|
</choice>
|
62
65
|
</attribute>
|
63
66
|
</optional>
|
67
|
+
<optional>
|
68
|
+
<attribute name="droploc">
|
69
|
+
<data type="boolean"/>
|
70
|
+
</attribute>
|
71
|
+
</optional>
|
64
72
|
<text/>
|
65
73
|
</element>
|
66
74
|
</define>
|
@@ -578,6 +586,8 @@
|
|
578
586
|
<ref name="ol"/>
|
579
587
|
<ref name="dl"/>
|
580
588
|
<ref name="formula"/>
|
589
|
+
<ref name="quote"/>
|
590
|
+
<ref name="sourcecode"/>
|
581
591
|
</choice>
|
582
592
|
</oneOrMore>
|
583
593
|
</element>
|
@@ -661,6 +671,16 @@
|
|
661
671
|
</choice>
|
662
672
|
</attribute>
|
663
673
|
</optional>
|
674
|
+
<optional>
|
675
|
+
<attribute name="valign">
|
676
|
+
<choice>
|
677
|
+
<value>top</value>
|
678
|
+
<value>middle</value>
|
679
|
+
<value>bottom</value>
|
680
|
+
<value>baseline</value>
|
681
|
+
</choice>
|
682
|
+
</attribute>
|
683
|
+
</optional>
|
664
684
|
<choice>
|
665
685
|
<zeroOrMore>
|
666
686
|
<choice>
|
@@ -697,6 +717,16 @@
|
|
697
717
|
</choice>
|
698
718
|
</attribute>
|
699
719
|
</optional>
|
720
|
+
<optional>
|
721
|
+
<attribute name="valign">
|
722
|
+
<choice>
|
723
|
+
<value>top</value>
|
724
|
+
<value>middle</value>
|
725
|
+
<value>bottom</value>
|
726
|
+
<value>baseline</value>
|
727
|
+
</choice>
|
728
|
+
</attribute>
|
729
|
+
</optional>
|
700
730
|
<choice>
|
701
731
|
<zeroOrMore>
|
702
732
|
<choice>
|
@@ -855,7 +885,7 @@
|
|
855
885
|
<oneOrMore>
|
856
886
|
<choice>
|
857
887
|
<ref name="content"/>
|
858
|
-
<ref name="
|
888
|
+
<ref name="abstract"/>
|
859
889
|
<ref name="foreword"/>
|
860
890
|
<ref name="introduction"/>
|
861
891
|
<ref name="acknowledgements"/>
|
@@ -922,6 +952,9 @@
|
|
922
952
|
<optional>
|
923
953
|
<attribute name="script"/>
|
924
954
|
</optional>
|
955
|
+
<optional>
|
956
|
+
<attribute name="type"/>
|
957
|
+
</optional>
|
925
958
|
<optional>
|
926
959
|
<attribute name="obligation">
|
927
960
|
<choice>
|
@@ -961,9 +994,6 @@
|
|
961
994
|
</define>
|
962
995
|
<define name="content-subsection">
|
963
996
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
997
|
<ref name="Content-Section"/>
|
968
998
|
</element>
|
969
999
|
</define>
|
@@ -992,6 +1022,9 @@
|
|
992
1022
|
</choice>
|
993
1023
|
</attribute>
|
994
1024
|
</optional>
|
1025
|
+
<optional>
|
1026
|
+
<attribute name="type"/>
|
1027
|
+
</optional>
|
995
1028
|
<optional>
|
996
1029
|
<ref name="section-title"/>
|
997
1030
|
</optional>
|
@@ -1011,9 +1044,6 @@
|
|
1011
1044
|
</define>
|
1012
1045
|
<define name="clause">
|
1013
1046
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1047
|
<ref name="Clause-Section"/>
|
1018
1048
|
</element>
|
1019
1049
|
</define>
|
@@ -1042,18 +1072,24 @@
|
|
1042
1072
|
</choice>
|
1043
1073
|
</attribute>
|
1044
1074
|
</optional>
|
1075
|
+
<optional>
|
1076
|
+
<attribute name="type"/>
|
1077
|
+
</optional>
|
1045
1078
|
<optional>
|
1046
1079
|
<ref name="section-title"/>
|
1047
1080
|
</optional>
|
1048
1081
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1082
|
+
<choice>
|
1083
|
+
<group>
|
1084
|
+
<zeroOrMore>
|
1085
|
+
<ref name="BasicBlock"/>
|
1086
|
+
</zeroOrMore>
|
1087
|
+
<zeroOrMore>
|
1088
|
+
<ref name="note"/>
|
1089
|
+
</zeroOrMore>
|
1090
|
+
</group>
|
1091
|
+
<ref name="amend"/>
|
1092
|
+
</choice>
|
1057
1093
|
<zeroOrMore>
|
1058
1094
|
<choice>
|
1059
1095
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1216,9 @@
|
|
1180
1216
|
<optional>
|
1181
1217
|
<attribute name="script"/>
|
1182
1218
|
</optional>
|
1219
|
+
<optional>
|
1220
|
+
<attribute name="type"/>
|
1221
|
+
</optional>
|
1183
1222
|
<optional>
|
1184
1223
|
<attribute name="obligation">
|
1185
1224
|
<choice>
|
@@ -1447,11 +1486,6 @@
|
|
1447
1486
|
</optional>
|
1448
1487
|
</element>
|
1449
1488
|
</define>
|
1450
|
-
<define name="preface_abstract">
|
1451
|
-
<element name="abstract">
|
1452
|
-
<ref name="Basic-Section"/>
|
1453
|
-
</element>
|
1454
|
-
</define>
|
1455
1489
|
<define name="term-clause">
|
1456
1490
|
<element name="clause">
|
1457
1491
|
<optional>
|
@@ -1501,4 +1535,79 @@
|
|
1501
1535
|
<ref name="CitationType"/>
|
1502
1536
|
</element>
|
1503
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1504
1613
|
</grammar>
|
data/grammars/reqt.rng
CHANGED
@@ -39,12 +39,6 @@
|
|
39
39
|
<optional>
|
40
40
|
<attribute name="filename"/>
|
41
41
|
</optional>
|
42
|
-
<optional>
|
43
|
-
<attribute name="model"/>
|
44
|
-
</optional>
|
45
|
-
<optional>
|
46
|
-
<attribute name="type"/>
|
47
|
-
</optional>
|
48
42
|
<optional>
|
49
43
|
<ref name="reqtitle"/>
|
50
44
|
</optional>
|
@@ -54,9 +48,9 @@
|
|
54
48
|
<optional>
|
55
49
|
<ref name="subject"/>
|
56
50
|
</optional>
|
57
|
-
<
|
51
|
+
<optional>
|
58
52
|
<ref name="reqinherit"/>
|
59
|
-
</
|
53
|
+
</optional>
|
60
54
|
<zeroOrMore>
|
61
55
|
<ref name="classification"/>
|
62
56
|
</zeroOrMore>
|
@@ -268,6 +268,9 @@ module RelatonBib
|
|
268
268
|
end
|
269
269
|
end
|
270
270
|
|
271
|
+
# @param id [RelatonBib::DocumentIdentifier]
|
272
|
+
# @param attribute [boolean, nil]
|
273
|
+
# @return [String]
|
271
274
|
def makeid(id, attribute)
|
272
275
|
return nil if attribute && !@id_attribute
|
273
276
|
|
@@ -282,8 +285,12 @@ module RelatonBib
|
|
282
285
|
idstr.strip
|
283
286
|
end
|
284
287
|
|
288
|
+
# @param identifier [RelatonBib::DocumentIdentifier]
|
289
|
+
# @param options [Hash]
|
290
|
+
# @option options [boolean, nil] :no_year
|
291
|
+
# @option options [boolean, nil] :all_parts
|
285
292
|
# @return [String]
|
286
|
-
def shortref(identifier, **opts) # rubocop:disable Metrics/CyclomaticComplexity
|
293
|
+
def shortref(identifier, **opts) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
|
287
294
|
pubdate = date.select { |d| d.type == "published" }
|
288
295
|
year = if opts[:no_year] || pubdate.empty? then ""
|
289
296
|
else ":" + pubdate&.first&.on&.year.to_s
|
@@ -344,7 +351,9 @@ module RelatonBib
|
|
344
351
|
hash["keyword"] = single_element_array(keyword) if keyword&.any?
|
345
352
|
hash["license"] = single_element_array(license) if license&.any?
|
346
353
|
hash["doctype"] = doctype if doctype
|
347
|
-
|
354
|
+
if editorialgroup&.presence?
|
355
|
+
hash["editorialgroup"] = editorialgroup.to_hash
|
356
|
+
end
|
348
357
|
hash["ics"] = single_element_array ics if ics.any?
|
349
358
|
if structuredidentifier&.presence?
|
350
359
|
hash["structuredidentifier"] = structuredidentifier.to_hash
|
@@ -406,7 +415,7 @@ module RelatonBib
|
|
406
415
|
end
|
407
416
|
|
408
417
|
# remove title part components and abstract
|
409
|
-
def to_all_parts # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
418
|
+
def to_all_parts # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
|
410
419
|
me = deep_clone
|
411
420
|
me.disable_id_attribute
|
412
421
|
me.relation << DocumentRelation.new(type: "instance", bibitem: self)
|
@@ -449,7 +458,7 @@ module RelatonBib
|
|
449
458
|
|
450
459
|
# If revision_date exists then returns it else returns published date or nil
|
451
460
|
# @return [String, NilClass]
|
452
|
-
def revdate # rubocop:disable Metrics/CyclomaticComplexity
|
461
|
+
def revdate # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
453
462
|
@revdate ||= if version&.revision_date
|
454
463
|
version.revision_date
|
455
464
|
else
|
@@ -526,7 +535,7 @@ module RelatonBib
|
|
526
535
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
527
536
|
|
528
537
|
# @param [BibTeX::Entry]
|
529
|
-
def bibtex_author(item) # rubocop:disable Metrics/CyclomaticComplexity
|
538
|
+
def bibtex_author(item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
530
539
|
authors = contributor.select do |c|
|
531
540
|
c.entity.is_a?(Person) && c.role.map(&:type).include?("author")
|
532
541
|
end.map &:entity
|
@@ -560,7 +569,7 @@ module RelatonBib
|
|
560
569
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
561
570
|
|
562
571
|
# @param [BibTeX::Entry]
|
563
|
-
def bibtex_note(item) # rubocop:disable Metrics/CyclomaticComplexity
|
572
|
+
def bibtex_note(item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize
|
564
573
|
biblionote.each do |n|
|
565
574
|
case n.type
|
566
575
|
when "annote" then item.annote = n.content
|
@@ -677,6 +686,9 @@ module RelatonBib
|
|
677
686
|
builder.edition edition if edition
|
678
687
|
version&.to_xml builder
|
679
688
|
biblionote.each { |n| n.to_xml builder }
|
689
|
+
opts[:note]&.each do |n|
|
690
|
+
builder.note(n[:text], format: "text/plain", type: n[:type])
|
691
|
+
end
|
680
692
|
language.each { |l| builder.language l }
|
681
693
|
script.each { |s| builder.script s }
|
682
694
|
abstract.each { |a| builder.abstract { a.to_xml(builder) } }
|
@@ -20,21 +20,26 @@ module RelatonBib
|
|
20
20
|
def remove_part
|
21
21
|
case @type
|
22
22
|
when "Chinese Standard" then @id.sub!(/\.\d+/, "")
|
23
|
-
|
24
|
-
|
23
|
+
when "ISO", "IEC" then @id.sub!(/-[^:]+/, "")
|
24
|
+
when "URN" then remove_urn_part
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
def remove_date
|
29
29
|
case @type
|
30
30
|
when "Chinese Standard" then @id.sub!(/-[12]\d\d\d/, "")
|
31
|
-
|
32
|
-
|
31
|
+
when "ISO", "IEC" then @id.sub!(/:[12]\d\d\d/, "")
|
32
|
+
when "URN"
|
33
|
+
@id.sub!(/^(urn:iec:std:[^:]+:[^:]+:)[^:]*/, '\1')
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
37
|
def all_parts
|
37
|
-
|
38
|
+
if type == "URN"
|
39
|
+
@id.sub!(%r{^(urn:iec:std(?::[^:]*){4}).*}, '\1:ser')
|
40
|
+
else
|
41
|
+
@id += " (all parts)"
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
#
|
@@ -67,5 +72,24 @@ module RelatonBib
|
|
67
72
|
out += "#{pref}docid.id:: #{id}\n"
|
68
73
|
out
|
69
74
|
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def remove_urn_part # rubocop:disable Metrics/MethodLength
|
79
|
+
@id.sub!(%r{^
|
80
|
+
(urn:iso:std:[^:]+ # ISO prefix and originator
|
81
|
+
(?::(?:data|guide|isp|iwa|pas|r|tr|ts|tta)) # type
|
82
|
+
?:\d+) # docnumber
|
83
|
+
(?::-[^:]+)? # partnumber
|
84
|
+
(?::(draft|cancelled|stage-[^:]+))? # status
|
85
|
+
(?::ed-\d+)?(?::v[^:]+)? # edition and version
|
86
|
+
(?::\w{2}(?:,\w{2})*)? # langauge
|
87
|
+
}x, '\1') # remove partnumber, status, version, and language
|
88
|
+
@id.sub!(%r{^
|
89
|
+
(urn:iec:std:[^:]+ # IEC prefix and originator
|
90
|
+
:\d+) # docnumber
|
91
|
+
(?:-[^:]+)? # partnumber
|
92
|
+
}x, '\1') # remove partnumber
|
93
|
+
end
|
70
94
|
end
|
71
95
|
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|