Class: IsoDoc::Sample::Metadata

Inherits:
Metadata
  • Object
show all
Defined in:
lib/isodoc/sample/metadata.rb

Constant Summary collapse

MONTHS =
{
  "01": "January",
  "02": "February",
  "03": "March",
  "04": "April",
  "05": "May",
  "06": "June",
  "07": "July",
  "08": "August",
  "09": "September",
  "10": "October",
  "11": "November",
  "12": "December",
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(lang, script, labels) ⇒ Metadata

Returns a new instance of Metadata.



7
8
9
10
11
# File 'lib/isodoc/sample/metadata.rb', line 7

def initialize(lang, script, labels)
  super
  here = File.dirname(__FILE__)
  set(:logo, File.expand_path(File.join(here, "html", "logo.jpg")))
end

Instance Method Details

#author(isoxml, _out) ⇒ Object



13
14
15
16
# File 'lib/isodoc/sample/metadata.rb', line 13

def author(isoxml, _out)
  tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
  set(:tc, tc.text) if tc
end

#monthyr(isodate) ⇒ Object



49
50
51
52
53
# File 'lib/isodoc/sample/metadata.rb', line 49

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) ⇒ Object



55
56
57
58
# File 'lib/isodoc/sample/metadata.rb', line 55

def security(isoxml, _out)
  security = isoxml.at(ns("//bibdata/ext/security")) || return
  set(:security, security.text)
end

#status_abbr(status) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/isodoc/sample/metadata.rb', line 18

def status_abbr(status)
  case status
  when "working-draft" then "wd"
  when "committee-draft" then "cd"
  when "draft-standard" then "d"
  else
    ""
  end
end

#version(isoxml, _out) ⇒ Object



28
29
30
31
32
# File 'lib/isodoc/sample/metadata.rb', line 28

def version(isoxml, _out)
  super
  revdate = get[:revdate]
  set(:revdate_monthyear, monthyr(revdate))
end