Class: IsoDoc::M3d::Metadata

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(lang, script, labels) ⇒ Metadata

Returns a new instance of Metadata.



8
9
10
11
12
13
14
15
# File 'lib/isodoc/m3d/metadata.rb', line 8

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

Instance Method Details

#author(isoxml, _out) ⇒ Object



26
27
28
29
30
31
# File 'lib/isodoc/m3d/metadata.rb', line 26

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

#docid(isoxml, _out) ⇒ Object



33
34
35
36
# File 'lib/isodoc/m3d/metadata.rb', line 33

def docid(isoxml, _out)
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
  set(:docnumber, docnumber&.text)
end

#stage_abbr(status) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/isodoc/m3d/metadata.rb', line 38

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



22
23
24
# File 'lib/isodoc/m3d/metadata.rb', line 22

def subtitle(_isoxml, _out)
  nil
end

#title(isoxml, _out) ⇒ Object



17
18
19
20
# File 'lib/isodoc/m3d/metadata.rb', line 17

def title(isoxml, _out)
  main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
  set(:doctitle, main)
end

#unpublished(status) ⇒ Object



48
49
50
# File 'lib/isodoc/m3d/metadata.rb', line 48

def unpublished(status)
  !%w(published withdrawn).include? status.downcase
end