class IsoDoc::Csa::Metadata
A {Converter} implementation that generates CSA output, and a document schema encapsulation of the document for validation
Public Instance Methods
auth_roles(isoxml, persons)
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 52 def auth_roles(isoxml, persons) roles = isoxml.xpath(ns("//bibdata/contributor[person]/"\ "role[@type = 'author']/description")). inject([]) { |m, t| m << t.text } roles.uniq.sort.each do |r| n = isoxml.xpath( ns("//bibdata/contributor[role/@type = 'author']"\ "[xmlns:role/description = '#{r}']/person")) n.empty? or persons[r] = extract_person_names_affiliations(n) end persons end
configuration()
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 10 def configuration Metanorma::Csa.configuration end
docid(isoxml, _out)
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 30 def docid(isoxml, _out) docnumber = isoxml.at(ns("//bibdata/docidentifier[@type = 'csa']")) set(:docnumber, docnumber&.text) end
nonauth_roles(isoxml, persons)
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 41 def nonauth_roles(isoxml, persons) roles = isoxml.xpath(ns("//bibdata/contributor[person]/role/@type")). inject([]) { |m, t| m << t.value }.reject { |i| i == "author" } roles.uniq.sort.each do |r| n = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\ "/person")) n.empty? or persons[r] = extract_person_names_affiliations(n) end persons end
subtitle(_isoxml, _out)
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 19 def subtitle(_isoxml, _out) nil end
title(isoxml, _out)
click to toggle source
# File lib/isodoc/csa/metadata.rb, line 14 def title(isoxml, _out) main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text set(:doctitle, main) end