relaton-ecma 1.16.1 → 1.17.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 +28 -17
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_ecma/data_parser.rb +9 -3
- data/lib/relaton_ecma/ecma_bibliography.rb +3 -4
- data/lib/relaton_ecma/hash_converter.rb +8 -7
- data/lib/relaton_ecma/version.rb +1 -1
- data/relaton_ecma.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 638cd46fbc98517ba0a0668de0c0a6b3a9d7cd5a23a558cda74bd6d44a71c780
|
4
|
+
data.tar.gz: 449c085cd3ad3871fde55d371d43fd763438a731aaa588b1752df4d8da9d7350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ec74af039dcdd88dd0f9e23a204f8527356c85afd2f7f4a3a9d083073a991c421b27458cae7094decda5629a7f68aacf6562c7a000a919c53b73b28928aa55
|
7
|
+
data.tar.gz: cdf2165763797f45889e6183571b8ff7a9f572759ac1eba68a7063b6f5a9e529524a508c9ce44ba6b5db496966e7910728150c7487c0f63aaf2fda995ad730c0
|
data/README.adoc
CHANGED
@@ -29,6 +29,20 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
== Usage
|
31
31
|
|
32
|
+
=== Configuration
|
33
|
+
|
34
|
+
Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonEcma.configure` block.
|
35
|
+
|
36
|
+
[source,ruby]
|
37
|
+
----
|
38
|
+
require 'relaton_ecma'
|
39
|
+
=> true
|
40
|
+
|
41
|
+
RelatonEcma.configure do |config|
|
42
|
+
config.logger.level = Logger::DEBUG
|
43
|
+
end
|
44
|
+
----
|
45
|
+
|
32
46
|
=== Fetch documents
|
33
47
|
|
34
48
|
Documents can be fetched by reference. The structure of the reference depends on the type of the document. There are three types of documents:
|
@@ -45,27 +59,24 @@ ECMA mementos have the following reference structure: `ECMA MEM/{YEAR}`. Where:
|
|
45
59
|
|
46
60
|
[source,ruby]
|
47
61
|
----
|
48
|
-
require 'relaton_ecma'
|
49
|
-
=> true
|
50
|
-
|
51
62
|
# fetch ECMA standard
|
52
63
|
item = RelatonEcma::EcmaBibliography.get 'ECMA-6'
|
53
|
-
[relaton-ecma] (
|
54
|
-
[relaton-ecma] (
|
64
|
+
[relaton-ecma] (ECMA-6) Fetching from Relaton repository ...
|
65
|
+
[relaton-ecma] (ECMA-6) Found: `ECMA-6`
|
55
66
|
#<RelatonEcma::BibliographicItem:0x00007fc645b11c10
|
56
67
|
...
|
57
68
|
|
58
69
|
# fetch ECMA standard with edition and volume
|
59
70
|
RelatonEcma::EcmaBibliography.get "ECMA-269 ed3 vol2"
|
60
|
-
[relaton-ecma] (
|
61
|
-
[relaton-ecma] (
|
71
|
+
[relaton-ecma] (ECMA-269 ed3 vol2) Fetching from Relaton repository ...
|
72
|
+
[relaton-ecma] (ECMA-269 ed3 vol2) Found: `ECMA-269`
|
62
73
|
=> #<RelatonEcma::BibliographicItem:0x0000000106ac8210
|
63
74
|
...
|
64
75
|
|
65
76
|
# fetch the last edition of ECMA standard
|
66
77
|
bib = RelatonEcma::EcmaBibliography.get "ECMA-269"
|
67
|
-
[relaton-ecma] (
|
68
|
-
[relaton-ecma] (
|
78
|
+
[relaton-ecma] (ECMA-269) Fetching from Relaton repository ...
|
79
|
+
[relaton-ecma] (ECMA-269) Found: `ECMA-269`
|
69
80
|
=> #<RelatonEcma::BibliographicItem:0x000000010a408480
|
70
81
|
...
|
71
82
|
|
@@ -74,8 +85,8 @@ bib.edition.content
|
|
74
85
|
|
75
86
|
# fetch the first volume of ECMA standard
|
76
87
|
bib = RelatonEcma::EcmaBibliography.get "ECMA-269 ed3"
|
77
|
-
[relaton-ecma] (
|
78
|
-
[relaton-ecma] (
|
88
|
+
[relaton-ecma] (ECMA-269 ed3) Fetching from Relaton repository ...
|
89
|
+
[relaton-ecma] (ECMA-269 ed3) Found: `ECMA-269`
|
79
90
|
=> #<RelatonEcma::BibliographicItem:0x000000010a3ed0e0
|
80
91
|
...
|
81
92
|
|
@@ -84,22 +95,22 @@ bib.extent.first.reference_from
|
|
84
95
|
|
85
96
|
# fetch ECMA technical report
|
86
97
|
RelatonEcma::EcmaBibliography.get 'ECMA TR/18'
|
87
|
-
[relaton-ecma] (
|
88
|
-
[relaton-ecma] (
|
98
|
+
[relaton-ecma] (ECMA TR/18) Fetching from Relaton repository ...
|
99
|
+
[relaton-ecma] (ECMA TR/18) Found: `ECMA TR/18`
|
89
100
|
=> #<RelatonEcma::BibliographicItem:0x00007fc645c00cc0
|
90
101
|
...
|
91
102
|
|
92
103
|
# fetch ECMA memento
|
93
104
|
RelatonEcma::EcmaBibliography.get "ECMA MEM/2021"
|
94
|
-
[relaton-ecma] (
|
95
|
-
[relaton-ecma] (
|
105
|
+
[relaton-ecma] (ECMA MEM/2021) Fetching from Relaton repository ...
|
106
|
+
[relaton-ecma] (ECMA MEM/2021) Found: `ECMA MEM/2021`
|
96
107
|
=> #<RelatonEcma::BibliographicItem:0x00007fc665b2f060
|
97
108
|
...
|
98
109
|
|
99
110
|
# Return nil if a document doesn't exist.
|
100
111
|
RelatonEcma::EcmaBibliography.get '1111'
|
101
|
-
[relaton-ecma] (
|
102
|
-
[relaton-ecma]
|
112
|
+
[relaton-ecma] (1111) Fetching from Relaton repository ...
|
113
|
+
[relaton-ecma] (1111) Not found.
|
103
114
|
=> nil
|
104
115
|
----
|
105
116
|
|
data/grammars/basicdoc.rng
CHANGED
@@ -346,6 +346,8 @@
|
|
346
346
|
<ref name="keyword"/>
|
347
347
|
<ref name="xref"/>
|
348
348
|
<ref name="hyperlink"/>
|
349
|
+
<ref name="index"/>
|
350
|
+
<ref name="index-xref"/>
|
349
351
|
</choice>
|
350
352
|
</oneOrMore>
|
351
353
|
</element>
|
@@ -623,6 +625,8 @@
|
|
623
625
|
<ref name="eref"/>
|
624
626
|
<ref name="xref"/>
|
625
627
|
<ref name="hyperlink"/>
|
628
|
+
<ref name="index"/>
|
629
|
+
<ref name="index-xref"/>
|
626
630
|
</choice>
|
627
631
|
</zeroOrMore>
|
628
632
|
</element>
|
@@ -636,6 +640,8 @@
|
|
636
640
|
<ref name="eref"/>
|
637
641
|
<ref name="xref"/>
|
638
642
|
<ref name="hyperlink"/>
|
643
|
+
<ref name="index"/>
|
644
|
+
<ref name="index-xref"/>
|
639
645
|
</choice>
|
640
646
|
</zeroOrMore>
|
641
647
|
</element>
|
@@ -648,6 +654,8 @@
|
|
648
654
|
<ref name="eref"/>
|
649
655
|
<ref name="xref"/>
|
650
656
|
<ref name="hyperlink"/>
|
657
|
+
<ref name="index"/>
|
658
|
+
<ref name="index-xref"/>
|
651
659
|
</choice>
|
652
660
|
</zeroOrMore>
|
653
661
|
</element>
|
@@ -655,7 +663,11 @@
|
|
655
663
|
<define name="keyword">
|
656
664
|
<element name="keyword">
|
657
665
|
<zeroOrMore>
|
658
|
-
<
|
666
|
+
<choice>
|
667
|
+
<ref name="PureTextElement"/>
|
668
|
+
<ref name="index"/>
|
669
|
+
<ref name="index-xref"/>
|
670
|
+
</choice>
|
659
671
|
</zeroOrMore>
|
660
672
|
</element>
|
661
673
|
</define>
|
@@ -676,7 +688,11 @@
|
|
676
688
|
<define name="strike">
|
677
689
|
<element name="strike">
|
678
690
|
<zeroOrMore>
|
679
|
-
<
|
691
|
+
<choice>
|
692
|
+
<ref name="PureTextElement"/>
|
693
|
+
<ref name="index"/>
|
694
|
+
<ref name="index-xref"/>
|
695
|
+
</choice>
|
680
696
|
</zeroOrMore>
|
681
697
|
</element>
|
682
698
|
</define>
|
data/grammars/biblio.rng
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module RelatonEcma
|
2
2
|
class DataParser
|
3
|
-
MATTRS = %i[docid title date link].freeze
|
4
|
-
ATTRS = MATTRS + %i[abstract relation edition].freeze
|
3
|
+
MATTRS = %i[docid title date link doctype].freeze
|
4
|
+
ATTRS = MATTRS + %i[abstract relation edition doctype].freeze
|
5
5
|
|
6
6
|
#
|
7
7
|
# Initialize parser
|
@@ -11,7 +11,7 @@ module RelatonEcma
|
|
11
11
|
def initialize(hit)
|
12
12
|
@hit = hit
|
13
13
|
@bib = {
|
14
|
-
type: "standard", language: ["en"], script: ["Latn"], place: ["Geneva"]
|
14
|
+
type: "standard", language: ["en"], script: ["Latn"], place: ["Geneva"]
|
15
15
|
}
|
16
16
|
@agent = Mechanize.new
|
17
17
|
end
|
@@ -211,5 +211,11 @@ module RelatonEcma
|
|
211
211
|
content = "\"Memento #{year}\" for year #{year}"
|
212
212
|
[{ content: content, language: "en", script: "Latn" }]
|
213
213
|
end
|
214
|
+
|
215
|
+
def fetch_doctype
|
216
|
+
RelatonBib::DocumentType.new type: "document"
|
217
|
+
end
|
218
|
+
|
219
|
+
alias_method :fetch_mem_doctype, :fetch_doctype
|
214
220
|
end
|
215
221
|
end
|
@@ -40,14 +40,13 @@ module RelatonEcma
|
|
40
40
|
# @param opts [Hash] not used
|
41
41
|
# @return [RelatonEcma::BibliographicItem] Relaton of reference
|
42
42
|
def get(code, _year = nil, _opts = {})
|
43
|
-
Util.warn "(#{code})
|
43
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
44
44
|
result = fetch_doc(code)
|
45
45
|
if result
|
46
|
-
Util.warn "(#{code})
|
46
|
+
Util.warn "(#{code}) Found: `#{result.docidentifier.first.id}`"
|
47
47
|
# item
|
48
48
|
else
|
49
|
-
Util.warn "(#{code})
|
50
|
-
"The code must be exactly like it is on the standards website."
|
49
|
+
Util.warn "(#{code}) Not found."
|
51
50
|
end
|
52
51
|
result
|
53
52
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module RelatonEcma
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
module HashConverter
|
3
|
+
include RelatonBib::HashConverter
|
4
|
+
extend self
|
5
|
+
|
6
|
+
# @param item_hash [Hash]
|
7
|
+
# @return [RelatonEcma::BibliographicItem]
|
8
|
+
def bib_item(item_hash)
|
9
|
+
BibliographicItem.new(**item_hash)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
data/lib/relaton_ecma/version.rb
CHANGED
data/relaton_ecma.gemspec
CHANGED
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency "mechanize", "~> 2.8.0"
|
31
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
31
|
+
spec.add_dependency "relaton-bib", "~> 1.17.0"
|
32
32
|
spec.add_dependency "relaton-index", "~> 0.2.4"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ecma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.17.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.17.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: relaton-index
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|