Class: IsoDoc::CC::Metadata

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

Instance Method Summary collapse

Constructor Details

#initialize(lang, script, locale, labels) ⇒ Metadata

Returns a new instance of Metadata.



11
12
13
14
# File 'lib/isodoc/cc/metadata.rb', line 11

def initialize(lang, script, locale, labels)
  super
  set(:tc, "XXXX")
end

Instance Method Details

#author(isoxml, _out) ⇒ Object



25
26
27
28
29
# File 'lib/isodoc/cc/metadata.rb', line 25

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

#configurationObject



7
8
9
# File 'lib/isodoc/cc/metadata.rb', line 7

def configuration
  Metanorma::CC.configuration
end

#personal_authors(isoxml) ⇒ Object



31
32
33
34
# File 'lib/isodoc/cc/metadata.rb', line 31

def personal_authors(isoxml)
  set(:roles_authors_affiliations, roles_authors_affiliations(isoxml))
  super
end

#roles_authors_affiliations(isoxml) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/isodoc/cc/metadata.rb', line 36

def roles_authors_affiliations(isoxml)
  isoxml.xpath(ns("//bibdata/contributor/role/@type"))
    .inject([]) { |m, t| m << t.value }
    .uniq.sort.each_with_object({}) do |r, m|
    names = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\
                            "/person"))
    names.empty? or m[r] = extract_person_names_affiliations(names)
  end
end

#subtitle(_isoxml, _out) ⇒ Object



21
22
23
# File 'lib/isodoc/cc/metadata.rb', line 21

def subtitle(_isoxml, _out)
  nil
end

#title(isoxml, _out) ⇒ Object



16
17
18
19
# File 'lib/isodoc/cc/metadata.rb', line 16

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