relaton-bib 1.4.0 → 2.1.7

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/integration-tests.yml +54 -0
  3. data/.github/workflows/rake.yml +15 -0
  4. data/.github/workflows/release.yml +24 -0
  5. data/.gitignore +4 -1
  6. data/.rubocop.yml +3 -1
  7. data/CLAUDE.md +108 -0
  8. data/Gemfile +11 -0
  9. data/README.adoc +229 -314
  10. data/bin/console +1 -1
  11. data/docs/hash.adoc +132 -83
  12. data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
  13. data/lib/relaton/bib/converter/asciibib.rb +13 -0
  14. data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
  15. data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
  16. data/lib/relaton/bib/converter/bibtex.rb +23 -0
  17. data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
  18. data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
  19. data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
  20. data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
  21. data/lib/relaton/bib/converter/bibxml.rb +51 -0
  22. data/lib/relaton/bib/hash_parser_v1.rb +767 -0
  23. data/lib/relaton/bib/item_data.rb +229 -0
  24. data/lib/relaton/bib/model/abstract.rb +16 -0
  25. data/lib/relaton/bib/model/address.rb +22 -0
  26. data/lib/relaton/bib/model/affiliation.rb +16 -0
  27. data/lib/relaton/bib/model/bibdata.rb +9 -0
  28. data/lib/relaton/bib/model/bibdata_shared.rb +10 -0
  29. data/lib/relaton/bib/model/bibitem.rb +9 -0
  30. data/lib/relaton/bib/model/bibitem_shared.rb +10 -0
  31. data/lib/relaton/bib/model/contact.rb +14 -0
  32. data/lib/relaton/bib/model/contribution_info.rb +16 -0
  33. data/lib/relaton/bib/model/contributor.rb +29 -0
  34. data/lib/relaton/bib/model/copyright.rb +27 -0
  35. data/lib/relaton/bib/model/date.rb +29 -0
  36. data/lib/relaton/bib/model/depiction.rb +16 -0
  37. data/lib/relaton/bib/model/docidentifier.rb +34 -0
  38. data/lib/relaton/bib/model/doctype.rb +14 -0
  39. data/lib/relaton/bib/model/edition.rb +14 -0
  40. data/lib/relaton/bib/model/ext.rb +35 -0
  41. data/lib/relaton/bib/model/extent.rb +16 -0
  42. data/lib/relaton/bib/model/formattedref.rb +43 -0
  43. data/lib/relaton/bib/model/full_name_type.rb +64 -0
  44. data/lib/relaton/bib/model/fullname.rb +11 -0
  45. data/lib/relaton/bib/model/ics.rb +49 -0
  46. data/lib/relaton/bib/model/image.rb +28 -0
  47. data/lib/relaton/bib/model/item.rb +44 -0
  48. data/lib/relaton/bib/model/item_base.rb +20 -0
  49. data/lib/relaton/bib/model/item_shared.rb +88 -0
  50. data/lib/relaton/bib/model/keyword.rb +30 -0
  51. data/lib/relaton/bib/model/locality.rb +18 -0
  52. data/lib/relaton/bib/model/locality_stack.rb +14 -0
  53. data/lib/relaton/bib/model/localized_string.rb +48 -0
  54. data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
  55. data/lib/relaton/bib/model/logo.rb +14 -0
  56. data/lib/relaton/bib/model/medium.rb +22 -0
  57. data/lib/relaton/bib/model/note.rb +16 -0
  58. data/lib/relaton/bib/model/organization.rb +11 -0
  59. data/lib/relaton/bib/model/organization_type.rb +40 -0
  60. data/lib/relaton/bib/model/person.rb +36 -0
  61. data/lib/relaton/bib/model/phone.rb +14 -0
  62. data/lib/relaton/bib/model/place.rb +33 -0
  63. data/lib/relaton/bib/model/price.rb +14 -0
  64. data/lib/relaton/bib/model/relation.rb +41 -0
  65. data/lib/relaton/bib/model/series.rb +32 -0
  66. data/lib/relaton/bib/model/size.rb +23 -0
  67. data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
  68. data/lib/relaton/bib/model/status.rb +27 -0
  69. data/lib/relaton/bib/model/structured_identifier.rb +48 -0
  70. data/lib/relaton/bib/model/subdivision.rb +16 -0
  71. data/lib/relaton/bib/model/title.rb +56 -0
  72. data/lib/relaton/bib/model/type/plain_date.rb +16 -0
  73. data/lib/relaton/bib/model/type/string_date.rb +48 -0
  74. data/lib/relaton/bib/model/uri.rb +18 -0
  75. data/lib/relaton/bib/model/validity.rb +16 -0
  76. data/lib/relaton/bib/model/version.rb +43 -0
  77. data/lib/relaton/bib/model_autoload.rb +85 -0
  78. data/lib/relaton/bib/namespace_helper.rb +21 -0
  79. data/lib/relaton/bib/sanitizer.rb +74 -0
  80. data/lib/relaton/bib/util.rb +18 -0
  81. data/lib/relaton/bib/version.rb +5 -0
  82. data/lib/relaton/bib/versions.json +35 -0
  83. data/lib/relaton/bib.rb +41 -0
  84. data/relaton-bib.gemspec +12 -16
  85. metadata +118 -129
  86. data/.github/workflows/macos.yml +0 -38
  87. data/.github/workflows/ubuntu.yml +0 -39
  88. data/.github/workflows/windows.yml +0 -41
  89. data/grammars/basicdoc.rng +0 -986
  90. data/grammars/biblio.rng +0 -1237
  91. data/grammars/isodoc.rng +0 -1613
  92. data/grammars/reqt.rng +0 -165
  93. data/lib/relaton_bib/bib_item_locality.rb +0 -107
  94. data/lib/relaton_bib/biblio_note.rb +0 -44
  95. data/lib/relaton_bib/biblio_version.rb +0 -49
  96. data/lib/relaton_bib/bibliographic_date.rb +0 -90
  97. data/lib/relaton_bib/bibliographic_item.rb +0 -726
  98. data/lib/relaton_bib/bibtex_parser.rb +0 -245
  99. data/lib/relaton_bib/classification.rb +0 -40
  100. data/lib/relaton_bib/contribution_info.rb +0 -109
  101. data/lib/relaton_bib/contributor.rb +0 -215
  102. data/lib/relaton_bib/copyright_association.rb +0 -77
  103. data/lib/relaton_bib/deep_dup.rb +0 -30
  104. data/lib/relaton_bib/document_identifier.rb +0 -95
  105. data/lib/relaton_bib/document_relation.rb +0 -94
  106. data/lib/relaton_bib/document_relation_collection.rb +0 -46
  107. data/lib/relaton_bib/document_status.rb +0 -93
  108. data/lib/relaton_bib/editorial_group.rb +0 -41
  109. data/lib/relaton_bib/formatted_ref.rb +0 -17
  110. data/lib/relaton_bib/formatted_string.rb +0 -55
  111. data/lib/relaton_bib/hash_converter.rb +0 -497
  112. data/lib/relaton_bib/hit.rb +0 -46
  113. data/lib/relaton_bib/hit_collection.rb +0 -73
  114. data/lib/relaton_bib/ics.rb +0 -37
  115. data/lib/relaton_bib/localized_string.rb +0 -93
  116. data/lib/relaton_bib/medium.rb +0 -44
  117. data/lib/relaton_bib/organization.rb +0 -135
  118. data/lib/relaton_bib/person.rb +0 -206
  119. data/lib/relaton_bib/place.rb +0 -49
  120. data/lib/relaton_bib/series.rb +0 -134
  121. data/lib/relaton_bib/structured_identifier.rb +0 -171
  122. data/lib/relaton_bib/technical_committee.rb +0 -36
  123. data/lib/relaton_bib/typed_title_string.rb +0 -96
  124. data/lib/relaton_bib/typed_uri.rb +0 -47
  125. data/lib/relaton_bib/validity.rb +0 -52
  126. data/lib/relaton_bib/version.rb +0 -3
  127. data/lib/relaton_bib/workers_pool.rb +0 -43
  128. data/lib/relaton_bib/workgroup.rb +0 -46
  129. data/lib/relaton_bib/xml_parser.rb +0 -463
  130. data/lib/relaton_bib.rb +0 -44
data/docs/hash.adoc CHANGED
@@ -49,7 +49,7 @@ The structure below is given in YAML format:
49
49
  # bibliographic item anchor, used to crossreference within document
50
50
  id: ISO/TC211
51
51
  # date record was created
52
- fetched: 2019-06-30
52
+ fetched: '2019-06-30'
53
53
  # titles are an array, with a mandatory type and content, and optional format, language and script
54
54
  title:
55
55
  - type: main
@@ -66,9 +66,9 @@ docid:
66
66
  type: ISO
67
67
  id: TC211
68
68
  # document number
69
- docnumber: 211
69
+ docnumber: '211'
70
70
  # edition
71
- edition: 1
71
+ edition: '1'
72
72
  # language is an array
73
73
  language:
74
74
  - en
@@ -78,7 +78,7 @@ script:
78
78
  Latn
79
79
  # version contains revision date and draft (as array)
80
80
  version:
81
- revision_date: 2019-04-01
81
+ revision_date: '2019-04-01'
82
82
  draft: draft
83
83
  # note is an array of type and content
84
84
  biblionote:
@@ -88,18 +88,21 @@ biblionote:
88
88
  home run record in 1998.
89
89
  # document status has stage, and optional substage and iteration
90
90
  docstatus:
91
- stage: stage
92
- substage: substage
93
- iteration: iteration
91
+ stage:
92
+ value: '30'
93
+ abbreviation: CD
94
+ substage:
95
+ value: '00'
96
+ iteration: final
94
97
  # date is an array, with mandatory type, and either an "on" value or a "from" and optional "to" value
95
98
  date:
96
99
  - type: issued
97
- value: 2014
100
+ value: '2014'
98
101
  - type: published
99
- from: 2014-04
100
- to: 2014-05
102
+ from: '2014-04'
103
+ to: '2014-05'
101
104
  - type: accessed
102
- value: 2015-05-20
105
+ value: '2015-05-20'
103
106
  # abstract is an array, with content, and optional language, script, format
104
107
  abstract:
105
108
  - content: >
@@ -112,16 +115,16 @@ abstract:
112
115
  # contributors are an array of entity/role pairs, where entity is either person or organization.
113
116
  # The role is an array of type and description; it can be a an array of just string, which are treated
114
117
  # as the type.
115
- # Organisations have attributes name, url, abbreviation, subdivision, contacts, identifiers
118
+ # Organisations have attributes name, url, abbreviation, subdivision, contacts, identifiers, logo.
116
119
  # Persons have attributes name, affiliation, contacts
117
- # Person names have attributes surname, completename, initials, forename, additions, prefixes.
120
+ # Person names have attributes abbreviation, surname, completename, initials, forename, additions, prefixes.
118
121
  # Initials, forename, additions, prefixes are arrays.
119
122
  # Name field values are either strings, or hashes, with content and language and script attributes.
120
123
  # The language and script attribute can also be given on the name.
121
124
  # Contacts are an array, containing either addresses, or other fields.
122
125
  # Addresses are identified as hashes containing a city attribute; they can also contain a street
123
126
  # (which is an array), a postcode, a state, and a country. The other contact fields
124
- # are phones, emails, uris; they contain a type giving the field name, and a value.
127
+ # are phones, emails, uris; they can contain a type.
125
128
  # Affiliations are an array, and they contains an organization, and an optional description.
126
129
  # The affiliation description can be a single string, or a hash of content, language, script, and format.
127
130
  contributor:
@@ -130,6 +133,17 @@ contributor:
130
133
  url: www.iso.org
131
134
  abbreviation: ISO
132
135
  subdivision: division
136
+ logo:
137
+ image:
138
+ id: logo1
139
+ src: logo1.png
140
+ mimetype: image/png
141
+ filename: logo1.png
142
+ height: "100%"
143
+ width: "200"
144
+ alt: Logo 1
145
+ title: "Logo #1"
146
+ longdesc: Logo number 1
133
147
  role:
134
148
  type: publisher
135
149
  description: Publisher role
@@ -142,21 +156,22 @@ contributor:
142
156
  - organization:
143
157
  name: IETF
144
158
  abbreviation: IETF
145
- identifier:
146
- - type: uri
147
- id: www.ietf.org
159
+ identifier:
160
+ - type: uri
161
+ id: www.ietf.org
148
162
  description: Affiliation description
149
163
  contact:
150
- - street:
151
- - 8 Street St
152
- city: City
153
- postcode: 123456
154
- country: Country
155
- state: State
156
- - type: phone
157
- value: 223322
164
+ - address:
165
+ street:
166
+ - 8 Street St
167
+ city: City
168
+ postcode: '123456'
169
+ country: Country
170
+ state: State
171
+ - phone: '223322'
172
+ type: mobile
158
173
  role: author
159
- - person:
174
+ - organization:
160
175
  name: IETF
161
176
  abbreviation: IETF
162
177
  identifier:
@@ -166,6 +181,7 @@ contributor:
166
181
  publisher
167
182
  - person:
168
183
  name:
184
+ abbreviation: AB
169
185
  language: en
170
186
  initial:
171
187
  - A.
@@ -190,8 +206,8 @@ copyright:
190
206
  name: International Organization for Standardization
191
207
  abbreviation: ISO
192
208
  url: www.iso.org
193
- from: 2014
194
- to: 2020
209
+ from: '2014'
210
+ to: '2020'
195
211
  # link is an array of URIs, with a type and content
196
212
  link:
197
213
  - type: src
@@ -200,24 +216,45 @@ link:
200
216
  content: https://www.iso.org/obp/ui/#!iso:std:53798:en
201
217
  - type: rss
202
218
  content: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss
203
- # relations are an array of type, bibitem, and bib_locality.
219
+ # relations are an array of type, bibitem, locality, source_locality, and description.
204
220
  # bibitem contains any of the attributes of a bibliographic item.
205
- # bib_locality is an array that contains a type, a reference_from, and optionally a reference_to
221
+ # locality is an array of locality_stack which is an array of hash of type,
222
+ # reference_from, and optionally reference_to
223
+ # source_locality is an array of source_locality_stack which is similar to locality_stack
224
+ # description is optional and contains content and optional format, language, ans script.
206
225
  relation:
207
226
  - type: updates
208
227
  bibitem:
209
228
  formattedref: ISO 19115:2003
210
- bib_locality:
211
- type: page
212
- reference_from: 7
213
- reference_to: 10
229
+ locality:
230
+ locality_stack:
231
+ type: page
232
+ reference_from: '7'
233
+ reference_to: '10'
234
+ source_locality:
235
+ source_locality_stack:
236
+ - type: volume
237
+ reference_from: '1'
238
+ - type: chapter
239
+ reference_from: '2'
214
240
  - type: updates
215
241
  bibitem:
216
242
  type: standard
217
- formattedref: ISO 19115:2003/Cor 1:2006
218
- # series are an array, containing a type, and either a formattedref, or:
219
- # a title, a place, an organization (string),
220
- # an abbreviation, a from, a to, a number, and a partnumber.
243
+ formattedref:
244
+ content: ISO 19115:2003/Cor 1:2006
245
+ format: text/plain
246
+ description:
247
+ content: supersedes
248
+ format: text/plain
249
+ - type: partOf
250
+ bibitem:
251
+ title:
252
+ type: main
253
+ content: Book title
254
+ format: text/plain
255
+ # series are an array, containing a title, a type, a formattedref, a place,
256
+ # an organization (string), an abbreviation, a from, a to, a number, and a partnumber.
257
+ # The title is mandatory, and all other fields are optional.
221
258
  # The series title, like the titles of bibliographic items, contains a type,
222
259
  # content, and optional language, script, and format attributes.
223
260
  # The abbreviation and formattedref are either a string,
@@ -236,26 +273,41 @@ series:
236
273
  content: ABVR
237
274
  language: en
238
275
  script: Latn
239
- from: 2009-02-01
240
- to: 2010-12-20
276
+ from: '2009-02-01'
277
+ to: '2010-12-20'
241
278
  number: serie1234
242
279
  partnumber: part5678
243
- - type: alt
244
- formattedref:
245
- content: serieref
246
- language: en
247
- script: Latn
280
+ - title:
281
+ - content: Series
282
+ language: en
283
+ script: Latn
284
+ - content: Séries
285
+ language: fr
286
+ script: Latn
287
+ format: text/plain
248
288
  # medium contains a form, a size, and a scale
249
289
  medium:
250
290
  form: medium form
251
291
  size: medium size
252
292
  scale: medium scale
253
- # place is an array of strings
254
- place: bib place
255
- # extent is an array, containing type, a reference_from, and an optional reference_to
293
+ # place is an array of strings or hashes. Can have name or city, region and country.
294
+ # Name or city is mandatory, region and country are optional.
295
+ # String and hash with name are equivalent.
296
+ place:
297
+ - bib place
298
+ - city: Geneva
299
+ region:
300
+ - name: Region
301
+ country:
302
+ - iso: CH
303
+ name: Switzelznd
304
+ recommended: true
305
+ # extent is an array, localities are an array of locality_stack
256
306
  extent:
257
- type: section
258
- reference_from: 7
307
+ locality:
308
+ type: section
309
+ reference_from: '7'
310
+ reference_to: '10'
259
311
  # accesslocation is an array of strings
260
312
  accesslocation:
261
313
  - accesslocation1
@@ -266,9 +318,15 @@ classification:
266
318
  value: value
267
319
  # validity contains a begins date, an ends date, and a revision date
268
320
  validity:
269
- begins: 2010-10-10 12:21
270
- ends: 2011-02-03 18:30
271
- revision: 2011-03-04 09:00
321
+ begins: '2010-10-10 12:21'
322
+ ends: '2011-02-03 18:30'
323
+ revision: '2011-03-04 09:00'
324
+ # keyword is an array of strings or hashes of content, language, script, and format
325
+ keyword:
326
+ - Keyword
327
+ - Key Word
328
+ # license is a string
329
+ license: License
272
330
  ----
273
331
 
274
332
  == Metanorma structure (AsciiBib): nested definition list
@@ -528,8 +586,9 @@ medium::
528
586
  scale::: medium scale
529
587
  place:: bib place
530
588
  extent::
531
- type::: section
532
- reference_from::: 7
589
+ locality:::
590
+ type::: section
591
+ reference_from::: 7
533
592
  accesslocation::
534
593
  . accesslocation1
535
594
  . accesslocation2
@@ -571,7 +630,7 @@ type::: uri
571
630
  id::: www.ietf.org
572
631
  --
573
632
  description:::: Affiliation description
574
- contact:::
633
+ address:::
575
634
  street::::
576
635
  . 8 Street St
577
636
  city:::: City
@@ -579,8 +638,8 @@ id::: www.ietf.org
579
638
  country:::: Country
580
639
  state:::: State
581
640
  contact:::
582
- type:::: phone
583
- value:::: 223322
641
+ mobile:::: 223322
642
+ phone:::: mobile
584
643
  role:: author
585
644
 
586
645
  ==== Contributor
@@ -699,7 +758,6 @@ docid::
699
758
  docid::
700
759
  type::: ABC
701
760
  id::: 32784
702
- type:: standard
703
761
  ----
704
762
 
705
763
  can instead be represented as:
@@ -726,15 +784,11 @@ Embedded elements can also repeat:
726
784
  ==== Contributor
727
785
  person::
728
786
  contact:::
729
- street::::
730
- . 8 Street St
731
- city:::: City
732
- postcode:::: 123456
733
- country:::: Country
734
- state:::: State
787
+ phone:::: 223322
788
+ type:::: mobile
735
789
  contact:::
736
- type:::: phone
737
- value:::: 223322
790
+ phone:::: 332233
791
+ type:::: work
738
792
  ----
739
793
 
740
794
  can instead be represented as:
@@ -744,14 +798,11 @@ can instead be represented as:
744
798
  [%bibitem]
745
799
  ...
746
800
  contributor.person.contact::
747
- contributor.person.contact.street:: 8 Street St
748
- contributor.person.contact.city:: City
749
- contributor.person.contact.postcode:: 123456
750
- contributor.person.contact.country:: Country
751
- contributor.person.contact.state:: State
801
+ contributor.person.contact.phone:: 223322
802
+ contributor.person.contact.type:: mobile
752
803
  contributor.person.contact::
753
- contributor.person.contact.type:: phone
754
- contributor.person.contact.value:: 223322
804
+ contributor.person.contact.phone:: 332233
805
+ contributor.person.contact.type:: work
755
806
  ----
756
807
 
757
808
  The following is Metanorma AsciiDoc markup corresponding to the YAML
@@ -856,15 +907,13 @@ contributor.person.affiliation.organization.abbreviation:: IETF
856
907
  contributor.person.affiliation.organization.identifier.type:: uri
857
908
  contributor.person.affiliation.organization.identifier.id:: www.ietf.org
858
909
  contributor.person.affiliation.description:: Affiliation description
859
- contributor.person.contact::
860
- contributor.person.contact.street:: 8 Street St
861
- contributor.person.contact.city:: City
862
- contributor.person.contact.postcode:: 123456
863
- contributor.person.contact.country:: Country
864
- contributor.person.contact.state:: State
865
- contributor.person.contact::
866
- contributor.person.contact.type:: phone
867
- contributor.person.contact.value:: 223322
910
+ contributor.person.address.street:: 8 Street St
911
+ contributor.person.address.city:: City
912
+ contributor.person.address.postcode:: 123456
913
+ contributor.person.address.country:: Country
914
+ contributor.person.address.state:: State
915
+ contributor.person.contact.phone:: 223322
916
+ contributor.person.contact.type:: mobile
868
917
  contributor.role:: author
869
918
  contributor::
870
919
  contributor.organization.name:: IETF