relaton-bib 1.3.1 → 1.5.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 +136 -21
- data/grammars/reqt.rng +2 -8
- data/lib/relaton_bib.rb +3 -1
- data/lib/relaton_bib/biblio_note.rb +27 -0
- data/lib/relaton_bib/bibliographic_date.rb +2 -1
- data/lib/relaton_bib/bibliographic_item.rb +60 -40
- data/lib/relaton_bib/bibtex_parser.rb +16 -15
- data/lib/relaton_bib/contribution_info.rb +14 -8
- data/lib/relaton_bib/contributor.rb +10 -6
- data/lib/relaton_bib/copyright_association.rb +7 -5
- data/lib/relaton_bib/document_identifier.rb +38 -9
- data/lib/relaton_bib/document_relation.rb +2 -2
- data/lib/relaton_bib/document_relation_collection.rb +0 -2
- data/lib/relaton_bib/document_status.rb +0 -3
- data/lib/relaton_bib/editorial_group.rb +5 -0
- data/lib/relaton_bib/hash_converter.rb +11 -13
- data/lib/relaton_bib/hit.rb +10 -6
- data/lib/relaton_bib/hit_collection.rb +8 -3
- data/lib/relaton_bib/localized_string.rb +3 -3
- data/lib/relaton_bib/organization.rb +26 -15
- data/lib/relaton_bib/person.rb +26 -14
- data/lib/relaton_bib/place.rb +1 -1
- data/lib/relaton_bib/typed_title_string.rb +67 -0
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +16 -7
- 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: 6731fb438a67250f0ea4b70e14aa783a6034595f7e6677f4c97c7158b787355e
|
4
|
+
data.tar.gz: b91531a725bd08256e4c41cb9c61f670195f4e4dd00665b034182e7b990aa228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8cc251a4c9dd90633c123862bdd09b8e7a3745080733aa36db751c26367b66558598d035b0aed131d095cd6d6a67df56e0ec988a4e18e674b64fdf3b216c061
|
7
|
+
data.tar.gz: fa3bb5f8290df770a2607ba65812fa8998650d2cfee2b22170964cf13b8286dd25f162e239e43b7ee5c9ca6e4efd42b819e10a40da77856044c308f03b02796a
|
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
@@ -43,7 +43,9 @@
|
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
45
|
<attribute name="target">
|
46
|
-
<data type="
|
46
|
+
<data type="string">
|
47
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
|
+
</data>
|
47
49
|
</attribute>
|
48
50
|
<optional>
|
49
51
|
<attribute name="type">
|
@@ -61,6 +63,11 @@
|
|
61
63
|
</choice>
|
62
64
|
</attribute>
|
63
65
|
</optional>
|
66
|
+
<optional>
|
67
|
+
<attribute name="droploc">
|
68
|
+
<data type="boolean"/>
|
69
|
+
</attribute>
|
70
|
+
</optional>
|
64
71
|
<text/>
|
65
72
|
</element>
|
66
73
|
</define>
|
@@ -578,6 +585,8 @@
|
|
578
585
|
<ref name="ol"/>
|
579
586
|
<ref name="dl"/>
|
580
587
|
<ref name="formula"/>
|
588
|
+
<ref name="quote"/>
|
589
|
+
<ref name="sourcecode"/>
|
581
590
|
</choice>
|
582
591
|
</oneOrMore>
|
583
592
|
</element>
|
@@ -661,6 +670,16 @@
|
|
661
670
|
</choice>
|
662
671
|
</attribute>
|
663
672
|
</optional>
|
673
|
+
<optional>
|
674
|
+
<attribute name="valign">
|
675
|
+
<choice>
|
676
|
+
<value>top</value>
|
677
|
+
<value>middle</value>
|
678
|
+
<value>bottom</value>
|
679
|
+
<value>baseline</value>
|
680
|
+
</choice>
|
681
|
+
</attribute>
|
682
|
+
</optional>
|
664
683
|
<choice>
|
665
684
|
<zeroOrMore>
|
666
685
|
<choice>
|
@@ -697,6 +716,16 @@
|
|
697
716
|
</choice>
|
698
717
|
</attribute>
|
699
718
|
</optional>
|
719
|
+
<optional>
|
720
|
+
<attribute name="valign">
|
721
|
+
<choice>
|
722
|
+
<value>top</value>
|
723
|
+
<value>middle</value>
|
724
|
+
<value>bottom</value>
|
725
|
+
<value>baseline</value>
|
726
|
+
</choice>
|
727
|
+
</attribute>
|
728
|
+
</optional>
|
700
729
|
<choice>
|
701
730
|
<zeroOrMore>
|
702
731
|
<choice>
|
@@ -834,6 +863,13 @@
|
|
834
863
|
</define>
|
835
864
|
<define name="standard-document">
|
836
865
|
<element name="standard-document">
|
866
|
+
<attribute name="version"/>
|
867
|
+
<attribute name="type">
|
868
|
+
<choice>
|
869
|
+
<value>semantic</value>
|
870
|
+
<value>presentation</value>
|
871
|
+
</choice>
|
872
|
+
</attribute>
|
837
873
|
<ref name="bibdata"/>
|
838
874
|
<optional>
|
839
875
|
<ref name="boilerplate"/>
|
@@ -855,7 +891,7 @@
|
|
855
891
|
<oneOrMore>
|
856
892
|
<choice>
|
857
893
|
<ref name="content"/>
|
858
|
-
<ref name="
|
894
|
+
<ref name="abstract"/>
|
859
895
|
<ref name="foreword"/>
|
860
896
|
<ref name="introduction"/>
|
861
897
|
<ref name="acknowledgements"/>
|
@@ -922,6 +958,9 @@
|
|
922
958
|
<optional>
|
923
959
|
<attribute name="script"/>
|
924
960
|
</optional>
|
961
|
+
<optional>
|
962
|
+
<attribute name="type"/>
|
963
|
+
</optional>
|
925
964
|
<optional>
|
926
965
|
<attribute name="obligation">
|
927
966
|
<choice>
|
@@ -961,9 +1000,6 @@
|
|
961
1000
|
</define>
|
962
1001
|
<define name="content-subsection">
|
963
1002
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
1003
|
<ref name="Content-Section"/>
|
968
1004
|
</element>
|
969
1005
|
</define>
|
@@ -992,6 +1028,9 @@
|
|
992
1028
|
</choice>
|
993
1029
|
</attribute>
|
994
1030
|
</optional>
|
1031
|
+
<optional>
|
1032
|
+
<attribute name="type"/>
|
1033
|
+
</optional>
|
995
1034
|
<optional>
|
996
1035
|
<ref name="section-title"/>
|
997
1036
|
</optional>
|
@@ -1011,9 +1050,6 @@
|
|
1011
1050
|
</define>
|
1012
1051
|
<define name="clause">
|
1013
1052
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1053
|
<ref name="Clause-Section"/>
|
1018
1054
|
</element>
|
1019
1055
|
</define>
|
@@ -1042,18 +1078,24 @@
|
|
1042
1078
|
</choice>
|
1043
1079
|
</attribute>
|
1044
1080
|
</optional>
|
1081
|
+
<optional>
|
1082
|
+
<attribute name="type"/>
|
1083
|
+
</optional>
|
1045
1084
|
<optional>
|
1046
1085
|
<ref name="section-title"/>
|
1047
1086
|
</optional>
|
1048
1087
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1088
|
+
<choice>
|
1089
|
+
<group>
|
1090
|
+
<zeroOrMore>
|
1091
|
+
<ref name="BasicBlock"/>
|
1092
|
+
</zeroOrMore>
|
1093
|
+
<zeroOrMore>
|
1094
|
+
<ref name="note"/>
|
1095
|
+
</zeroOrMore>
|
1096
|
+
</group>
|
1097
|
+
<ref name="amend"/>
|
1098
|
+
</choice>
|
1057
1099
|
<zeroOrMore>
|
1058
1100
|
<choice>
|
1059
1101
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1222,9 @@
|
|
1180
1222
|
<optional>
|
1181
1223
|
<attribute name="script"/>
|
1182
1224
|
</optional>
|
1225
|
+
<optional>
|
1226
|
+
<attribute name="type"/>
|
1227
|
+
</optional>
|
1183
1228
|
<optional>
|
1184
1229
|
<attribute name="obligation">
|
1185
1230
|
<choice>
|
@@ -1447,11 +1492,6 @@
|
|
1447
1492
|
</optional>
|
1448
1493
|
</element>
|
1449
1494
|
</define>
|
1450
|
-
<define name="preface_abstract">
|
1451
|
-
<element name="abstract">
|
1452
|
-
<ref name="Basic-Section"/>
|
1453
|
-
</element>
|
1454
|
-
</define>
|
1455
1495
|
<define name="term-clause">
|
1456
1496
|
<element name="clause">
|
1457
1497
|
<optional>
|
@@ -1501,4 +1541,79 @@
|
|
1501
1541
|
<ref name="CitationType"/>
|
1502
1542
|
</element>
|
1503
1543
|
</define>
|
1544
|
+
<define name="amend">
|
1545
|
+
<element name="amend">
|
1546
|
+
<optional>
|
1547
|
+
<attribute name="id">
|
1548
|
+
<data type="ID"/>
|
1549
|
+
</attribute>
|
1550
|
+
</optional>
|
1551
|
+
<attribute name="change">
|
1552
|
+
<choice>
|
1553
|
+
<value>add</value>
|
1554
|
+
<value>modify</value>
|
1555
|
+
<value>delete</value>
|
1556
|
+
</choice>
|
1557
|
+
</attribute>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="path"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<attribute name="path_end"/>
|
1563
|
+
</optional>
|
1564
|
+
<optional>
|
1565
|
+
<attribute name="title"/>
|
1566
|
+
</optional>
|
1567
|
+
<optional>
|
1568
|
+
<element name="location">
|
1569
|
+
<zeroOrMore>
|
1570
|
+
<ref name="locality"/>
|
1571
|
+
</zeroOrMore>
|
1572
|
+
</element>
|
1573
|
+
</optional>
|
1574
|
+
<zeroOrMore>
|
1575
|
+
<ref name="autonumber"/>
|
1576
|
+
</zeroOrMore>
|
1577
|
+
<optional>
|
1578
|
+
<element name="description">
|
1579
|
+
<zeroOrMore>
|
1580
|
+
<ref name="BasicBlock"/>
|
1581
|
+
</zeroOrMore>
|
1582
|
+
</element>
|
1583
|
+
</optional>
|
1584
|
+
<optional>
|
1585
|
+
<element name="newcontent">
|
1586
|
+
<zeroOrMore>
|
1587
|
+
<ref name="BasicBlock"/>
|
1588
|
+
</zeroOrMore>
|
1589
|
+
</element>
|
1590
|
+
</optional>
|
1591
|
+
<optional>
|
1592
|
+
<element name="description">
|
1593
|
+
<zeroOrMore>
|
1594
|
+
<ref name="BasicBlock"/>
|
1595
|
+
</zeroOrMore>
|
1596
|
+
</element>
|
1597
|
+
</optional>
|
1598
|
+
</element>
|
1599
|
+
</define>
|
1600
|
+
<define name="autonumber">
|
1601
|
+
<element name="autonumber">
|
1602
|
+
<attribute name="type">
|
1603
|
+
<choice>
|
1604
|
+
<value>requirement</value>
|
1605
|
+
<value>recommendation</value>
|
1606
|
+
<value>permission</value>
|
1607
|
+
<value>table</value>
|
1608
|
+
<value>figure</value>
|
1609
|
+
<value>admonition</value>
|
1610
|
+
<value>formula</value>
|
1611
|
+
<value>sourcecode</value>
|
1612
|
+
<value>example</value>
|
1613
|
+
<value>note</value>
|
1614
|
+
</choice>
|
1615
|
+
</attribute>
|
1616
|
+
<text/>
|
1617
|
+
</element>
|
1618
|
+
</define>
|
1504
1619
|
</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>
|
data/lib/relaton_bib.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
require "forwardable"
|
1
2
|
require "relaton_bib/version"
|
2
3
|
require "relaton_bib/deep_dup"
|
4
|
+
require "relaton_bib/localized_string"
|
3
5
|
require "relaton_bib/bibliographic_item"
|
4
6
|
require "relaton_bib/hit_collection"
|
5
7
|
require "relaton_bib/hit"
|
@@ -34,7 +36,7 @@ module RelatonBib
|
|
34
36
|
|
35
37
|
# @param array [Array]
|
36
38
|
# @return [Array<String>, String]
|
37
|
-
def single_element_array(array) # rubocop:disable Metrics/CyclomaticComplexity
|
39
|
+
def single_element_array(array) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
38
40
|
if array.size > 1
|
39
41
|
array.map { |e| e.is_a?(String) ? e : e.to_hash }
|
40
42
|
else
|