Skip to content


Repository files navigation

RelatonIev Refactor IEV reference

Gem Version Build Status Code Climate Pull Requests Commits since latest

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:

gem 'relaton-iev'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-iev


require 'relaton_iev'

bibdb = nil, nil
xmldoc = Nokogiri::XML <<~XML_DOC
        <bibitem type="inline" bibitemid="a" docidentifier="IEC 60050:2011">
          <eref citeas="IEC 60050:2011">
            <locality type="clause">
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 [](


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the [MIT License](