class IsoDoc::Csd::Metadata

A {Converter} implementation that generates CSD output, and a document schema encapsulation of the document for validation

Public Class Methods

new(lang, script, labels) click to toggle source
Calls superclass method
# File lib/isodoc/csd/metadata.rb, line 10
def initialize(lang, script, labels)
  super
  set(:tc, "XXXX")
end

Public Instance Methods

author(isoxml, _out) click to toggle source
Calls superclass method
# File lib/isodoc/csd/metadata.rb, line 24
def author(isoxml, _out)
  tc = isoxml.at(ns("//bibdata/ext/editorialgroup/technical-committee"))
  set(:tc, tc.text) if tc
  super
end
docid(isoxml, _out) click to toggle source
# File lib/isodoc/csd/metadata.rb, line 43
def docid(isoxml, _out)
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
  prefix = "CC"
  if docnumber.nil?
    set(:docnumber, prefix)
  else
    set(:docnumber, docnumber.text)
  end
end
personal_authors(isoxml) click to toggle source
Calls superclass method
# File lib/isodoc/csd/metadata.rb, line 30
def personal_authors(isoxml)
  persons = {}
  roles = isoxml.xpath(ns("//bibdata/contributor/role/@type")).
    inject([]) { |m, t| m << t.value }
  roles.uniq.sort.each do |r|
    names = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\
                              "/person"))
    persons[r] = extract_person_names_affiliations(names) unless names.empty?
  end
  set(:roles_authors_affiliations, persons)
  super
end
stage_abbr(status) click to toggle source
# File lib/isodoc/csd/metadata.rb, line 53
def stage_abbr(status)
  ::Metanorma::Csd::DOCSTATUS[status] || ""
end
subtitle(_isoxml, _out) click to toggle source
# File lib/isodoc/csd/metadata.rb, line 20
def subtitle(_isoxml, _out)
  nil
end
title(isoxml, _out) click to toggle source
# File lib/isodoc/csd/metadata.rb, line 15
def title(isoxml, _out)
  main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
  set(:doctitle, main)
end
unpublished(status) click to toggle source
# File lib/isodoc/csd/metadata.rb, line 57
def unpublished(status)
  !%w(published withdrawn).include? status.downcase
end