Metanorma references IEV as a single source, IEC 60050. In reality, IEC 60050 is dozens of separate documents, each with their own part number (corresponding to the starting number of the clause reference; so IEV clause 101-2-3 is actually IEC 60050-101 clause 101-2-3.) This gem helps rewrite the single IEV reference in a Metanorma document, out into all the references it actually corresponds to in the given document. It does so by parsing all first-level clauses in citations to IEV, replacing each by a reference to the IEC 60050 part corresponding to that clause, then looking up each of the IEC 60050 part documents using
relaton-iec, and inserting those references into the XML document.
Add this line to your application’s Gemfile:
And then execute:
Or install it yourself as:
$ gem install relaton-iev
require 'relaton_iev' bibdb = Relaton::Db.new nil, nil xmldoc = Nokogiri::XML <<~XML_DOC <standard-document> <bibitem type="inline" bibitemid="a" docidentifier="IEC 60050:2011"> <eref citeas="IEC 60050:2011"> <locality type="clause"> <referenceFrom>102-01-01</referenceFrom> </locality> </eref> </bibitem> <sections/> </standard-document> XML_DOC RelatonIev.iev_cleanup(xmldoc, bibdb) => [#<Nokogiri::XML::Element:...
After checking out the repo, run
bin/setup to install dependencies. Then, run
rake spec to run the tests. You can also run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To release a new version, update the version number in
version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to [rubygems.org](https://rubygems.org).
Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-iev.
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).