relaton-bib 1.2.1 → 1.4.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +1 -0
  3. data/.rubocop.yml +2 -2
  4. data/README.adoc +60 -18
  5. data/grammars/isodoc.rng +130 -21
  6. data/grammars/reqt.rng +2 -8
  7. data/lib/relaton_bib.rb +15 -15
  8. data/lib/relaton_bib/bib_item_locality.rb +13 -1
  9. data/lib/relaton_bib/biblio_note.rb +11 -0
  10. data/lib/relaton_bib/biblio_version.rb +12 -0
  11. data/lib/relaton_bib/bibliographic_date.rb +13 -0
  12. data/lib/relaton_bib/bibliographic_item.rb +93 -25
  13. data/lib/relaton_bib/classification.rb +11 -0
  14. data/lib/relaton_bib/contribution_info.rb +27 -1
  15. data/lib/relaton_bib/contributor.rb +55 -1
  16. data/lib/relaton_bib/copyright_association.rb +14 -1
  17. data/lib/relaton_bib/document_identifier.rb +49 -9
  18. data/lib/relaton_bib/document_relation.rb +14 -4
  19. data/lib/relaton_bib/document_relation_collection.rb +12 -0
  20. data/lib/relaton_bib/document_status.rb +10 -0
  21. data/lib/relaton_bib/editorial_group.rb +14 -0
  22. data/lib/relaton_bib/formatted_ref.rb +7 -0
  23. data/lib/relaton_bib/formatted_string.rb +11 -0
  24. data/lib/relaton_bib/hash_converter.rb +55 -36
  25. data/lib/relaton_bib/ics.rb +11 -0
  26. data/lib/relaton_bib/localized_string.rb +23 -6
  27. data/lib/relaton_bib/medium.rb +11 -0
  28. data/lib/relaton_bib/organization.rb +27 -7
  29. data/lib/relaton_bib/person.rb +54 -7
  30. data/lib/relaton_bib/place.rb +13 -1
  31. data/lib/relaton_bib/series.rb +25 -4
  32. data/lib/relaton_bib/structured_identifier.rb +30 -0
  33. data/lib/relaton_bib/technical_committee.rb +11 -0
  34. data/lib/relaton_bib/typed_title_string.rb +13 -7
  35. data/lib/relaton_bib/typed_uri.rb +11 -0
  36. data/lib/relaton_bib/validity.rb +11 -0
  37. data/lib/relaton_bib/version.rb +1 -1
  38. data/lib/relaton_bib/workgroup.rb +10 -0
  39. data/lib/relaton_bib/xml_parser.rb +54 -39
  40. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 026ef052bd32c3b3502c08a89ab9e96c567d9a4c1365600ba1b3eb3f45298d76
4
- data.tar.gz: ada471ed627f7f4e195e1d740d16c59ed2e6e19ed9e876b387bc2c1159b4cc49
3
+ metadata.gz: bd9ee52233758a976f5f9d4e549c61c899a643afddf3486215b219b868041d76
4
+ data.tar.gz: dc9878b905a4412fe8237f71a422f23252a7f9933e882e1d502333890e00ba1d
5
5
  SHA512:
6
- metadata.gz: f825fab737519ed11271311000c500419dfee3dafce65fa1afaae9fd4d08238ad8487bc258ce7dff3bdda2a692b9dd915b29330c30fce029796a635d601e4934
7
- data.tar.gz: 2a8384daf44986795896388695b5c6c53be08c50f9fe34c06ca5fdfed52f18628075340b9179345b232e9df823e1151e751b1c66287ef6d8b2c669b770528a74
6
+ metadata.gz: 07d38211e4b0e19152e0c92341902f3a93482795c4cd1b019e67b33dd95edfba630cd9c474f8b3c930bf36dee99f346f8142f49252e296a2867580ffb53082ba
7
+ data.tar.gz: 3a070a16d70d30bc72750325d314ab548938d224e58aa584748572be85b4e5e66d94b8ca204583faa40231adacd86a0eec1ea4d40c4d4261ab2dbc484492d7db
@@ -35,4 +35,5 @@ jobs:
35
35
  bundle install --jobs 4 --retry 3
36
36
  - name: Run specs
37
37
  run: |
38
+ unset JAVA_TOOL_OPTIONS
38
39
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -136,10 +136,13 @@ item = RelatonBib::BibliographicItem.new(
136
136
  },
137
137
  { entity: { name: "Institution" }, role: [type: "sponsor"] }
138
138
  ],
139
- copyright: { owner: {
140
- name: "International Organization for Standardization",
141
- abbreviation: "ISO", url: "www.iso.org"
142
- }, from: "2014", to: "2020" },
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:0x007fa49a35aed0 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
256
- #<RelatonBib::FormattedString:0x007fa49a35ae08 @content="L'ISO 19115-1:2014 définit le schéma requis pour ...", @format="text/plain", @language=["fr"], @script=["Latn"]>]
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
- => "ISO/TC211:2014"
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=\"ISO/TC211\" type=\"standard\">
287
+ => "<bibitem id="ISO/TC211" type="standard">
276
288
  <fetched>2019-04-30</fetched>
277
- <title type=\"main\" language=\"en\" script=\"Latn\">Geographic information</title>
278
- <title language=\"fr\" script=\"Latn\">Information géographique</title>
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=\"standard\">
300
+ => "<bibdata type="standard">
289
301
  <fetched>2019-04-30</fetched>
290
- <title type=\"main\" language=\"en\" script=\"Latn\">Geographic information</title>
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
- [surce,ruby]
311
+ [source,ruby]
300
312
  ----
301
313
  item.to_xml date_format: :short
302
- => "<bibitem id=\"ISO/TC211\" type=\"standard\">
314
+ => "<bibitem id="ISO/TC211" type="standard">
303
315
  <fetched>2019-04-30</fetched>
304
- <title type=\"main\" language=\"en\" script=\"Latn\">Geographic information</title>
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=\"ISO/TC211\" type=\"standard\">
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/bibitem.bib')
391
+ RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
366
392
  => {"ISOTC211"=>
367
393
  #<RelatonBib::BibliographicItem:0x007fedee0a2ab0
368
394
  ...
@@ -380,6 +406,22 @@ item.to_bibtex
380
406
  ...
381
407
  ----
382
408
 
409
+ === Exporting bibliographic item to AsciiBib
410
+
411
+ [source,ruby]
412
+ ----
413
+ item.to_asciibib
414
+ [%bibitem]
415
+ == {blank}
416
+ id:: ISOTC211
417
+ fetched:: 2020-08-19
418
+ title::
419
+ title.type:: title-main
420
+ title.conten:: Geographic information
421
+ title.format:: text/plain
422
+ ...
423
+ ----
424
+
383
425
  == Development
384
426
 
385
427
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -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="IDREF"/>
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="preface_abstract"/>
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
- <group>
1050
- <zeroOrMore>
1051
- <ref name="BasicBlock"/>
1052
- </zeroOrMore>
1053
- <zeroOrMore>
1054
- <ref name="note"/>
1055
- </zeroOrMore>
1056
- </group>
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>
@@ -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
- <zeroOrMore>
51
+ <optional>
58
52
  <ref name="reqinherit"/>
59
- </zeroOrMore>
53
+ </optional>
60
54
  <zeroOrMore>
61
55
  <ref name="classification"/>
62
56
  </zeroOrMore>