class IsoDoc::Ogc::Metadata
Public Class Methods
new(lang, script, i18n)
click to toggle source
Calls superclass method
# File lib/isodoc/ogc/metadata.rb, line 37 def initialize(lang, script, i18n) super here = File.dirname(__FILE__) set(:logo_word, File.expand_path(File.join(here, "html", "logo.png"))) end
Public Instance Methods
docid(isoxml, _out)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 65 def docid(isoxml, _out) set(:docnumber, isoxml&.at(ns("//bibdata/docidentifier"\ "[@type = 'ogc-internal']"))&.text) set(:externalid, isoxml&.at(ns("//bibdata/docidentifier"\ "[@type = 'ogc-external']"))&.text) end
docsubtype_abbr(subtype, _type)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 110 def docsubtype_abbr(subtype, _type) IsoDoc::Ogc::DOCSUBTYPE_ABBR[subtype] || st end
doctype(isoxml, _out)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 95 def doctype(isoxml, _out) if t = isoxml&.at(ns("//bibdata/ext/doctype"))&.text set(:doctype, type_capitalise(t)) set(:doctype_abbr, doctype_abbr(t)) if st = isoxml&.at(ns("//bibdata/ext/subdoctype"))&.text set(:docsubtype, type_capitalise(st)) set(:docsubtype_abbr, docsubtype_abbr(st, t)) end end end
doctype_abbr(type)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 106 def doctype_abbr(type) IsoDoc::Ogc::DOCTYPE_ABBR[type] || type end
status_print(status)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 114 def status_print(status) type_capitalise(status) end
subtitle(_isoxml, _out)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 49 def subtitle(_isoxml, _out) nil end
title(isoxml, _out)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 44 def title(isoxml, _out) main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text set(:doctitle, main) end
type_capitalise(type)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 89 def type_capitalise(type) type.split(/[- ]/).map do |w| %w(SWG).include?(w) ? w : w.capitalize end.join(" ") end
unpublished(status)
click to toggle source
# File lib/isodoc/ogc/metadata.rb, line 72 def unpublished(status) !%w(approved deprecated retired).include?(status.downcase) end
url(xml, _out)
click to toggle source
Calls superclass method
# File lib/isodoc/ogc/metadata.rb, line 83 def url(xml, _out) super a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and set(:previousuri, a.text) end
version(isoxml, _out)
click to toggle source
Calls superclass method
# File lib/isodoc/ogc/metadata.rb, line 76 def version(isoxml, _out) super set(:edition, isoxml&.at(ns("//bibdata/edition"))&.text) lg = ISO_639.find_by_code(isoxml&.at(ns("//bibdata/language"))&.text) set(:doclanguage, lg ? lg[3] : "English") end