class IsoDoc::MPFA::Metadata
Public Class Methods
new(lang, script, labels)
click to toggle source
Calls superclass method
# File lib/isodoc/mpfa/metadata.rb, line 8 def initialize(lang, script, labels) super here = File.dirname(__FILE__) set(:logo, File.expand_path(File.join(here, "html", "mpfa-logo-no-text@4x.png"))) end
Public Instance Methods
docid(isoxml, _out)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 29 def docid(isoxml, _out) docnumber = isoxml.at(ns("//bibdata/docidentifier")) set(:docnumber, docnumber&.text) end
doctype(isoxml, _out)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 34 def doctype(isoxml, _out) b = isoxml&.at(ns("//bibdata/ext/doctype"))&.text or return t = b.split(/[- ]/) .map { |w| w.capitalize unless w == "MPF" }.join(" ") set(:doctype, t) end
monthyr(isodate)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 65 def monthyr(isodate) date = DateTime.parse(isodate) date.strftime("%-d %B %Y") #=> "Sun 04 Feb 2001" rescue StandardError # invalid dates get thrown isodate end
stage_abbr(status)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 42 def stage_abbr(status) case status when "working-draft" then "wd" when "committee-draft" then "cd" when "draft-standard" then "d" else "" end end
subtitle(_isoxml, _out)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 20 def subtitle(_isoxml, _out) nil end
title(isoxml, _out)
click to toggle source
# File lib/isodoc/mpfa/metadata.rb, line 15 def title(isoxml, _out) main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text set(:doctitle, main) end
version(isoxml, _out)
click to toggle source
Calls superclass method
# File lib/isodoc/mpfa/metadata.rb, line 52 def version(isoxml, _out) super edition = isoxml.at(ns("//bibdata/version/edition")) if edition set( :edition, edition.text.to_i.localize .to_rbnf_s("SpelloutRules", "spellout-ordinal") .split(/(\W)/).map(&:capitalize).join, ) end end