relaton-bib 1.20.7 → 2.0.0.pre.alpha.1

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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/README.adoc +183 -154
  4. data/bin/console +1 -1
  5. data/grammars/basicdoc.rng +1516 -645
  6. data/grammars/biblio-standoc.rng +100 -20
  7. data/grammars/biblio.rng +959 -356
  8. data/grammars/versions.json +10 -10
  9. data/lib/relaton/bib/hash_parser_v1.rb +711 -0
  10. data/lib/relaton/bib/item_data.rb +168 -0
  11. data/lib/relaton/bib/model/address.rb +22 -0
  12. data/lib/relaton/bib/model/affiliation.rb +16 -0
  13. data/lib/relaton/bib/model/bibdata.rb +24 -0
  14. data/lib/relaton/bib/model/bibitem.rb +23 -0
  15. data/lib/relaton/bib/model/contact.rb +18 -0
  16. data/lib/relaton/bib/model/contribution_info.rb +16 -0
  17. data/lib/relaton/bib/model/contributor.rb +71 -0
  18. data/lib/relaton/bib/model/copyright.rb +27 -0
  19. data/lib/relaton/bib/model/date.rb +29 -0
  20. data/lib/relaton/bib/model/depiction.rb +14 -0
  21. data/lib/relaton/bib/model/docidentifier.rb +33 -0
  22. data/lib/relaton/bib/model/doctype.rb +14 -0
  23. data/lib/relaton/bib/model/edition.rb +14 -0
  24. data/lib/relaton/bib/model/editorial_group.rb +14 -0
  25. data/lib/relaton/bib/model/ext.rb +29 -0
  26. data/lib/relaton/bib/model/extent.rb +16 -0
  27. data/lib/relaton/bib/model/full_name_type.rb +64 -0
  28. data/lib/relaton/bib/model/fullname.rb +11 -0
  29. data/lib/relaton/bib/model/ics.rb +14 -0
  30. data/lib/relaton/bib/model/image.rb +28 -0
  31. data/lib/relaton/bib/model/item.rb +129 -0
  32. data/lib/relaton/bib/model/item_base.rb +19 -0
  33. data/lib/relaton/bib/model/keyword.rb +30 -0
  34. data/lib/relaton/bib/model/locality.rb +18 -0
  35. data/lib/relaton/bib/model/locality_stack.rb +14 -0
  36. data/lib/relaton/bib/model/localized_string.rb +57 -0
  37. data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
  38. data/lib/relaton/bib/model/logo.rb +12 -0
  39. data/lib/relaton/bib/model/medium.rb +22 -0
  40. data/lib/relaton/bib/model/note.rb +16 -0
  41. data/lib/relaton/bib/model/organization.rb +13 -0
  42. data/lib/relaton/bib/model/organization_type.rb +42 -0
  43. data/lib/relaton/bib/model/person.rb +36 -0
  44. data/lib/relaton/bib/model/phone.rb +14 -0
  45. data/lib/relaton/bib/model/place.rb +33 -0
  46. data/lib/relaton/bib/model/price.rb +14 -0
  47. data/lib/relaton/bib/model/relation.rb +43 -0
  48. data/lib/relaton/bib/model/series.rb +32 -0
  49. data/lib/relaton/bib/model/size.rb +23 -0
  50. data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
  51. data/lib/relaton/bib/model/status.rb +27 -0
  52. data/lib/relaton/bib/model/structured_identifier.rb +48 -0
  53. data/lib/relaton/bib/model/subdivision.rb +14 -0
  54. data/lib/relaton/bib/model/technical_committee.rb +14 -0
  55. data/lib/relaton/bib/model/title.rb +18 -0
  56. data/lib/relaton/bib/model/uri.rb +18 -0
  57. data/lib/relaton/bib/model/validity.rb +16 -0
  58. data/lib/relaton/bib/model/version.rb +14 -0
  59. data/lib/relaton/bib/model/workgroup.rb +20 -0
  60. data/lib/relaton/bib/parser/rfc_address.rb +60 -0
  61. data/lib/relaton/bib/parser/rfc_contacts.rb +35 -0
  62. data/lib/relaton/bib/parser/rfc_docidentifier.rb +70 -0
  63. data/lib/relaton/bib/parser/rfc_organization.rb +31 -0
  64. data/lib/relaton/bib/parser/rfc_person.rb +42 -0
  65. data/lib/relaton/bib/parser/rfc_reference.rb +143 -0
  66. data/lib/relaton/bib/parser/rfc_referencegroup.rb +45 -0
  67. data/lib/relaton/bib/parser/rfc_shared.rb +23 -0
  68. data/lib/relaton/bib/renderer/bibtex_builder.rb +348 -0
  69. data/lib/relaton/bib/renderer/rfc.rb +297 -0
  70. data/lib/relaton/bib/util.rb +18 -0
  71. data/lib/relaton/bib/version.rb +5 -0
  72. data/lib/{relaton_bib.rb → relaton/bib.rb} +47 -36
  73. data/lib/{relaton_bib → relaton}/bibtex_parser.rb +24 -27
  74. data/lib/{relaton_bib → relaton}/bibxml_parser.rb +43 -46
  75. data/lib/{relaton_bib → relaton}/hit.rb +3 -3
  76. data/lib/{relaton_bib → relaton}/hit_collection.rb +2 -2
  77. data/lib/{relaton_bib → relaton}/workers_pool.rb +1 -1
  78. data/lib/{relaton_bib → relaton}/xml_parser.rb +49 -51
  79. data/relaton-bib.gemspec +8 -8
  80. metadata +95 -74
  81. data/lib/relaton_bib/bib_item_locality.rb +0 -175
  82. data/lib/relaton_bib/biblio_note.rb +0 -72
  83. data/lib/relaton_bib/biblio_version.rb +0 -46
  84. data/lib/relaton_bib/bibliographic_date.rb +0 -119
  85. data/lib/relaton_bib/bibliographic_item.rb +0 -668
  86. data/lib/relaton_bib/bibliographic_size.rb +0 -103
  87. data/lib/relaton_bib/classification.rb +0 -40
  88. data/lib/relaton_bib/config.rb +0 -16
  89. data/lib/relaton_bib/contribution_info.rb +0 -117
  90. data/lib/relaton_bib/contributor.rb +0 -277
  91. data/lib/relaton_bib/copyright_association.rb +0 -79
  92. data/lib/relaton_bib/document_identifier.rb +0 -118
  93. data/lib/relaton_bib/document_relation.rb +0 -95
  94. data/lib/relaton_bib/document_relation_collection.rb +0 -57
  95. data/lib/relaton_bib/document_status.rb +0 -92
  96. data/lib/relaton_bib/document_type.rb +0 -52
  97. data/lib/relaton_bib/edition.rb +0 -55
  98. data/lib/relaton_bib/editorial_group.rb +0 -41
  99. data/lib/relaton_bib/extent.rb +0 -39
  100. data/lib/relaton_bib/forename.rb +0 -65
  101. data/lib/relaton_bib/formatted_ref.rb +0 -17
  102. data/lib/relaton_bib/formatted_string.rb +0 -133
  103. data/lib/relaton_bib/full_name.rb +0 -108
  104. data/lib/relaton_bib/hash_converter.rb +0 -568
  105. data/lib/relaton_bib/ics.rb +0 -42
  106. data/lib/relaton_bib/image.rb +0 -95
  107. data/lib/relaton_bib/localized_string.rb +0 -149
  108. data/lib/relaton_bib/medium.rb +0 -76
  109. data/lib/relaton_bib/organization.rb +0 -165
  110. data/lib/relaton_bib/person.rb +0 -129
  111. data/lib/relaton_bib/place.rb +0 -203
  112. data/lib/relaton_bib/renderer/bibtex_builder.rb +0 -312
  113. data/lib/relaton_bib/renderer/bibxml.rb +0 -296
  114. data/lib/relaton_bib/series.rb +0 -119
  115. data/lib/relaton_bib/structured_identifier.rb +0 -173
  116. data/lib/relaton_bib/technical_committee.rb +0 -34
  117. data/lib/relaton_bib/typed_title_string.rb +0 -191
  118. data/lib/relaton_bib/typed_uri.rb +0 -57
  119. data/lib/relaton_bib/util.rb +0 -16
  120. data/lib/relaton_bib/validity.rb +0 -52
  121. data/lib/relaton_bib/version.rb +0 -3
  122. data/lib/relaton_bib/workgroup.rb +0 -58
  123. /data/lib/{relaton_bib → relaton}/deep_dup.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a7ca942458eaadfc3b1b7c6d9e3b3356c87212fe784dec2b3f23e13bd0d893d
4
- data.tar.gz: ed788c72a1a8e37ec1712e6bd0b4f1f41926f8a13bd4f8445f299344006ff2e4
3
+ metadata.gz: 926f3fc5e7c7087fdb474ef99b675f180a83aa3d6ceb33bae1be4bfe35809af8
4
+ data.tar.gz: 8f9320d9910d88ae20f20883087251a11cd2f192751709574d509cfb79f79918
5
5
  SHA512:
6
- metadata.gz: 520644a6bc2b97c2c4642f0b291f22c15f724357b29e0102fd12008cd6430572e4a428d3fa7ddc04c5b7c04699f04f1a1675732849b49a125e989efbbcf62830
7
- data.tar.gz: cfff6dcb24f1915cc1c0158e993c48b1d9354a944d6982847faac5925c84f3b90d640c50b0b9acd71ba556c7e8267fa52c2e3ecf0291c35dee8d866cfcc6ee24
6
+ metadata.gz: d4276b3adfde5ba25a78e1de55c5ed6fea48358076ed5c3f18b6e1f4b5afb517b144145429ffe05127ba1fdf6670c91c0b8b4a8f5ebecc739a7f89edbcb8b339
7
+ data.tar.gz: a67e4932c74fcd648d2b2c4bebfacf8534684d0525909a9fa4c96626890b475593264faa3bc864d6a1a5c2786c99d26a5f71e7b0dd49f404530f5763d154832e
data/.rubocop.yml CHANGED
@@ -7,6 +7,6 @@ require: rubocop-rails
7
7
  inherit_from:
8
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
9
  AllCops:
10
- TargetRubyVersion: 2.7
10
+ TargetRubyVersion: 3.1
11
11
  Rails:
12
12
  Enabled: false
data/README.adoc CHANGED
@@ -1,4 +1,4 @@
1
- = RelatonBib
1
+ = Relaton::Bib
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-bib.svg["Gem Version", link="https://rubygems.org/gems/relaton-bib"]
4
4
  image:https://github.com/relaton/relaton-bib/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bib/actions?workflow=rake"]
@@ -6,7 +6,7 @@ image:https://codeclimate.com/github/relaton/relaton-bib/badges/gpa.svg["Code Cl
6
6
  image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bib.svg["Pull Requests", link="https://github.com/relaton/relaton-bib/pulls"]
7
7
  image:https://img.shields.io/github/commits-since/relaton/relaton-bib/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bib/releases"]
8
8
 
9
- RelatonBib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
9
+ Relaton::Bib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
10
10
 
11
11
  == Installation
12
12
 
@@ -27,78 +27,93 @@ Or install it yourself as:
27
27
 
28
28
  == Usage
29
29
 
30
- === Create bibliographic item
31
-
32
30
  [source,ruby]
33
31
  ----
34
- require 'relaton_bib'
32
+ require 'relaton/bib'
35
33
  => true
34
+ ----
36
35
 
37
- hash = YAML.load_file "spec/examples/bib_item.yml"
38
- => {"id"=>"ISOTC211",
39
- "fetched"=>"2022-05-02",
40
- "title"=>["Geographic information", {"content"=>"Information géographique", "language"=>"fr", "script"=>"Latn"}],
41
- ...
36
+ === Create bibliographic item
42
37
 
43
- item = RelatonBib::BibliographicItem.from_hash(hash)
44
- => #<RelatonBib::BibliographicItem:0x00007f962f030710
45
- @abstract=
46
- [#<RelatonBib::FormattedString:0x00007f962f02acc0
47
- ...
38
+ [source,ruby]
39
+ ----
40
+ yaml = File.read 'spec/fixtures/item.yaml'
41
+ => "id: ISO1231994\ntype: standard\nschema_version: 1.0.0\nfetched: \"2022-05-02\"\nformattedref: ISO 123:1994\ntitle..."
42
+
43
+ item = Relaton::Bib::Item.from_yaml yaml
44
+ => #<Relaton::Bib::ItemData:0x000000012838bfc0 ...
48
45
  ----
49
46
 
50
- === BibliographicItem Typed Title Strings
47
+ === Title
51
48
 
52
49
  [source,ruby]
53
50
  ----
54
51
  item.title
55
- => #<RelatonBib::TypedTitleStringCollection:0x00007fea821ec6b0
56
- @array=
57
- [#<RelatonBib::TypedTitleString:0x00007fea821ecb60
58
- @title=#<RelatonBib::FormattedString:0x00007fea821eca70 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
59
- @type="title-main">,
60
- #<RelatonBib::TypedTitleString:0x00007fea821ec8b8
61
- @title=#<RelatonBib::FormattedString:0x00007fea821ec818 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
62
- @type="main">,
63
- #<RelatonBib::TypedTitleString:0x00007fea821ec610
64
- @title=
65
- #<RelatonBib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
66
- @type=nil>]>
67
-
68
- item.title lang: "fr"
69
- => #<RelatonBib::TypedTitleStringCollection:0x00007fea8222d908
70
- @array=
71
- [#<RelatonBib::TypedTitleString:0x00007fea821ec610
72
- @title=#<RelatonBib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
73
- @type=nil>]>
74
- ----
75
-
76
- === BibliographicItem Formatted Strings
52
+ => [#<Relaton::Bib::Title:0x00000001270a6810
53
+ @content="Geographic information -- Metadata",
54
+ @format=nil,
55
+ @language="en",
56
+ @locale="en-US",
57
+ @script="Latn",
58
+ @type=nil>,
59
+ #<Relaton::Bib::Title:0x00000001270a5cd0
60
+ @content="Information géographique -- Métadonnées",
61
+ @format=nil,
62
+ @language="fr",
63
+ @locale="fr-FR",
64
+ @script="Latn",
65
+ @type=nil>]
66
+
67
+ item.title "fr"
68
+ => [#<Relaton::Bib::Title:0x00000001270a5cd0
69
+ @content="Information géographique -- Métadonnées",
70
+ @format=nil,
71
+ @language="fr",
72
+ @locale="fr-FR",
73
+ @script="Latn",
74
+ @type=nil>]
75
+ ----
76
+
77
+ === Abstract
77
78
 
78
79
  [source,ruby]
79
80
  ----
80
81
  item.abstract
81
- => [#<RelatonBib::FormattedString:0x00007fea82236828
82
- @content="<p>ISO 19115-1:2014 defines the schema required for ...</p>",
83
- @format="text/html",
84
- @language=["en"],
85
- @script=["Latn"]>,
86
- #<RelatonBib::FormattedString:0x00007fea82236670
87
- @content="L'ISO 19115-1:2014 définit le schéma requis pour ...",
88
- @format="text/plain",
89
- @language=["fr"],
90
- @script=["Latn"]>]
82
+ => [#<Relaton::Bib::LocalizedMarkedUpString:0x0000000126c05748
83
+ @content="This is an abstract. <em>This is emphasized</em>",
84
+ @language="en",
85
+ @locale="en-US",
86
+ @script="Latn">]
91
87
 
92
- item.abstract(lang: "en").to_s
93
- => "<p>ISO 19115-1:2014 defines the schema required for ...</p>"
88
+ item.abstract("en")
89
+ => [#<Relaton::Bib::LocalizedMarkedUpString:0x0000000126c05748
90
+ @content="This is an abstract. <em>This is emphasized</em>",
91
+ @language="en",
92
+ @locale="en-US",
93
+ @script="Latn">]
94
94
  ----
95
95
 
96
- === BibliographicItem references
96
+ === Document identifier
97
97
 
98
98
  [source,ruby]
99
99
  ----
100
- item.shortref item.docidentifier.first
101
- => "ISOTC211:2014"
100
+ item.docidentifier
101
+ => [#<Relaton::Bib::Docidentifier:0x00000001270a4b00
102
+ @content="ISO 123:1994",
103
+ @language="en",
104
+ @locale="en-US",
105
+ @primary=true,
106
+ @scope="global",
107
+ @script="Latn",
108
+ @type="ISO">,
109
+ #<Relaton::Bib::Docidentifier:0x00000001270a46a0
110
+ @content="10.1007/978-3-319-99155-2_1",
111
+ @language=nil,
112
+ @locale=nil,
113
+ @primary=nil,
114
+ @scope=nil,
115
+ @script=nil,
116
+ @type="DOI">]
102
117
  ----
103
118
 
104
119
  === XML serialization
@@ -106,11 +121,13 @@ item.shortref item.docidentifier.first
106
121
  [source,ruby]
107
122
  ----
108
123
  item.to_xml
109
- => "<bibitem id="ISOTC211" type="standard" schema-version="v1.2.1">
124
+ => "<bibitem id="ISO1231994" type="standard" schema-version="1.0.0">
110
125
  <fetched>2022-05-02</fetched>
111
- <title type="title-main" format="text/plain">Geographic information</title>
112
- <title type="main" format="text/plain">Geographic information</title>
113
- <title format="text/plain" language="fr" script="Latn">Information géographique</title>
126
+ <formattedref>ISO 123:1994</formattedref>
127
+ <title language="en" locale="en-US" script="Latn">Geographic information -- Metadata</title>
128
+ <title language="fr" locale="fr-FR" script="Latn">Information géographique -- Métadonnées</title>
129
+ <uri type="src">https://www.iso.org/standard/22722.html</uri>
130
+ <uri type="doi">10.1007/978-3-319-99155-2_1</uri>
114
131
  ...
115
132
  </bibitem>"
116
133
  ----
@@ -120,116 +137,88 @@ The default root element is `bibitem`. With argument `bibdata: true` the XML wra
120
137
  [source,ruby]
121
138
  ----
122
139
  item.to_xml bibdata: true
123
- => "<bibdata type="standard" schema-version="v1.2.1">
140
+ => "<bibdata type="standard" schema-version="1.0.0">
124
141
  <fetched>2022-05-02</fetched>
125
- <title type="title-main" format="text/plain">Geographic information</title>
142
+ <formattedref>ISO 123:1994</formattedref>
143
+ <title language="en" locale="en-US" script="Latn">Geographic information -- Metadata</title>
126
144
  ...
127
- <ext>
128
- <doctype>document</doctype>
129
- <subdoctype>subdocument</subdoctype>
130
- ...
131
- </ext>
145
+ <ext schema-version="1.0.0">
146
+ <doctype abbreviation="std">Standard</doctype>
147
+ <subdoctype>Technical Report</subdoctype>
148
+ ...
149
+ </ext>
132
150
  </bibdata>"
133
151
  ----
134
152
 
135
- ==== Date format
136
-
137
- By default date elements are formatted as a year (yyyy). Option `:date_format` allows to output date elements in `:short` (yyyy-mm) and `:full` (yyyy-mm-dd) additional formats.
153
+ ==== Adding notes
138
154
 
139
155
  [source,ruby]
140
156
  ----
141
- item.to_xml date_format: :short
142
- => "<bibitem id="ISOTC211" type="standard" schema-version="v1.2.1">
143
- <fetched>2022-05-02</fetched>
144
- <title type="title-main" format="text/plain">Geographic information</title>
157
+ item.to_xml note: [{ content: "Note", type: "note" }]
158
+ => "<bibitem id="ISO1231994" type="standard" schema-version="1.0.0">
145
159
  ...
146
- <date type="issued">
147
- <on>2014-01</on>
148
- </date>
149
- <date type="published">
150
- <on>2014-04</on>
151
- </date>
152
- <date type="accessed">
153
- <on>2015-05</on>
154
- </date>
155
- ...
156
- </bibitem>"
157
-
158
- item.to_xml date_format: :full
159
- => "<bibitem id="ISOTC211" type="standard" schema-version="v1.2.1">
160
- ...
161
- <date type="issued">
162
- <on>2014-01-01</on>
163
- </date>
164
- <date type="published">
165
- <on>2014-04-01</on>
166
- </date>
167
- <date type="accessed">
168
- <on>2015-05-20</on>
169
- </date>
160
+ <note type="note">Note</note>
170
161
  ...
171
162
  </bibitem>"
172
163
  ----
173
164
 
174
- ==== Adding notes
165
+ === Create bibliographic item form YAML
175
166
 
176
167
  [source,ruby]
177
168
  ----
178
- item.to_xml note: [{ text: "Note", type: "note" }]
179
- => "<bibitem id="ISOTC211" type="standard" schema-version="v1.2.1">
180
- ...
181
- <note format="text/plain" type="note">Note</note>
182
- ...
183
- </bibitem>"
169
+ yaml = File.read 'spec/fixtures/item.yaml'
170
+ => "id: ISO1231994\ntype: standard\nschema_version: 1.0.0\nfetched: \"2022-05-02\"\nformattedref: ISO 123:1994\ntitle..."
171
+
172
+ Relaton::Bib::Item.from_yaml yaml
173
+ => #<Relaton::Bib::ItemData:0x000000011dc9e118 ...
184
174
  ----
185
175
 
186
- === Create bibliographic item form YAML
176
+ === Create bibliographic item from RFC XML
187
177
 
188
178
  [source,ruby]
189
179
  ----
190
- hash = YAML.load_file 'spec/examples/bib_item.yml'
191
- => {"id"=>"ISOTC211"
192
- ...
180
+ xml = File.read 'spec/fixtures/rfc.xml'
181
+ => "<reference anchor=\"RFC1\" target=\"10.17487/RFC0001\">\n <front>\n <title>Title RFC1</title>\n <seriesInf..."
193
182
 
194
- RelatonBib::BibliographicItem.from_hash hash
195
- => #<RelatonBib::BibliographicItem:0x007ff1524f8c88
196
- ...
183
+ Relaton::Bib::Parser::RfcReference.from_xml xml
184
+ => #<Relaton::Bib::ItemData:0x000000011dc9fc98 ...
197
185
  ----
198
186
 
199
- === Create bibliographic item from BibXML
200
-
187
+ === Create bibliographic item from XML
201
188
  [source,ruby]
202
189
  ----
203
- bibxml = File.read "spec/examples/rfc.xml"
204
- => <reference anchor=...
190
+ xml = File.read 'spec/fixtures/bibitem.xml'
191
+ => "<bibitem id=\"ISO1231994\" type=\"standard\" schema-version=\"1.0.0\">\n <fetched>2022-05-02</fetched>\n <forma..."
205
192
 
206
- RelatonBib::BibXMLParser.parse bibxml
207
- => #<RelatonBib::BibliographicItem:0x00007f9d0c75b268
208
- ...
193
+ item = Relaton::Bib::Bibitem.from_xml xml
194
+ => #<Relaton::Bib::ItemData:0x000000011d4b7580 ...
195
+
196
+ xml = File.read 'spec/fixtures/bibdata.xml'
197
+ item = Relaton::Bib::Bibdata.from_xml xml
198
+ => #<Relaton::Bib::ItemData:0x000000011d4daa08 ...
209
199
  ----
210
200
 
211
- === Export bibliographic item to Hash
201
+ === Create bibliographic item from BibTeX (@TODO: add support for BibTeX)
212
202
 
213
203
  [source,ruby]
214
204
  ----
215
- item.to_hash
216
- => {"schema-version"=>"v1.2.1",
217
- "id"=>"ISOTC211",
218
- "title"=>
219
- [{"content"=>"Geographic information", "format"=>"text/plain", "type"=>"title-main"},
220
- {"content"=>"Geographic information", "format"=>"text/plain", "type"=>"main"},
221
- {"content"=>"Information géographique", "language"=>["fr"], "script"=>["Latn"], "format"=>"text/plain"}],
222
- ...
205
+ Relaton::Bib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
206
+ => {"ISOTC211"=>
207
+ #<Relaton::Bib::Item:0x007fedee0a2ab0
208
+ ...
223
209
  ----
224
210
 
225
- === Create bibliographic item from BibTeX
211
+ === Export bibliographic item to YAML
226
212
 
227
213
  [source,ruby]
228
214
  ----
229
- RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
230
- => {"ISOTC211"=>
231
- #<RelatonBib::BibliographicItem:0x007fedee0a2ab0
232
- ...
215
+ item.to_yaml
216
+ ---
217
+ type: standard
218
+ schema_version: 1.0.0
219
+ fetched: '2022-05-02'
220
+ formattedref: ISO 123:1994
221
+ ...
233
222
  ----
234
223
 
235
224
  === Export bibliographic item to BibTeX
@@ -237,14 +226,24 @@ RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
237
226
  [source,ruby]
238
227
  ----
239
228
  item.to_bibtex
240
- => @misc{ISOTC211,
241
- title = {Geographic information},
242
- edition = {Edition 1},
243
- author = {Bierman, A. and Bierman, Arnold and Bierman, Arnold B},
244
- ...
245
- ----
246
-
247
- === Export bibliographic item to Citeproc
229
+ @misc{doe1994a,
230
+ title = {Geographic information -- Metadata},
231
+ author = {Doe, John},
232
+ edition = {First edition},
233
+ publisher = {International Organization for Standardization},
234
+ year = {1994},
235
+ month = {jan},
236
+ address = {Geneva, Switzerland, Geneva, Geneva},
237
+ pages = {1--10},
238
+ keywords = {information},
239
+ timestamp = {2022-05-02},
240
+ url = {https://www.iso.org/standard/22722.html},
241
+ doi = {10.1007/978-3-319-99155-2_1},
242
+ month_numeric = {1}
243
+ }
244
+ ----
245
+
246
+ === Export bibliographic item to Citeproc (@TODO: add support for Citeproc)
248
247
 
249
248
  [source,ruby]
250
249
  ----
@@ -257,7 +256,7 @@ item.to_citeproc
257
256
  ...
258
257
  ----
259
258
 
260
- === Exporting bibliographic item to AsciiBib
259
+ === Exporting bibliographic item to AsciiBib (@TODO: add support for AsciiBib)
261
260
 
262
261
  [source,ruby]
263
262
  ----
@@ -273,24 +272,54 @@ item.to_asciibib
273
272
  ...
274
273
  ----
275
274
 
276
- === Export bibliographic item to BibXML (RFC)
275
+ === Export bibliographic item to RFC XML
277
276
 
278
277
  [source,ruby]
279
278
  ----
280
- item.to_bibxml
281
- => "<reference anchor="ISO.TC.211" target="https://www.iso.org/standard/53798.html">
282
- <front>
283
- <title>Geographic information</title>
284
- <author>
285
- <organization abbrev="ISO">International Organization for Standardization</organization>
286
- </author>
287
- ..
288
- </front>
289
- <seriesInfo name="DOI" value="10.17487/rfc1149"/>
290
- <seriesInfo name="Internet-Draft" value="draft-ietf-somewg-someprotocol-07"/>
291
- <seriesInfo name="ISO/IEC FDIS 10118-3" value="serie1234"/>
292
- ...
293
- </reference>"
279
+ item.to_rfcxml
280
+ <reference anchor="ISO 123:1994" target="https://www.iso.org/standard/22722.html">
281
+ <front>
282
+ <title>Geographic information -- Metadata</title>
283
+ <seriesInfo name="DOI" value="10.1007/978-3-319-99155-2_1"/>
284
+ <seriesInfo name="ISO 123" value="1"/>
285
+ <author initials="J.D." surname="Doe" fullname="Prof. John Doe PhD">
286
+ <organization>International Organization for Standardization</organization>
287
+ <address>
288
+ <postal>
289
+ <street>1, rue de Varembé</street>
290
+ <city>Geneva</city>
291
+ <code>1211</code>
292
+ <country>Switzerland</country>
293
+ <postalLine>1, rue de Varembé,&lt;br/&gt;Geneva, Switzerland, 1211</postalLine>
294
+ </postal>
295
+ <phone>+41 22 749 01 11</phone>
296
+ <email>jdoe@email.org</email>
297
+ <uri>https://orcid.org/0000-0002-1825-0097</uri>
298
+ </address>
299
+ </author>
300
+ <author>
301
+ <organization abbrev="ISO">International Organization for Standardization</organization>
302
+ <address>
303
+ <postal>
304
+ <street>1, rue de Varembé</street>
305
+ <city>Geneva</city>
306
+ <code>1211</code>
307
+ <country>Switzerland</country>
308
+ <postalLine>1, rue de Varembé,&lt;br/&gt;Geneva, Switzerland, 1211</postalLine>
309
+ </postal>
310
+ <phone>+41 22 749 01 11</phone>
311
+ <email>office@iso.org</email>
312
+ <uri>https://www.iso.org</uri>
313
+ </address>
314
+ </author>
315
+ <date day="01" month="January" year="1994"></date>
316
+ <workgroup>Geographic information</workgroup>
317
+ <keyword>information</keyword>
318
+ <abstract>
319
+ <t>This is an abstract. &lt;em&gt;This is emphasized&lt;/em&gt;</t>
320
+ </abstract>
321
+ </front>
322
+ </reference>
294
323
  ----
295
324
 
296
325
  === Logging
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "relaton_bib"
4
+ require "relaton/bib"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.