Class: IsoDoc::Ietf::Metadata

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

Constant Summary collapse

TITLE_RFC =
"//bibdata//title[@type='main' and @language='en']".freeze

Instance Method Summary collapse

Instance Method Details

#areas(isoxml, _out) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/isodoc/ietf/metadata.rb', line 22

def areas(isoxml, _out)
  ret = []
  isoxml.xpath(ns("//bibdata/ext/area")).each do |kw|
    ret << kw.text
  end
  set(:areas, ret)
end

#author(xml, _out) ⇒ Object



35
36
37
38
# File 'lib/isodoc/ietf/metadata.rb', line 35

def author(xml, _out)
  super
  wg(xml)
end

#docid(isoxml, _out) ⇒ Object



30
31
32
33
# File 'lib/isodoc/ietf/metadata.rb', line 30

def docid(isoxml, _out)
  dn = isoxml.at(ns("//bibdata/docnumber"))
  set(:docnumber, dn&.text&.sub(/^rfc-/, "")&.sub(/\.[a-z0-9]+$/i, ""))
end

#doctype(isoxml, _out) ⇒ Object



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

def doctype(isoxml, _out)
  super
  set(:doctype, "Rfc") if get[:doctype].nil?
end

#relaton_relationsObject



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

def relaton_relations
  %w(included-in described-by derived-from instance-of)
  # = item describedby convertedfrom alternate
end

#title(isoxml, _out) ⇒ Object



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

def title(isoxml, _out)
  t =  isoxml.at(ns(TITLE_RFC)) and
    set(:doctitle, t.text)
  t =  isoxml.at(ns(TITLE_RFC.sub(/main/, "abbrev"))) and
    set(:docabbrev, t.text)
  t =  isoxml.at(ns(TITLE_RFC.sub(/main/, "ascii"))) and
    set(:docascii, t.text)
end

#wg(xml) ⇒ Object



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

def wg(xml)
  workgroups = []
  xml.xpath(ns("//bibdata/ext/editorialgroup/workgroup")).each do |wg|
    workgroups << wg.text
  end
  set(:wg, workgroups)
end