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



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

def author(isoxml, _out)
  tc = isoxml.at(ns("//bibdata/contributor[role/@type = 'author']" \
    "[role/description = 'committee']/organization/subdivision" \
    "[@type = 'Technical committee']/name"))
  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



34
35
36
37
# File 'lib/isodoc/cc/metadata.rb', line 34

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

#roles_authors_affiliations(isoxml) ⇒ Object



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

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



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

def subtitle(_isoxml, _out)
  nil
end

#title(isoxml, _out) ⇒ Object



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

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