class IsoDoc::Sample::Metadata

Constants

MONTHS

Public Class Methods

new(lang, script, labels) click to toggle source
Calls superclass method
# File lib/isodoc/sample/metadata.rb, line 7
def initialize(lang, script, labels)
  super
  set(:status, "XXX")
end

Public Instance Methods

author(isoxml, _out) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 21
def author(isoxml, _out)
  tc = isoxml.at(ns("//editorialgroup/committee"))
  set(:tc, tc.text) if tc
end
docid(isoxml, _out) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 26
def docid(isoxml, _out)
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
  docstatus = isoxml.at(ns("//bibdata/status"))
  dn = docnumber&.text
  if docstatus
    set(:status, status_print(docstatus.text))
    abbr = status_abbr(docstatus.text)
    dn = "#{dn}(#{abbr})" unless abbr.empty?
  end
  set(:docnumber, dn)
end
monthyr(isodate) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 73
def monthyr(isodate)
  m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
  return isodate unless m && m[:yr] && m[:mo]
  return "#{MONTHS[m[:mo].to_sym]} #{m[:yr]}"
end
security(isoxml, _out) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 79
def security(isoxml, _out)
  security = isoxml.at(ns("//bibdata/security")) || return
  set(:security, security.text)
end
status_abbr(status) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 42
def status_abbr(status)
  case status
  when "working-draft" then "wd"
  when "committee-draft" then "cd"
  when "draft-standard" then "d"
  else
    ""
  end
end
status_print(status) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 38
def status_print(status)
  status.split(/-/).map{ |w| w.capitalize }.join(" ")
end
subtitle(_isoxml, _out) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 17
def subtitle(_isoxml, _out)
  nil
end
title(isoxml, _out) click to toggle source
# File lib/isodoc/sample/metadata.rb, line 12
def title(isoxml, _out)
  main = isoxml&.at(ns("//title[@language='en']"))&.text
  set(:doctitle, main)
end
version(isoxml, _out) click to toggle source
Calls superclass method
# File lib/isodoc/sample/metadata.rb, line 52
def version(isoxml, _out)
  super
  revdate = get[:revdate]
  set(:revdate_monthyear, monthyr(revdate))
end