relaton-bsi 1.20.1 → 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/README.adoc +33 -38
- data/grammars/basicdoc.rng +1559 -671
- data/grammars/biblio-standoc.rng +107 -46
- data/grammars/biblio.rng +1010 -375
- data/grammars/relaton-bsi.rng +8 -103
- data/lib/{relaton_bsi/bsi_bibliography.rb → relaton/bsi/bibliography.rb} +10 -13
- data/lib/relaton/bsi/hit.rb +14 -0
- data/lib/{relaton_bsi → relaton/bsi}/hit_collection.rb +36 -17
- data/lib/relaton/bsi/item_data.rb +49 -0
- data/lib/relaton/bsi/model/bibdata.rb +7 -0
- data/lib/relaton/bsi/model/bibitem.rb +7 -0
- data/lib/relaton/bsi/model/docidentifier.rb +9 -0
- data/lib/relaton/bsi/model/doctype.rb +14 -0
- data/lib/relaton/bsi/model/ext.rb +29 -0
- data/lib/relaton/bsi/model/item.rb +17 -0
- data/lib/relaton/bsi/model/item_base.rb +19 -0
- data/lib/relaton/bsi/model/relation.rb +9 -0
- data/lib/relaton/bsi/processor.rb +42 -0
- data/lib/{relaton_bsi/scrapper.rb → relaton/bsi/scraper.rb} +111 -73
- data/lib/relaton/bsi/util.rb +8 -0
- data/lib/relaton/bsi/version.rb +7 -0
- data/lib/relaton/bsi.rb +25 -0
- data/relaton_bsi.gemspec +7 -6
- metadata +42 -26
- data/lib/relaton_bsi/bsi_bibliographic_item.rb +0 -51
- data/lib/relaton_bsi/document_type.rb +0 -21
- data/lib/relaton_bsi/hash_converter.rb +0 -21
- data/lib/relaton_bsi/hit.rb +0 -14
- data/lib/relaton_bsi/processor.rb +0 -38
- data/lib/relaton_bsi/util.rb +0 -6
- data/lib/relaton_bsi/version.rb +0 -5
- data/lib/relaton_bsi/xml_parser.rb +0 -30
- data/lib/relaton_bsi.rb +0 -24
- /data/lib/{relaton_bsi → relaton/bsi}/schema.json +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c15513bebf78f48b3913c1dcce3aa13c47b4cec303c27e994039a58ca7d16506
|
|
4
|
+
data.tar.gz: 4359596af621593b0066db9627f211d853f89be48e38706e901b789122032ced
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '077893dcf0d85d7cceb96de2e162f652b6a306b8072ce923c83ec7d4cb67b8f87748f15ecba6a05152758279ffd25a155d0109a7a150f5e529347952b9209091'
|
|
7
|
+
data.tar.gz: ad14896e08710a685cc3499e5940b89a89ddf1fa9d470661704190235249e7f7e1c0cdfdd0e87c9a71bd01dd1b0da0f492b1abb245b755029c3f32a66cef388b
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
=
|
|
1
|
+
= Relaton::Bsi retrieve BSI Standards for bibliographic use using the BibliographicItem model
|
|
2
2
|
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-bsi.svg["Gem Version", link="https://rubygems.org/gems/relaton-bsi"]
|
|
4
4
|
image:https://github.com/relaton/relaton-bsi/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bsi/actions?workflow=rake"]
|
|
@@ -6,7 +6,7 @@ image:https://codeclimate.com/github/relaton/relaton-bsi/badges/gpa.svg["Code Cl
|
|
|
6
6
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bsi.svg["Pull Requests", link="https://github.com/relaton/relaton-bsi/pulls"]
|
|
7
7
|
image:https://img.shields.io/github/commits-since/relaton/relaton-bsi/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bsi/releases"]
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Relaton::Bsi is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
|
|
10
10
|
|
|
11
11
|
== Installation
|
|
12
12
|
|
|
@@ -31,14 +31,14 @@ Or install it yourself as:
|
|
|
31
31
|
|
|
32
32
|
[source,ruby]
|
|
33
33
|
----
|
|
34
|
-
require '
|
|
34
|
+
require 'relaton/bsi'
|
|
35
35
|
=> true
|
|
36
36
|
|
|
37
|
-
hit_collection =
|
|
38
|
-
=> <
|
|
37
|
+
hit_collection = Relaton::Bsi::Bibliography.search("BS EN ISO 8848")
|
|
38
|
+
=> <Relaton::Bsi::HitCollection:0x007fead49fe1f8 @ref=BS EN ISO 8848 @fetched=false>
|
|
39
39
|
|
|
40
|
-
item = hit_collection[1].
|
|
41
|
-
=> #<
|
|
40
|
+
item = hit_collection[1].item
|
|
41
|
+
=> #<Relaton::Bsi::ItemData:0x000000012ac6c9a8
|
|
42
42
|
...
|
|
43
43
|
----
|
|
44
44
|
|
|
@@ -46,10 +46,10 @@ item = hit_collection[1].fetch
|
|
|
46
46
|
[source,ruby]
|
|
47
47
|
----
|
|
48
48
|
item.to_xml
|
|
49
|
-
=> "<bibitem id="
|
|
50
|
-
<fetched>
|
|
51
|
-
<title
|
|
52
|
-
<title
|
|
49
|
+
=> "<bibitem id="BSENISO88482021" type="standard" schema-version="v1.4.1">
|
|
50
|
+
<fetched>2025-10-18</fetched>
|
|
51
|
+
<title language="en" script="Latn" type="title-main">Small craft. Remote mechanical steering systems</title>
|
|
52
|
+
<title language="en" script="Latn" type="main">Small craft. Remote mechanical steering systems</title>
|
|
53
53
|
<uri type="src">https://shop.bsigroup.com/products/small-craft-remote-mechanical-steering-systems</uri>
|
|
54
54
|
<docidentifier type="BSI" primary="true">BS EN ISO 8848:2021</docidentifier>
|
|
55
55
|
...
|
|
@@ -62,23 +62,22 @@ Each BSI document has `src` type link.
|
|
|
62
62
|
|
|
63
63
|
[source,ruby]
|
|
64
64
|
----
|
|
65
|
-
item.
|
|
66
|
-
=>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@type="src">]
|
|
65
|
+
item.source[0].type
|
|
66
|
+
=> "src"
|
|
67
|
+
|
|
68
|
+
item.source[0].content
|
|
69
|
+
=> "https://shop.bsigroup.com/products/small-craft-remote-mechanical-steering-systems"
|
|
71
70
|
----
|
|
72
71
|
|
|
73
72
|
With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
|
|
74
73
|
[source,ruby]
|
|
75
74
|
----
|
|
76
75
|
item.to_xml bibdata: true
|
|
77
|
-
=> "<bibdata type="standard" schema-version="v1.
|
|
78
|
-
<fetched>
|
|
79
|
-
<title
|
|
76
|
+
=> "<bibdata type="standard" schema-version="v1.4.1">
|
|
77
|
+
<fetched>2025-10-18</fetched>
|
|
78
|
+
<title language="en" script="Latn" type="title-main">Small craft. Remote mechanical steering systems</title>
|
|
80
79
|
...
|
|
81
|
-
<ext schema-version="v1.0.
|
|
80
|
+
<ext schema-version="v1.0.3">
|
|
82
81
|
<doctype>standard</doctype>
|
|
83
82
|
...
|
|
84
83
|
</ext>
|
|
@@ -88,42 +87,38 @@ item.to_xml bibdata: true
|
|
|
88
87
|
=== Get standard by code and year
|
|
89
88
|
[source,ruby]
|
|
90
89
|
----
|
|
91
|
-
|
|
92
|
-
[relaton-bsi] (BS EN ISO 8848:2021) Fetching from shop.bsigroup.com ...
|
|
93
|
-
[relaton-bsi] (BS EN ISO 8848:2021) Found: `BS EN ISO 8848:2021`
|
|
94
|
-
=> #<
|
|
90
|
+
Relaton::Bsi::Bibliography.get "BS EN ISO 8848:2021"
|
|
91
|
+
[relaton-bsi] INFO: (BS EN ISO 8848:2021) Fetching from shop.bsigroup.com ...
|
|
92
|
+
[relaton-bsi] INFO: (BS EN ISO 8848:2021) Found: `BS EN ISO 8848:2021`
|
|
93
|
+
=> #<Relaton::Bsi::ItemData:0x000000011f19b688
|
|
95
94
|
...
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
[relaton-bsi] (BS EN ISO 8848) Fetching from shop.bsigroup.com ...
|
|
99
|
-
[relaton-bsi] (BS EN ISO 8848) Found: `BS EN ISO 8848:2021`
|
|
100
|
-
=> #<
|
|
96
|
+
Relaton::Bsi::Bibliography.get "BS EN ISO 8848", "2021"
|
|
97
|
+
[relaton-bsi] INFO: (BS EN ISO 8848) Fetching from shop.bsigroup.com ...
|
|
98
|
+
[relaton-bsi] INFO: (BS EN ISO 8848) Found: `BS EN ISO 8848:2021`
|
|
99
|
+
=> #<Relaton::Bsi::ItemData:0x000000011f1bdc10
|
|
101
100
|
...
|
|
102
101
|
----
|
|
103
102
|
|
|
104
103
|
=== Create bibliographic item form YAML
|
|
105
104
|
[source,ruby]
|
|
106
105
|
----
|
|
107
|
-
|
|
108
|
-
=>
|
|
109
|
-
...
|
|
110
|
-
|
|
111
|
-
RelatonBsi::BsiBibliographicItem.from_hash hash
|
|
112
|
-
=> #<RelatonBsi::BsiBibliographicItem:0x007feaf5109630
|
|
106
|
+
Relaton::Bsi::Item.from_yaml File.read("spec/fixtures/item.yaml", encoding: "UTF-8")
|
|
107
|
+
=> #<Relaton::Bsi::ItemData:0x0000000104dd0dd8
|
|
113
108
|
...
|
|
114
109
|
----
|
|
115
110
|
|
|
116
111
|
=== Create bibliographic item from XML
|
|
117
112
|
[source,ruby]
|
|
118
113
|
----
|
|
119
|
-
|
|
120
|
-
=> #<
|
|
114
|
+
Relaton::Bsi::Item.from_xml File.read("spec/fixtures/bibdata.xml", encoding: "UTF-8")
|
|
115
|
+
=> #<Relaton::Bsi::ItemData:0x0000000104178c20
|
|
121
116
|
...
|
|
122
117
|
----
|
|
123
118
|
|
|
124
119
|
=== Logging
|
|
125
120
|
|
|
126
|
-
|
|
121
|
+
Relaton::Bsi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
|
|
127
122
|
|
|
128
123
|
== Development
|
|
129
124
|
|