CLI for the Relaton bibliographic information repository
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Add the `relaton split` interface Feb 16, 2019
docs
exe prioritise published/circulated date; closes #14 Nov 1, 2018
lib/relaton Add option to ignore existing files Feb 17, 2019
spec Add option to ignore existing files Feb 17, 2019
templates
.gitignore
.hound.yml Rubocop Nov 11, 2018
.rubocop.yml
.travis.yml
Gemfile Initial commit. Sep 27, 2018
LICENSE
Rakefile Initial commit. Sep 27, 2018
i18n.yaml Initial commit. Sep 27, 2018
relaton-cli.gemspec Remove bundler gem as dev dependency Feb 3, 2019

README.adoc

Relaton CLI (relaton-cli): Relaton Command-line Interface

Gem Version Build Status Code Climate

Documentation in development.

Executables

The following executables are included:

relaton concatenate

$ relaton concatenate Source-Directory Collection-File -t TITLE -g ORGANIZATION

Iterates through all the Relaton YAML files in Source-Directory, and converts them in-place into Relaton XML.

Iterates through all the Relaton XML files in Source-Directory (including those just converted from Relaton YAML), and outputs to Collection-File a relaton-collection document containing all the Relaton XML objects read in.

For each Relaton XML file, if a document file with the same base name is identified (i.e. an XML, HTML, PDF or DOC file), a link to that file is inserted.

If the TITLE or ORGANIZATION options are given, they are added to the Collection-File output as the title and author of the relaton-collection document.

relaton split

$ relaton split Collection-File Relaton-File-Directory -x rxl

Splits a Relaton-Collection-File into multiple files in the Relaton-File-Directory, and it also suports an addional extension options to use different extension.

relaton fetch

$ relaton fetch CODE -t TYPE -y YEAR

Fetch the Relaton XML entry corresponding to the document identifier CODE.

  • YEAR is optional, and specifies the year of publication of the standard.

  • TYPE specifies the standards class library to be used, that the identifier is part of; the recognised values for TYPE are isobib, ietfbib, iecbib, gbbib.

relaton extract

$ relaton extract Metanorma-XML-Directory Relaton-XML-Directory -x EXTENSION

Iterate through all the Metanorma XML files in Metanorma-XML-Directory, and extract the bibdata element from each. Save the bibdata element for each file 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 name of the file; otherwise, the original file name is used. The filename is suffixed with EXTENSION; by default, .rxl is used.

relaton xml2html

$ relaton xml2html <relaton-xml> [<stylesheet>] [<html-template-dir>]

Render a Relaton Collection XML as an HTML file. Used to generate an HTML index of standards.

  • relaton-xml is the Relaton Collection XML file.

  • stylesheet is the CSS stylesheet to be used to style the output. For the CSS styling of each bibliographic element, see below.

  • html-template-dir is a directory containing HTML Liquid Template files into which the bibliographic entries are to be inserted. There are two templates necessary:

    • Index template (index.liquid)

      • The HTML Template file _index.liquid recognises the following parameters:

      • css: where the CSS stylesheet stylesheet is injected

      • title: the Title of the collection, ./relaton-collection/title in relaton-xml

      • author: the Author of the collection, ./relaton-collection/contributor[role/@type = 'author']/organization/name in relaton-xml

      • content: the list of resources generated by the script

    • Individual bibliographic entries template (_document.liquid)

      • This template recognises attributes of a bibliographic entry (document) which follow the naming convention of Relaton YAML; e.g. document.html is the HTML URI for the document.

The default stylesheet and templates are given (which also demonstrates the structure) in the templates directory.

Sample HTML output for a bibliographic entry:

<div class="document">
  <div class="doc-line">
    <div class="doc-identifier">
      <h2>
        <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.html">CC/R 3101</a>
      </h2>
    </div>
    <div class="doc-type-wrap">
      <div class="doc-type report">report</div>
    </div>
  </div>
  <div class="doc-title">
    <h3>
      <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>
    </h3>
  </div>
  <div class="doc-info cancelled">
    <div class="doc-stage cancelled">cancelled</div>
    <div class="doc-dates">
      <div class="doc-updated">2019-10-17</div>
    </div>
  </div>
  <div class="doc-bib">
    <div class="doc-bib-relaton">
      <a href="csd/cc-r-3101.xml">Relaton XML</a>
    </div>
  </div>
  <div class="doc-access">
    <div class="doc-access-button-html">
      <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.html">HTML</a>
    </div>
    <div class="doc-access-button-pdf">
      <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.pdf">PDF</a>
    </div>
    <div class="doc-access-button-doc">
      <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.doc">Word</a>
    </div>
    <div class="doc-access-button-xml">
      <a href="http://calconnect.org/pubdocs/CD0507%20CalDAV%20Use%20Cases%20V1.0.xml">XML</a>
    </div>
  </div>
</div>

relaton yaml2xml

$ relaton yaml2xml YAML -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LIBRARY

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.

A Relaton Colleciton YAML file contains some initial metadata, and a list of metadata about each bibliographic entry. A Relaton YAML file describing an individual bibliographic entry is limited to metadata specific to that entry. The following illustrates the fields supported:

htmlstylesheet: ./index-style.css
root:
  title: CalConnect Standards Registry
  author: "CalConnect: The Calendaring and Scheduling Consortium"
  items:
    - technical_committee: TC VCARD
      docidentifier: 18001
      doctype: standard
      title: "Date and time -- Representations for information interchange -- Part 1: Basic rules"
      stage: Published
      revdate: 2018-10-17
      xml: standards/csd-datetime-explict/csd-datetime-explict.xml
      html: standards/csd-datetime-explict/csd-datetime-explict.html
      pdf: standards/csd-datetime-explict/csd-datetime-explict.pdf
      doc: standards/csd-datetime-explict/csd-datetime-explict.doc
      relaton: standards/csd-datetime-explict/cc-18001.xml
    - technical_committee: TC PUBLISH
      docidentifier: 10001
      doctype: governance
      title: "Standardization and publication"
      stage: proposal
      revdate: 2018-10-17
      uri: standards/csd-standardization/csd-standardization.xml
      agency: CalConnect
      language: en
      script: Latn
      edition: 1

relaton xml2yaml

$ relaton xml2yaml XML -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LIBRARY

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.

relaton yaml2html

$ relaton yaml2xml Relaton-YAML [<stylesheet>] [<liquid-template-dir>]

Render a Relaton YAML file as an HTML file. The stylesheet and liquid-template-dir directories are as for relaton xml2html.