relaton-ecma 1.13.0 → 1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18799ea91f7f0c3776f926708ec405382238a1696fbcca707a191b05711db099
4
- data.tar.gz: f6de50f201bddfe0153a5b14e756c329380b305d9f59fed2529493819ecd7161
3
+ metadata.gz: 5bc67bcba0ff063e94f85b12e208b74231c8ffd77736a047e910797eb1da211c
4
+ data.tar.gz: 34396c96fdf0d4b8d8d1f1cff04f72f135a103f3a830f6784521ff46f5e24367
5
5
  SHA512:
6
- metadata.gz: 6af597bf9af8eab299102121196ee669068865a553d1ddf0da8b98524e2b91ebe307d013e8921491dd136c12440641e033ac0fef178d924d2ecbbd9ddfae42c3
7
- data.tar.gz: 9e7735cfe5fdcca1d1bd461c1fa9ffdd558b204f39604a3e742ee90ccb704fb1542c00bcfc93c3dee9435dec0cb1d42ae767015f0bca9167c5bb19311d74f07a
6
+ metadata.gz: 83fde052717c206e86a00e893581538878f03ae25a06c24f9288d8adbc69c92ec4e3a1003b39ff7e8a834be4360e7a81eb802e42924c7d14c178a18c39f013c1
7
+ data.tar.gz: e4adc23d844076f2c555b677db11a2e799041ae5b9fc3ec43f7fac51fd583db964bef5cf874dc656fd5c5b3d23151bb60752f3f270f7d631f62ce3b05412cbdc
@@ -5,7 +5,6 @@ name: rake
5
5
  on:
6
6
  push:
7
7
  branches: [ master, main ]
8
- tags: [ v* ]
9
8
  pull_request:
10
9
 
11
10
  jobs:
@@ -0,0 +1,22 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ push:
14
+ tags: [ v* ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: relaton/support/.github/workflows/release.yml@master
19
+ with:
20
+ next_version: ${{ github.event.inputs.next_version }}
21
+ secrets:
22
+ rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
data/Gemfile CHANGED
@@ -3,5 +3,11 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in relaton_ecma.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem "rake", "~> 13.0"
7
7
  gem "rspec", "~> 3.0"
8
+
9
+ gem "pry-byebug"
10
+ gem "ruby-jing"
11
+ gem "simplecov"
12
+ gem "vcr"
13
+ gem "webmock"
data/README.adoc CHANGED
@@ -8,7 +8,7 @@ image:https://codeclimate.com/github/relaton/relaton-ecma/badges/gpa.svg["Code C
8
8
  image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-ecma.svg["Pull Requests", link="https://github.com/relaton/relaton-ecma/pulls"]
9
9
  image:https://img.shields.io/github/commits-since/relaton/relaton-ecma/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-ecma/releases"]
10
10
 
11
- RelatonEcma is a Ruby gem that search and fetch standards from the https://www.ecma-international.org[European Computer Manufacturers Association].
11
+ RelatonEcma is a Ruby gem that searches and fetches standards from the https://www.ecma-international.org[European Computer Manufacturers Association].
12
12
 
13
13
  == Installation
14
14
 
@@ -29,31 +29,71 @@ Or install it yourself as:
29
29
 
30
30
  == Usage
31
31
 
32
- === Search document
32
+ === Fetch documents
33
+
34
+ Documents can be fetched by reference. The structure of the reference depends on the type of the document. There are three types of documents:
35
+ - ECMA standards
36
+ - ECMA technical reports
37
+ - ECMA mementos
38
+
39
+ ECMA standards have the following reference structure: `ECMA-{NUMBER}[ ed{EDITION}][ vol{VOLUME}]`. Where: `NUMBER` is a number of the standard, `EDITION` is an edition of the standard, and `VOLUME` is a volume of the standard. The `EDITION` and `VOLUME` are optional. If `EDITION` is not specified, the latest edition of the standard will be fetched. If `VOLUME` is not specified, the first volume of the standard will be fetched. +
40
+ ECMA technical reports have the following reference structure: `ECMA TR/{NUMBER}[ ed{EDITION}]`. Where: `NUMBER` is a number of the technical report, and `EDITION` is an edition of the technical report. The `EDITION` is optional. If `EDITION` is not specified, the latest edition of the technical report will be fetched. +
41
+ ECMA mementos have the following reference structure: `ECMA MEM/{YEAR}`. Where: `YEAR` is an year of the memento.
33
42
 
34
43
  [source,ruby]
35
44
  ----
36
45
  require 'relaton_ecma'
46
+ => true
37
47
 
48
+ # fetch ECMA standard
38
49
  item = RelatonEcma::EcmaBibliography.get 'ECMA-6'
39
50
  [relaton-ecma] ("ECMA-6") fetching...
40
51
  [relaton-ecma] ("ECMA-6") found ECMA-6
41
- => #<RelatonBib::BibliographicItem:0x007fe0c047e340
52
+ #<RelatonEcma::BibliographicItem:0x00007fc645b11c10
53
+ ...
54
+
55
+ # fetch ECMA standard with edition and volume
56
+ RelatonEcma::EcmaBibliography.get "ECMA-269 ed3 vol2"
57
+ [relaton-ecma] ("ECMA-269 ed3 vol2") fetching...
58
+ [relaton-ecma] ("ECMA-269 ed3 vol2") found ECMA-269
59
+ => #<RelatonEcma::BibliographicItem:0x0000000106ac8210
60
+ ...
61
+
62
+ # fetch the last edition of ECMA standard
63
+ bib = RelatonEcma::EcmaBibliography.get "ECMA-269"
64
+ [relaton-ecma] ("ECMA-269") fetching...
65
+ [relaton-ecma] ("ECMA-269") found ECMA-269
66
+ => #<RelatonEcma::BibliographicItem:0x000000010a408480
42
67
  ...
43
68
 
69
+ bib.edition.content
70
+ => "9"
71
+
72
+ # fetch the first volume of ECMA standard
73
+ bib = RelatonEcma::EcmaBibliography.get "ECMA-269 ed3"
74
+ [relaton-ecma] ("ECMA-269 ed3") fetching...
75
+ [relaton-ecma] ("ECMA-269 ed3") found ECMA-269
76
+ => #<RelatonEcma::BibliographicItem:0x000000010a3ed0e0
77
+ ...
78
+
79
+ bib.extent.first.reference_from
80
+ => "1"
81
+
82
+ # fetch ECMA technical report
44
83
  RelatonEcma::EcmaBibliography.get 'ECMA TR/18'
45
84
  [relaton-ecma] ("ECMA TR/18") fetching...
46
85
  [relaton-ecma] ("ECMA TR/18") found ECMA TR/18
47
- => #<RelatonBib::BibliographicItem:0x007ff53d2011a8
86
+ => #<RelatonEcma::BibliographicItem:0x00007fc645c00cc0
48
87
  ...
49
88
 
89
+ # fetch ECMA memento
50
90
  RelatonEcma::EcmaBibliography.get "ECMA MEM/2021"
51
91
  [relaton-ecma] ("ECMA MEM/2021") fetching...
52
92
  [relaton-ecma] ("ECMA MEM/2021") found ECMA MEM/2021
53
- => #<RelatonBib::BibliographicItem:0x007ff53d240150
93
+ => #<RelatonEcma::BibliographicItem:0x00007fc665b2f060
54
94
  ...
55
95
 
56
- # Return nil if document doesn't exist.
96
+ # Return nil if a document doesn't exist.
57
97
  RelatonEcma::EcmaBibliography.get '1111'
58
98
  [relaton-ecma] ("1111") fetching...
59
99
  [relaton-ecma] WARNING no match found online for 1111. The code must be exactly like it is on the standards website.
@@ -65,34 +105,28 @@ RelatonEcma::EcmaBibliography.get '1111'
65
105
  [source,ruby]
66
106
  ----
67
107
  item.to_xml
68
- "<bibitem id="ECMA-6" type="standard">
69
- <title format="text/plain" language="en" script="Latn">7-bit Coded Character Set</title>
70
- <uri type="src">https://www.ecma-international.org/publications/standards/Ecma-006.htm</uri>
71
- <uri type="doi">http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-006.pdf</uri>
72
- <docidentifier type="ECMA">ECMA-6</docidentifier>
73
- <date type="published">
74
- <on>1991-12</on>
75
- </date>
76
- <edition>6</edition>
77
- ...
78
- </bibitem>"
108
+ => "<bibitem id="ECMA-6" type="standard" schema-version="v1.2.1">
109
+ <fetched>2022-12-03</fetched>
110
+ <title format="text/plain" language="en" script="Latn">7-bit coded character set</title>
111
+ <uri type="src">https://www.ecma-international.org/publications-and-standards/standards/ecma-6/</uri>
112
+ <uri type="doi">https://www.ecma-international.org/wp-content/uploads/ECMA-6_6th_edition_december_1991.pdf</uri>
113
+ <docidentifier type="ECMA" primary="true">ECMA-6</docidentifier>
114
+ ...
115
+ </bibitem>"
79
116
  ----
80
117
 
81
118
  With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
82
119
  [source,ruby]
83
120
  ----
84
121
  item.to_xml bibdata: true
85
- "<bibdata type="standard">
86
- <title format="text/plain" language="en" script="Latn">7-bit Coded Character Set</title>
87
- <uri type="src">https://www.ecma-international.org/publications/standards/Ecma-006.htm</uri>
88
- <uri type="doi">http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-006.pdf</uri>
89
- <docidentifier type="ECMA">ECMA-6</docidentifier>
90
- <date type="published">
91
- <on>1991-12</on>
92
- </date>
93
- <edition>6</edition>
122
+ "<bibdata type="standard" schema-version="v1.2.1">
123
+ <fetched>2022-12-03</fetched>
124
+ <title format="text/plain" language="en" script="Latn">7-bit coded character set</title>
125
+ <uri type="src">https://www.ecma-international.org/publications-and-standards/standards/ecma-6/</uri>
126
+ <uri type="doi">https://www.ecma-international.org/wp-content/uploads/ECMA-6_6th_edition_december_1991.pdf</uri>
127
+ <docidentifier type="ECMA" primary="true">ECMA-6</docidentifier>
94
128
  ...
95
- <ext>
129
+ <ext schema-version="v1.0.0">
96
130
  <doctype>document</doctype>
97
131
  </ext>
98
132
  </bibdata>"
@@ -113,18 +147,28 @@ item.link
113
147
 
114
148
  [source,ruby]
115
149
  ----
116
- item = RelatonBib::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml")
117
- => #<RelatonBib::BibliographicItem:0x007f847dbe2f18
150
+ item = RelatonEcma::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml")
151
+ => #<RelatonEcma::BibliographicItem:0x00007fc645b3bf10
118
152
  ...
153
+ ----
119
154
 
120
- item.to_xml bibdata: true
121
- "<bibdata type="standard">
122
- <title format="text/plain" language="en" script="Latn">7-bit Coded Character Set</title>
123
- <uri type="src">https://www.ecma-international.org/publications/standards/Ecma-006.htm</uri>
124
- <uri type="doi">http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-006.pdf</uri>
125
- <docidentifier type="ECMA">ECMA-6</docidentifier>
126
- ...
127
- </bibdata>"
155
+ === Fetch data
156
+
157
+ This gem uses a https://github.com/relaton/relaton-data-ecma[ecma-standards] prefetched dataset as a data source. The dataset contains documents from ECMA https://www.ecma-international.org/publications-and-standards/standards/[Standards], https://www.ecma-international.org/publications-and-standards/technical-reports/[Technical Reports], and https://www.ecma-international.org/publications-and-standards/mementos/[Mementos] pages.
158
+
159
+ The method `RelatonEcma::DataFetcher.new(output: "data", format: "yaml").fetch` fetches all the documents from the pages and saves them to the `./data` folder in YAML format.
160
+ Arguments:
161
+
162
+ - `output` - folder to save documents (default './data').
163
+ - `format` - the format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxxml` (default `yaml`).
164
+
165
+ [source,ruby]
166
+ ----
167
+ RelatonEcma::DataFetcher.new.fetch
168
+ Started at: 2022-06-23 09:36:55 +0200
169
+ Stopped at: 2022-06-23 09:36:58 +0200
170
+ Done in: 752 sec.
171
+ => nil
128
172
  ----
129
173
 
130
174
  == Development
@@ -1,10 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <include href="biblio.rng">
4
- <start>
5
- <ref name="document"/>
6
- </start>
7
- </include>
8
3
  <define name="document">
9
4
  <element name="document">
10
5
  <optional>
@@ -527,7 +522,6 @@
527
522
  <value>tip</value>
528
523
  <value>important</value>
529
524
  <value>caution</value>
530
- <value>statement</value>
531
525
  </choice>
532
526
  </define>
533
527
  <define name="figure">
@@ -688,6 +682,9 @@
688
682
  </define>
689
683
  <define name="underline">
690
684
  <element name="underline">
685
+ <optional>
686
+ <attribute name="style"/>
687
+ </optional>
691
688
  <zeroOrMore>
692
689
  <ref name="PureTextElement"/>
693
690
  </zeroOrMore>
@@ -1125,26 +1122,4 @@
1125
1122
  </zeroOrMore>
1126
1123
  </element>
1127
1124
  </define>
1128
- <define name="ext">
1129
- <element name="ext">
1130
- <ref name="BibDataExtensionType"/>
1131
- </element>
1132
- </define>
1133
- <define name="BibDataExtensionType">
1134
- <ref name="doctype"/>
1135
- </define>
1136
- <define name="doctype">
1137
- <element name="doctype">
1138
- <ref name="DocumentType"/>
1139
- </element>
1140
- </define>
1141
- <define name="DocumentType">
1142
- <value>document</value>
1143
- </define>
1144
- <define name="BibData">
1145
- <ref name="BibliographicItem"/>
1146
- <optional>
1147
- <ref name="ext"/>
1148
- </optional>
1149
- </define>
1150
1125
  </grammar>
@@ -0,0 +1,164 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
+ <!--
4
+ Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
5
+ of relaton
6
+
7
+ Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
8
+ (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
9
+ -->
10
+ <include href="biblio.rng">
11
+ <define name="BibData">
12
+ <ref name="BibliographicItem"/>
13
+ <optional>
14
+ <ref name="ext"/>
15
+ </optional>
16
+ </define>
17
+ </include>
18
+ <define name="ext">
19
+ <element name="ext">
20
+ <ref name="BibDataExtensionType"/>
21
+ </element>
22
+ </define>
23
+ <define name="BibDataExtensionType">
24
+ <optional>
25
+ <attribute name="schema-version"/>
26
+ </optional>
27
+ <ref name="doctype"/>
28
+ <optional>
29
+ <ref name="docsubtype"/>
30
+ </optional>
31
+ <optional>
32
+ <ref name="editorialgroup"/>
33
+ </optional>
34
+ <zeroOrMore>
35
+ <ref name="ics"/>
36
+ </zeroOrMore>
37
+ <zeroOrMore>
38
+ <ref name="structuredidentifier"/>
39
+ </zeroOrMore>
40
+ </define>
41
+ <define name="doctype">
42
+ <element name="doctype">
43
+ <optional>
44
+ <attribute name="abbreviation"/>
45
+ </optional>
46
+ <ref name="DocumentType"/>
47
+ </element>
48
+ </define>
49
+ <define name="DocumentType">
50
+ <text/>
51
+ </define>
52
+ <define name="docsubtype">
53
+ <element name="subdoctype">
54
+ <ref name="DocumentSubtype"/>
55
+ </element>
56
+ </define>
57
+ <define name="DocumentSubtype">
58
+ <text/>
59
+ </define>
60
+ <define name="editorialgroup">
61
+ <element name="editorialgroup">
62
+ <oneOrMore>
63
+ <ref name="technical-committee"/>
64
+ </oneOrMore>
65
+ </element>
66
+ </define>
67
+ <define name="technical-committee">
68
+ <element name="technical-committee">
69
+ <ref name="IsoWorkgroup"/>
70
+ </element>
71
+ </define>
72
+ <define name="IsoWorkgroup">
73
+ <optional>
74
+ <attribute name="number"/>
75
+ </optional>
76
+ <optional>
77
+ <attribute name="type"/>
78
+ </optional>
79
+ <optional>
80
+ <attribute name="identifier"/>
81
+ </optional>
82
+ <optional>
83
+ <attribute name="prefix"/>
84
+ </optional>
85
+ <text/>
86
+ </define>
87
+ <define name="ics">
88
+ <element name="ics">
89
+ <element name="code">
90
+ <text/>
91
+ </element>
92
+ <optional>
93
+ <element name="text">
94
+ <text/>
95
+ </element>
96
+ </optional>
97
+ </element>
98
+ </define>
99
+ <define name="structuredidentifier">
100
+ <element name="structuredidentifier">
101
+ <optional>
102
+ <attribute name="type"/>
103
+ </optional>
104
+ <oneOrMore>
105
+ <element name="agency">
106
+ <text/>
107
+ </element>
108
+ </oneOrMore>
109
+ <optional>
110
+ <element name="class">
111
+ <text/>
112
+ </element>
113
+ </optional>
114
+ <element name="docnumber">
115
+ <text/>
116
+ </element>
117
+ <optional>
118
+ <element name="partnumber">
119
+ <text/>
120
+ </element>
121
+ </optional>
122
+ <optional>
123
+ <element name="edition">
124
+ <text/>
125
+ </element>
126
+ </optional>
127
+ <optional>
128
+ <element name="version">
129
+ <text/>
130
+ </element>
131
+ </optional>
132
+ <optional>
133
+ <element name="supplementtype">
134
+ <text/>
135
+ </element>
136
+ </optional>
137
+ <optional>
138
+ <element name="supplementnumber">
139
+ <text/>
140
+ </element>
141
+ </optional>
142
+ <optional>
143
+ <element name="amendment">
144
+ <text/>
145
+ </element>
146
+ </optional>
147
+ <optional>
148
+ <element name="corrigendum">
149
+ <text/>
150
+ </element>
151
+ </optional>
152
+ <optional>
153
+ <element name="language">
154
+ <text/>
155
+ </element>
156
+ </optional>
157
+ <optional>
158
+ <element name="year">
159
+ <text/>
160
+ </element>
161
+ </optional>
162
+ </element>
163
+ </define>
164
+ </grammar>