relaton-cli 1.20.5 → 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.
data/docs/README.adoc CHANGED
@@ -1,59 +1,57 @@
1
- = Relaton CLI (relaton-cli): Relaton Command-line Interface
1
+ = Relaton CLI: Command-line Interface for Bibliographic References
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-cli.svg["Gem Version", link="https://rubygems.org/gems/relaton-cli"]
4
4
  image:https://github.com/relaton/relaton-cli/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-cli/actions?workflow=rake"]
5
- // image:https://codeclimate.com/github/metanorma/relaton-cli/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-cli"]
6
5
 
7
- Documentation in development.
6
+ Relaton CLI is a command-line tool for fetching, converting, and managing
7
+ bibliographic references to standards (ISO, IEC, IETF, NIST, IEEE, and many
8
+ more). It is part of the https://github.com/relaton[Relaton] /
9
+ https://www.metanorma.org[Metanorma] ecosystem.
8
10
 
9
- Please refer to https://github.com/relaton/relaton.
11
+ == Installation
10
12
 
11
- == Commands
13
+ Add to your `Gemfile`:
12
14
 
13
- Each command has an option `--verbose` (the short form is `-v`). Use the option to get warnings in the commands output.
14
- The following commands are provided.
15
+ [source,ruby]
16
+ ----
17
+ gem "relaton-cli"
18
+ ----
15
19
 
16
- === relaton concatenate
20
+ Or install directly:
17
21
 
18
22
  [source,console]
19
23
  ----
20
- $ relaton concatenate Source-Directory Relaton-Collection-File -t TITLE -g ORGANIZATION
24
+ $ gem install relaton-cli
21
25
  ----
22
26
 
23
- Iterates through all the Relaton files (YAML and XML) in `Source-Directory`, and concatenates them into a Relaton Collection file. The extension of the Collection file can be set using the `Relaton-Collection-File` file name (i.e, if it uses an extension of `yaml`, a Relaton YAML file will be created; if `rxl`, a Relaton XML file will be created, or via the `-x [ext]` (or `--extension`) option.
24
-
25
- For each Relaton input file in the `Source-Directory`, if a document file with the same base name is identified (i.e. an XML, HTML, PDF or DOC
26
- file) a link to that file is inserted.
27
+ == Requirements
27
28
 
28
- If the `TITLE` or `ORGANIZATION` options are given, they are added to the `Collection-File` output as the
29
- title and author of the `Relaton-Collection-File` document.
29
+ * Ruby >= 3.2.0
30
30
 
31
- === relaton split
32
-
33
- [source,console]
34
- ----
35
- $ relaton split Relaton-Collection-File Relaton-File-Directory -x rxl
36
- ----
31
+ == Usage
37
32
 
38
- Splits a `Relaton-Collection-File` into multiple files in the `Relaton-File-Directory`, and it also
39
- suports an additional `-x` or `--extension` options to use different extension.
33
+ Each command supports a `--verbose` (short form `-v`) option to include
34
+ warnings in the output.
40
35
 
41
36
  === relaton fetch
42
37
 
43
38
  [source,console]
44
39
  ----
45
- $ relaton fetch CODE -t TYPE -f FORMAT -y YEAR -r RETRIES --all-parts --keep-year --no-cache
40
+ $ relaton fetch CODE -t TYPE -f FORMAT -y YEAR -r RETRIES --all-parts --keep-year --no-cache --publication-date-before DATE --publication-date-after DATE
46
41
  ----
47
42
 
48
43
  Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
49
44
 
50
- * `YEAR` is optional and specifies the year of publication of the standard.
51
- * `FORMAT` is optional, and specifies the output format; the recognized values for `FORMAT` are `xml` (default), yaml, `bibtex`.
52
- * `TYPE` is optional and specifies the standards class library to be used, that the identifier is part of. The recognized values for `TYPE` are: `3GPP`, `BIPM`, `CCTF`, `CCDS`, `CGPM`, `CIPM`, `JCRB`, `JCGM`, `BSI`, `BS`, `PD`, `CC`, `CCSDS`, `CEN`, `EN`, `ENV`, `CWA`, `HD`, `CR`, `CIE`, `DOI`, `ECMA`, `ETSI`, `CN`, `GB`, `GB/T`, `GB/Z`, `IANA`, `IEC`, `CISPR`, `IEV`, `IEEE`, `ANSI`, `NACE`, `AIEE`, `ASA`, `IRE`, `IETF`, `RFC`, `BCP`, `FYI`, `STD`, `I-D`, `IHO`, `ISBN`, `ISO`, `ISO/IEC`, `ITU`, `JIS`, `TR`, `NIST`, `NBS`, `NISTGCR`, `ITL Bulletin`, `JPCRD`, `NISTIR`, `CSRC`, `FIPS`, `OASIS`, `OGC`, `OMG`, `UN`, `W3C`, `XEP`, `PLATEAU`.
45
+ [[relaton-fetch-types]]
46
+ * `TYPE` is optional and specifies the standards class library to use. Recognized values for `TYPE` are: `3GPP`, `BIPM`, `CCTF`, `CCDS`, `CGPM`, `CIPM`, `JCRB`, `JCGM`, `BSI`, `BS`, `PD`, `CC`, `CCSDS`, `CEN`, `EN`, `ENV`, `CWA`, `HD`, `CR`, `CIE`, `DOI`, `ECMA`, `ETSI`, `CN`, `GB`, `GB/T`, `GB/Z`, `IANA`, `IEC`, `CISPR`, `IEV`, `IEEE`, `ANSI`, `NACE`, `AIEE`, `ASA`, `IRE`, `IETF`, `RFC`, `BCP`, `FYI`, `STD`, `I-D`, `IHO`, `ISBN`, `ISO`, `ISO/IEC`, `ITU`, `JIS`, `TR`, `NIST`, `NBS`, `NISTGCR`, `ITL Bulletin`, `JPCRD`, `NISTIR`, `CSRC`, `FIPS`, `OASIS`, `OGC`, `OMG`, `UN`, `W3C`, `XEP`, `PLATEAU`.
47
+ * `FORMAT` is optional. Recognized values are `xml` (default), `yaml`, `bibtex`.
48
+ * `YEAR` is optional and specifies the year of publication.
53
49
  * `RETRIES` is optional, number of network retries (default 1).
54
- * `--all-parts` fetch all parts.
50
+ * `--all-parts` fetch all parts of the standard.
55
51
  * `--keep-year` undated reference should return an actual reference with year.
56
52
  * `--no-cache` do not use cache.
53
+ * `--publication-date-before DATE` fetch only documents published before the specified date. Accepted formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`.
54
+ * `--publication-date-after DATE` fetch only documents published after the specified date. Accepted formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`.
57
55
 
58
56
  === relaton fetch-data
59
57
 
@@ -62,7 +60,7 @@ Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
62
60
  $ relaton fetch-data DATASET -o DIR -f FORMAT
63
61
  ----
64
62
 
65
- Fetch all the documents from a `DATASET` source and save them to a folder `DIR` in the format `FORMAT`.
63
+ Fetch all documents from a `DATASET` source and save them to folder `DIR` in format `FORMAT`.
66
64
 
67
65
  The following datasets are available:
68
66
 
@@ -70,18 +68,18 @@ The following datasets are available:
70
68
  * `cie-techstreet` - https://www.techstreet.com/cie/searches/31156444
71
69
  * `calconnect-org` - https://standards.calconnect.org/relaton/index.yaml
72
70
  * `ogc-naming-authority` - https://raw.githubusercontent.com/opengeospatial/NamingAuthority/master/incubation/bibliography/bibliography.json
73
- * `ieee-rawbib` - looks for the IEEE dataset in the local `./ieee-rawbib` directory. The dataset could be downloaded from https://github.com/ietf-ribose/ieee-rawbib repository
71
+ * `ieee-rawbib` - looks for the IEEE dataset in the local `./ieee-rawbib` directory. The dataset can be downloaded from https://github.com/ietf-ribose/ieee-rawbib
74
72
  * `w3c-rdf` - http://www.w3.org/2002/01/tr-automation/tr.rdf
75
- * `w3c-tr-archive` - looks for the W3C archive dataset in local `./w3c-tr-archive` directory. The dataset could be downloaded from https://github.com/relaton/w3c-tr-archive repository
73
+ * `w3c-tr-archive` - looks for the W3C archive dataset in local `./w3c-tr-archive` directory. The dataset can be downloaded from https://github.com/relaton/w3c-tr-archive
76
74
  * `iana-registries` - https://github.com/ietf-ribose/iana-registries
77
75
  * `status-smg-3GPP` - updates previously downloaded data if a new archive is available in ftp://www.3gpp.org/Information/Databases/
78
76
  * `status-smg-3GPP-force` - download data from the latest archive in ftp://www.3gpp.org/Information/Databases/
79
77
  * `ietf-rfcsubseries` - https://www.rfc-editor.org/rfc-index.xml (`<bcp-entry>`, `<fyi-entry>`, `<std-entry>`)
80
- * `ietf-internet-drafts` - looks for the Internet-Drafts dataset in the local `./bibxml-ids` directory. The dataset could be downloaded using `rsync -avcizxL rsync.ietf.org::bibxml-ids ./bibxml-ids` command.
78
+ * `ietf-internet-drafts` - looks for the Internet-Drafts dataset in the local `./bibxml-ids` directory. The dataset can be downloaded using `rsync -avcizxL rsync.ietf.org::bibxml-ids ./bibxml-ids`.
81
79
  * `ietf-rfc-entries` - https://www.rfc-editor.org/rfc-index.xml (`<rfc-entry>`)
82
80
  * `oasis-open` - https://www.oasis-open.org/standards/
83
- * `bipm-data-outcomes` - looks for the BIPM dataset in the local `./bipm-data-outcomes` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-data-outcomes repository
84
- * `si-brochure` - looks for the SI-Brochure dataset in the local `./bipm-si-brocure` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-si-brochure repository
81
+ * `bipm-data-outcomes` - looks for the BIPM dataset in the local `./bipm-data-outcomes` directory. The dataset can be downloaded from https://github.com/metanorma/bipm-data-outcomes
82
+ * `si-brochure` - looks for the SI-Brochure dataset in the local `./bipm-si-brochure` directory. The dataset can be downloaded from https://github.com/metanorma/bipm-si-brochure
85
83
  * `ecma-standards` - https://www.ecma-international.org/publications/standards/
86
84
  * `itu-r` - https://extranet.itu.int/brdocsearch
87
85
  * `ccsds` - https://public.ccsds.org/Publications/AllPubs.aspx
@@ -93,7 +91,7 @@ The following datasets are available:
93
91
  Options:
94
92
 
95
93
  * `DIR` - folder name to store documents (default `./data`).
96
- * `FORMAT` - format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
94
+ * `FORMAT` - output format: `yaml` (default), `xml`, `bibxml`.
97
95
 
98
96
  === relaton extract
99
97
 
@@ -102,89 +100,39 @@ Options:
102
100
  $ relaton extract Metanorma-XML-Directory Relaton-XML-Directory -x EXTENSION
103
101
  ----
104
102
 
105
- Iterate through all the Metanorma XML files in `Metanorma-XML-Directory`, and extract the `bibdata`
106
- element from each. Save the `bibdata` element for each file to `Relaton-XML-Directory`, as the Relaton XML
107
- description for that file. If a document identifier is present in `bibdata`, it is used as the name of the
108
- file; otherwise, the original file name is used. The filename is suffixed with `EXTENSION`; by default,
109
- `.rxl` is used.
103
+ Iterate through all Metanorma XML files in `Metanorma-XML-Directory` and extract the `bibdata` element from each. Save the `bibdata` element to `Relaton-XML-Directory` as the Relaton XML description for that file. If a document identifier is present in `bibdata`, it is used as the filename; otherwise, the original filename is used. The filename is suffixed with `EXTENSION` (default `.rxl`).
110
104
 
111
- [[relaton-xml2html]]
112
- === relaton xml2html
105
+ === relaton concatenate
113
106
 
114
107
  [source,console]
115
108
  ----
116
- $ relaton xml2html <relaton-xml> [<stylesheet>] [<html-template-dir>]
109
+ $ relaton concatenate Source-Directory Relaton-Collection-File -t TITLE -g ORGANIZATION
117
110
  ----
118
111
 
119
- Render a Relaton Collection XML as an HTML file. Used to generate an HTML index of standards.
112
+ Iterate through all Relaton files (YAML and XML) in `Source-Directory` and concatenate them into a Relaton Collection file. The extension of the Collection file can be set via the filename (e.g., `.yaml` for YAML, `.rxl` for XML) or using the `-x` (`--extension`) option.
120
113
 
121
- * `relaton-xml` is the Relaton Collection XML file.
122
- * `stylesheet` is the CSS stylesheet to be used to style the output. For the CSS styling of each bibliographic element, see below.
123
- * `html-template-dir` is a directory containing HTML Liquid Template files into which the bibliographic entries are to be inserted.
124
- There are two templates necessary:
114
+ For each Relaton input file in `Source-Directory`, if a document file with the same base name is identified (XML, HTML, PDF, or DOC), a link to that file is inserted.
125
115
 
126
- ** Index template (`_index.liquid_`)
116
+ If `TITLE` or `ORGANIZATION` options are given, they are added to the output as the title and author of the collection.
127
117
 
128
- *** The HTML Template file `_index.liquid` recognizes the following parameters:
129
- *** `css`: where the CSS stylesheet `stylesheet` is injected
130
- *** `title`: the Title of the collection, `./relaton-collection/title` in `relaton-xml`
131
- *** `author`: the Author of the collection, `./relaton-collection/contributor[role/@type = 'author']/organization/name` in `relaton-xml`
132
- *** `content`: the list of resources generated by the script
118
+ === relaton split
133
119
 
134
- ** Individual bibliographic entries template (`_document.liquid`)
135
-
136
- *** This template recognizes attributes of a bibliographic entry (`document`) that follow the naming convention of <<relaton-yaml,Relaton YAML>>; e.g. `document.html` is the HTML URI for the document.
137
-
138
- The default stylesheet and templates are given (which also demonstrates the structure) in the `templates` directory.
139
-
140
- Sample HTML output for a bibliographic entry:
141
-
142
- [source,html]
143
- ----
144
- <div class="document">
145
- <div class="doc-line">
146
- <div class="doc-identifier">
147
- <h2>
148
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.html">CC/R 3101</a>
149
- </h2>
150
- </div>
151
- <div class="doc-type-wrap">
152
- <div class="doc-type report">report</div>
153
- </div>
154
- </div>
155
- <div class="doc-title">
156
- <h3>
157
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.html">CalConnect XLIII -- Position on the European Union daylight-savings timezone change</a>
158
- </h3>
159
- </div>
160
- <div class="doc-info cancelled">
161
- <div class="doc-stage cancelled">cancelled</div>
162
- <div class="doc-dates">
163
- <div class="doc-updated">2019-10-17</div>
164
- </div>
165
- </div>
166
- <div class="doc-bib">
167
- <div class="doc-bib-relaton">
168
- <a href="csd/cc-r-3101.xml">Relaton XML</a>
169
- </div>
170
- </div>
171
- <div class="doc-access">
172
- <div class="doc-access-button-html">
173
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.html">HTML</a>
174
- </div>
175
- <div class="doc-access-button-pdf">
176
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.pdf">PDF</a>
177
- </div>
178
- <div class="doc-access-button-doc">
179
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.doc">Word</a>
180
- </div>
181
- <div class="doc-access-button-xml">
182
- <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.xml">XML</a>
183
- </div>
184
- </div>
185
- </div>
120
+ [source,console]
121
+ ----
122
+ $ relaton split Relaton-Collection-File Relaton-File-Directory -x rxl
123
+ ----
124
+
125
+ Split a `Relaton-Collection-File` into multiple files in `Relaton-File-Directory`. Supports the `-x` (`--extension`) option to set the file extension.
126
+
127
+ === relaton convert
128
+
129
+ [source,console]
130
+ ----
131
+ $ relaton convert XML -f FORMAT -o OUTPUT-FILE
186
132
  ----
187
133
 
134
+ Convert a Relaton XML document into YAML, AsciiBib, or BibTeX format. Allowed `--format` values are `yaml`, `asciibib`, `bibtex`. If `--output` is omitted, a new file is created in the same folder with the appropriate extension.
135
+
188
136
  === relaton yaml2xml
189
137
 
190
138
  [source,console]
@@ -192,48 +140,48 @@ Sample HTML output for a bibliographic entry:
192
140
  $ relaton yaml2xml YAML -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LIBRARY
193
141
  ----
194
142
 
195
- Convert a Relaton YAML file (`filename.yaml`) into a Relaton XML file (`filename.xml`). If the Relaton YAML file specifies multiple bibliograph items, and `OUTPUT-DIRECTORY` is nominated, also convert the file into a list of Relaton XML files for each entry, stored in that directory. The document identifier is used as the name of each Relaton XML file; the Relaton XML filename is suffixed with `RELATON_EXTENSION` (default `.rxl`) and prefixed with `PREFIX` (default empty). Any libraries that need to be required for the conversion are specified in `LIBRARY` as a space-delimited list.
143
+ Convert a Relaton YAML file into Relaton Collection XML or separate files. If the YAML file specifies multiple bibliographic items and `OUTPUT-DIRECTORY` is given, also convert into individual Relaton XML files per entry. The document identifier is used as the filename, suffixed with `RELATON_EXTENSION` (default `.rxl`) and prefixed with `PREFIX` (default empty). Libraries required for conversion are specified in `LIBRARY` as a space-delimited list.
196
144
 
197
145
  [[relaton-yaml]]
198
- A Relaton Collection YAML file contains some initial metadata and a list of metadata about each bibliographic entry:
146
+ A Relaton Collection YAML file contains initial metadata and a list of bibliographic entries:
199
147
 
200
148
  [source,yaml]
201
149
  ----
202
150
  root:
203
- author: The Calendaring and Scheduling Consortium
204
151
  title: CalConnect Standards Registry
152
+ author: The Calendaring and Scheduling Consortium
205
153
  items:
206
- - technical_committee: PUBLISH
207
- docid:
208
- type: CC
209
- id: CC 36000
210
- primary: true
154
+ - id: CC36000
211
155
  type: standard
212
156
  title:
213
- type: main
214
- content: Standardization documents -- Vocabulary
215
- docstatus:
216
- stage: proposal
157
+ - content: Standardization documents -- Vocabulary
158
+ docidentifier:
159
+ - type: CC
160
+ content: CC 36000
161
+ primary: true
217
162
  date:
218
- type: issued
219
- value: 2018-10-25
220
- - technical_committee: DATETIME
221
- docid:
222
- type: CC
223
- id: CC 34000
224
- primary: true
163
+ - type: issued
164
+ at: '2018-10-25'
165
+ status:
166
+ stage:
167
+ content: proposal
168
+ - id: CC34000
225
169
  type: standard
226
170
  title:
227
- type: main
228
- content: Date and time -- Concepts and vocabulary
229
- docstatus:
230
- stage: proposal
171
+ - content: Date and time -- Concepts and vocabulary
172
+ docidentifier:
173
+ - type: CC
174
+ content: CC 34000
175
+ primary: true
231
176
  date:
232
- type: issued
233
- value: 2018-10-25
177
+ - type: issued
178
+ at: '2018-10-25'
179
+ status:
180
+ stage:
181
+ content: proposal
234
182
  ----
235
183
 
236
- A Relaton YAML file describing an individual bibliographic entry is limited to metadata specific to that entry. Flavor gems have additional fields. The link:https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc#yaml[Relaton YAML] illustrates the common fields supported by all flavor gems.
184
+ A Relaton YAML file describing an individual bibliographic entry is limited to metadata specific to that entry. The link:https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc#yaml[Relaton YAML] illustrates the common fields supported by all flavor gems.
237
185
 
238
186
  === relaton xml2yaml
239
187
 
@@ -242,65 +190,53 @@ A Relaton YAML file describing an individual bibliographic entry is limited to m
242
190
  $ relaton xml2yaml XML -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LIBRARY
243
191
  ----
244
192
 
245
- Convert a Relaton XML file (`filename.xml` or `filename.rxl`) into a Relaton YAML file (`filename.yaml`). If the Relaton XML file is a collection, and `OUTPUT-DIRECTORY` is nominated, also convert the file into a list of Relaton YAML files for each entry, stored in that directory. The document identifier is used as the name of each Relaton XML file; the Relaton XML filename is suffixed with `RELATON_EXTENSION` (default `.yaml`) and prefixed with `PREFIX` (default empty). Any libraries that need to be required for the conversion are specified in `LIBRARY` as a space-delimited list.
193
+ Convert a Relaton XML file into Relaton YAML. If the XML file is a collection and `OUTPUT-DIRECTORY` is given, also produce individual YAML files per entry. The document identifier is used as the filename, suffixed with `RELATON_EXTENSION` (default `.yaml`) and prefixed with `PREFIX` (default empty). Libraries required for conversion are specified in `LIBRARY` as a space-delimited list.
246
194
 
247
- === relaton yaml2html
195
+ [[relaton-xml2html]]
196
+ === relaton xml2html
248
197
 
249
198
  [source,console]
250
199
  ----
251
- $ relaton yaml2html YAML [<stylesheet>] [<liquid-template-dir>]
200
+ $ relaton xml2html <relaton-xml> [<stylesheet>] [<html-template-dir>]
252
201
  ----
253
202
 
254
- Render a Relaton YAML file (`filename.yaml`) as an HTML file. The `stylesheet` and `liquid-template-dir` directories are as for <<relaton-xml2html,relaton xml2html>>.
203
+ Render a Relaton Collection XML as an HTML file. Used to generate an HTML index of standards.
255
204
 
256
- === relaton convert
205
+ * `relaton-xml` is the Relaton Collection XML file.
206
+ * `stylesheet` is the CSS stylesheet to style the output.
207
+ * `html-template-dir` is a directory containing HTML Liquid Template files. Two templates are required:
208
+
209
+ ** Index template (`_index.liquid`) -- recognizes the following parameters:
210
+ *** `css`: the CSS stylesheet content
211
+ *** `title`: the collection title from `./relaton-collection/title`
212
+ *** `author`: the collection author from `./relaton-collection/contributor[role/@type = 'author']/organization/name`
213
+ *** `content`: the list of resources generated by the script
257
214
 
258
- [source,conxole]
215
+ ** Individual entry template (`_document.liquid`) -- recognizes attributes of a bibliographic entry (`document`) following the naming convention of <<relaton-yaml,Relaton YAML>>; e.g. `document.html` is the HTML URI for the document.
216
+
217
+ The default stylesheet and templates are provided in the `templates` directory.
218
+
219
+ === relaton yaml2html
220
+
221
+ [source,console]
259
222
  ----
260
- $ relaton convert XML -f FORMAT -o OUTPUT-FILE
223
+ $ relaton yaml2html YAML [<stylesheet>] [<liquid-template-dir>]
261
224
  ----
262
225
 
263
- Convert a Relaton XML document into YAML, AsciiBib, or BibTex format. Allowed -f or --format options are yaml, asciibib, bibtex. If the option -o or --output is omitted then a new file will be created in the folder where the original file is, with the same name but another appropriated extension.
226
+ Render a Relaton YAML file as an HTML file. The `stylesheet` and `liquid-template-dir` parameters are as for <<relaton-xml2html,relaton xml2html>>.
264
227
 
265
228
  === relaton version
229
+
230
+ [source,console]
266
231
  ----
267
232
  $ relaton version
268
- CLI => 1.17.2
269
- relaton => 1.17.2
270
- relaton-bib => 1.17.2
271
- relaton-iso-bib => 1.17.0
272
- relaton-gb => 1.17.0
273
- relaton-iec => 1.17.0
274
- relaton-ietf => 1.17.0
275
- relaton-iso => 1.17.0
276
- relaton-itu => 1.17.0
277
- relaton-nist => 1.17.0
278
- relaton-ogc => 1.17.1
279
- relaton-calconnect => 1.17.0
280
- relaton-omg => 1.17.0
281
- relaton-un => 1.17.0
282
- relaton-w3c => 1.17.2
283
- relaton-ieee => 1.17.0
284
- relaton-iho => 1.17.0
285
- relaton-bipm => 1.17.0
286
- relaton-ecma => 1.17.0
287
- relaton-cie => 1.17.0
288
- relaton-bsi => 1.17.0
289
- relaton-cen => 1.17.0
290
- relaton-iana => 1.17.0
291
- relaton-3gpp => 1.17.0
292
- relaton-oasis => 1.17.0
293
- relaton-doi => 1.17.0
294
- relaton-jis => 1.17.0
295
- relaton-xsf => 1.17.0
296
- relaton-ccsds => 1.17.0
297
- relaton-etsi => 1.17.0
298
- relaton-isbn => 1.17.0
299
233
  ----
300
234
 
235
+ Display version information for the CLI and all installed Relaton libraries.
236
+
301
237
  === relaton collection
302
238
 
303
- The `relaton collection` is a set of subcommands for collection manipulations.
239
+ The `relaton collection` command provides subcommands for collection manipulation.
304
240
 
305
241
  ==== relaton collection create
306
242
 
@@ -309,8 +245,9 @@ $ relaton collection create COLLECTION -d DIRECTORY --author AUTHOR --title TITL
309
245
  ----
310
246
 
311
247
  Create a new empty collection with the name `COLLECTION`.
312
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
313
- * `AUTHOR`, `TITLE`, and `DOCTYPE` are optional.
248
+
249
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
250
+ * `AUTHOR`, `TITLE`, and `DOCTYPE` are optional metadata.
314
251
 
315
252
  ==== relaton collection info
316
253
 
@@ -318,8 +255,9 @@ Create a new empty collection with the name `COLLECTION`.
318
255
  $ relaton collection info COLLECTION -d DIRECTORY
319
256
  ----
320
257
 
321
- Show information about `COLLECTION` (number of items, file size of collection, last updated, name, metadata).
322
- * `DIRECTORY` is optional, and specifies the path to a directory with collections. The default value is `$HOME/.relaton/collections`.
258
+ Show information about `COLLECTION` (number of items, file size, last updated, name, metadata).
259
+
260
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
323
261
 
324
262
  ==== relaton collection list
325
263
 
@@ -328,8 +266,9 @@ $ relaton collection list -d DIRECTORY -e
328
266
  ----
329
267
 
330
268
  List all collections.
331
- * `DIRECTORY` - optional, and specifies the path to a directory with collections. The default value is `$HOME/.relaton/collections`.
332
- * When parameter `-e` is defined the id of each entry id will be listed.
269
+
270
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
271
+ * `-e` - when set, list the document ID of each entry.
333
272
 
334
273
  ==== relaton collection get
335
274
 
@@ -337,12 +276,12 @@ List all collections.
337
276
  $ relaton collection get CODE -c COLLECTION -d DIRECTORY -f FORMAT -o FILE
338
277
  ----
339
278
 
340
- Get a document matched to `CODE` from `COLLECTION`.
279
+ Get a document matching `CODE` from `COLLECTION`.
341
280
 
342
- * `COLLECTION` - optional name of a collection. If undefined then fetch the first match across all collections in `DIRECTORY`.
343
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
344
- * `FORMAT` - optional. If undefined then print a document in a human-readable form. Allowed values are `abb` (AsciiBib) or `xml` (XML).
345
- * `FILE` is optional. When it's defined then save a document with the given file name. The file's extension defines the format of the file. Possible extensions are `abb` (AsciiBib) or `xml` (XML).
281
+ * `COLLECTION` - optional name of a collection. If omitted, fetches the first match across all collections in `DIRECTORY`.
282
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
283
+ * `FORMAT` - optional. If omitted, output is in human-readable form. Allowed values: `abb` (AsciiBib), `xml` (XML).
284
+ * `FILE` - optional. Save the document with the given filename. The file extension (`abb`, `xml`) defines the output format.
346
285
 
347
286
  ==== relaton collection find
348
287
 
@@ -352,21 +291,23 @@ $ relaton collection find TEXT -c COLLECTION -d DIRECTORY
352
291
 
353
292
  Full-text search through a collection or all collections.
354
293
 
355
- * `COLLECTION` - optional name of a collection. If undefined then search across all collections.
356
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
294
+ * `COLLECTION` - optional name of a collection. If omitted, searches across all collections.
295
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
357
296
 
358
297
  ==== relaton collection fetch
359
298
 
360
299
  ----
361
- $ relaton collection fetch CODE -t TYPE -y YEAR -c COLLECTION -d DIRECTORY
300
+ $ relaton collection fetch CODE -t TYPE -y YEAR -c COLLECTION -d DIRECTORY --publication-date-before DATE --publication-date-after DATE
362
301
  ----
363
302
 
364
- Fetch the Relaton XML entry corresponding to the document identifier `CODE` and save it into `COLLECTION`.
303
+ Fetch the Relaton entry for document identifier `CODE` and save it into `COLLECTION`.
365
304
 
366
- * `TYPE` specifies the standards class library to be used, that the identifier is part of. The recognized values for `TYPE` are: `3GPP`, `BIPM`, `CCTF`, `CCDS`, `CGPM`, `CIPM`, `JCRB`, `JCGM`, `BSI`, `BS`, `PD`, `CC`, `CCSDS`, `CEN`, `EN`, `ENV`, `CWA`, `HD`, `CR`, `CIE`, `DOI`, `ECMA`, `ETSI`, `CN`, `GB`, `GB/T`, `GB/Z`, `IANA`, `IEC`, `CISPR`, `IEV`, `IEEE`, `ANSI`, `NACE`, `AIEE`, `ASA`, `IRE`, `IETF`, `RFC`, `BCP`, `FYI`, `STD`, `I-D`, `IHO`, `ISBN`, `ISO`, `ISO/IEC`, `ITU`, `JIS`, `TR`, `NIST`, `NBS`, `NISTGCR`, `ITL Bulletin`, `JPCRD`, `NISTIR`, `CSRC`, `FIPS`, `OASIS`, `OGC`, `OMG`, `UN`, `W3C`, `XEP`.
367
- * `YEAR` is optional, and specifies the year of publication of the standard.
368
- * `COLLECTION` - a name of a collection.
369
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
305
+ * `TYPE` - specifies the standards class library. See <<relaton-fetch-types,recognized TYPE values>>.
306
+ * `YEAR` - optional year of publication.
307
+ * `COLLECTION` - name of a collection (required).
308
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
309
+ * `--publication-date-before DATE` fetch only documents published before the specified date. Accepted formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`.
310
+ * `--publication-date-after DATE` fetch only documents published after the specified date. Accepted formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`.
370
311
 
371
312
  ==== relaton collection export
372
313
 
@@ -376,7 +317,7 @@ $ relaton collection export COLLECTION -d DIRECTORY
376
317
 
377
318
  Export `COLLECTION` into an XML file.
378
319
 
379
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
320
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
380
321
 
381
322
  ==== relaton collection import
382
323
 
@@ -384,111 +325,88 @@ Export `COLLECTION` into an XML file.
384
325
  $ relaton collection import FILE -c COLLECTION -d DIRECTORY
385
326
  ----
386
327
 
387
- Import document or collection from XML `FILE` into `COLLECTION`.
328
+ Import a document or collection from XML `FILE` into `COLLECTION`.
388
329
 
389
- * `COLLECTION` - optional. If a collection doesn't exist then it will be created.
390
- * `DIRECTORY` - optional, and specifies a path to a directory with collections. The default value is `$HOME/.relaton/collections`.
330
+ * `COLLECTION` - optional. If the collection does not exist, it will be created.
331
+ * `DIRECTORY` - optional path to a directory with collections. Default: `$HOME/.relaton/collections`.
391
332
 
392
- === Dadabase manipulation
333
+ === Database manipulation
393
334
 
394
- ==== Create database
335
+ ==== relaton db create
395
336
 
396
337
  ----
397
338
  $ relaton db create DIR
398
339
  ----
399
340
 
400
- Creates a new database in a directory `DIR` (optional, the default value is `/home/USER/.relaton/dbpath`). In case the target directory exists it will be used as a database.
341
+ Create a new cache database in directory `DIR` (optional, default: `$HOME/.relaton/cache`). If the target directory exists, it will be used as a database.
401
342
 
402
- ----
403
- $ relaton db create
404
- [relaton-cli] Database is in `/Users/user/.relaton/cache`
405
-
406
- $ relaton db create cachedb
407
- [relaton-cli] Database is in `/Users/user/RubyProjects/relaton-cli/cachedb`
408
- ----
409
-
410
- ==== Move database
343
+ ==== relaton db mv
411
344
 
412
345
  ----
413
346
  $ relaton db mv DIR
414
347
  ----
415
348
 
416
- Move a database to another place `DIR`.
349
+ Move the cache database to a new directory `DIR`.
417
350
 
418
- ----
419
- $ relaton db mv cache_dir
420
- [relaton-cli] Database is moved to `/Users/user/RubyProjects/relaton-cli/cache_dir`
421
- ----
422
-
423
- ==== Clear database
424
-
425
- Delete all entries from a cache DB.
351
+ ==== relaton db clear
426
352
 
427
353
  ----
428
354
  $ relaton db clear
429
355
  ----
430
356
 
431
- ==== Fetch from database
357
+ Delete all entries from the cache database.
358
+
359
+ ==== relaton db fetch
432
360
 
433
361
  ----
434
- $ relaton db fetch -t TYPE -f FORMAT -y YEAR
362
+ $ relaton db fetch CODE -t TYPE -f FORMAT -y YEAR --publication-date-before DATE --publication-date-after DATE
435
363
  ----
436
364
 
437
- Fetch an entry from a database. See [relaton fetch](#relaton-fetch) for the explanation of the arguments.
438
-
439
- ==== Fetch all
365
+ Fetch an entry from the cache database. Arguments are the same as for `relaton fetch`.
440
366
 
441
- Fetch all entries from a cache DB.
367
+ ==== relaton db fetch_all
442
368
 
443
369
  ----
444
370
  $ relaton db fetch_all TEXT -e EDITION -y YEAR -f FORMAT
445
371
  ----
446
372
 
447
- * `TEXT` (optional) search for a certain string
448
- * `EDITION` (optional) filter documents with a certain edition
449
- * `YEAR` (optional) filter documents by a year
450
- * `FORMAT` (optional) specifies the output format. Recognized values are `xml` (default), yaml, `bibtex`.
373
+ Fetch all entries from the cache database.
451
374
 
452
- ----
453
- $ relaton db fetch_all
454
- <bibitem id="ISO/IECDIR1" type="international-standard">
455
- ...
456
-
457
- $ relaton db fetch_all 'Procedures for the technical work'
458
- <bibitem id="ISO/IECDIR1" type="international-standard">
459
- <fetched>2021-04-01</fetched>
460
- <title type="title-main" format="text/plain" language="en" script="Latn">Procedures for the technical work</title>
461
- ...
462
-
463
- $ relaton db fetch_all -e 3
464
- <bibitem id="ISO2146-2010" type="standard">
465
- ...
466
- <edition>3</edition>
467
- ...
468
-
469
- $ relaton db fetch_all -e 8 -y 2018
470
- <bibitem id="ISO/IECDIR2IEC" type="international-standard">
471
- <fetched>2021-04-01</fetched>
472
- <title type="title-main" format="text/plain" language="en" script="Latn">Principles and rules for the structure and drafting of ISO and IEC documents</title>
473
- <uri type="obp">https://www.iec.ch/members_experts/refdocs/iec/isoiecdir2%7Bed8.0.RLV%7Den.pdf</uri>
474
- <docidentifier type="ISO" primary="true">ISO/IEC DIR 2 IEC</docidentifier>
475
- <date type="published">
476
- <on>2018-05-01</on>
477
- </date>
478
- <edition>8</edition>
479
- ...
480
- ----
375
+ * `TEXT` - optional, search for a specific string.
376
+ * `EDITION` - optional, filter documents by edition.
377
+ * `YEAR` - optional, filter documents by year.
378
+ * `FORMAT` - optional output format: `xml` (default), `yaml`, `bibtex`.
481
379
 
482
- ==== Get document type
380
+ ==== relaton db doctype
483
381
 
484
382
  ----
485
383
  $ relaton db doctype REF
486
384
  ----
487
385
 
488
- Takes a reference `REF` and returns a document type.
386
+ Detect and display the document type from reference `REF`.
489
387
 
490
388
  ----
491
389
  $ relaton db doctype 'CN(GB/T 1.1)'
492
390
  Chinese Standard
493
391
  GB/T 1.1
494
392
  ----
393
+
394
+ == Development
395
+
396
+ [source,console]
397
+ ----
398
+ $ bundle install
399
+ $ bundle exec rspec
400
+ $ bundle exec rubocop
401
+ ----
402
+
403
+ == Contributing
404
+
405
+ Open an issue or pull request at https://github.com/relaton/relaton-cli.
406
+
407
+ This gem is developed, maintained, and funded by
408
+ https://www.ribose.com[Ribose Inc.]
409
+
410
+ == License
411
+
412
+ BSD 2-Clause. See link:../LICENSE[LICENSE] for details.