Module: Asciidoctor::Standoc::Front

Included in:
Converter
Defined in:
lib/asciidoctor/standoc/front.rb

Instance Method Summary collapse

Instance Method Details

#asciidoc_sub(x) ⇒ Object



104
105
106
107
108
109
# File 'lib/asciidoctor/standoc/front.rb', line 104

def asciidoc_sub(x)
  return nil if x.nil?
  d = Asciidoctor::Document.new(x.lines.entries, {header_footer: false})
  b = d.parse.blocks.first
  b.apply_subs(b.source)
end

#committee_component(compname, node, out) ⇒ Object



28
29
30
31
32
# File 'lib/asciidoctor/standoc/front.rb', line 28

def committee_component(compname, node, out)
  out.send compname.gsub(/-/, "_"), node.attr(compname),
    **attr_code(number: node.attr("#{compname}-number"),
                type: node.attr("#{compname}-type"))
end

#metadata(node, xml) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/asciidoctor/standoc/front.rb', line 91

def (node, xml)
  title node, xml
  (node, xml)
  (node, xml)
  (node, xml)
  xml.language (node.attr("language") || "en")
  xml.script (node.attr("script") || "Latn")
  (node, xml)
  (node, xml)
  (node, xml)
  (node, xml)
end

#metadata_author(node, xml) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/asciidoctor/standoc/front.rb', line 38

def (node, xml)
  publishers = node.attr("publisher") || return
  publishers.split(/,[ ]?/).each do |p|
    xml.contributor do |c|
      c.role **{ type: "author" }
      c.organization { |a| organization(a, p) }
    end
  end
end

#metadata_committee(node, xml) ⇒ Object



76
77
78
79
80
# File 'lib/asciidoctor/standoc/front.rb', line 76

def (node, xml)
  xml.editorialgroup do |a|
    committee_component("technical-committee", node, a)
  end
end


58
59
60
61
62
63
64
65
66
67
68
# File 'lib/asciidoctor/standoc/front.rb', line 58

def (node, xml)
  publishers = node.attr("publisher") || " "
  publishers.split(/,[ ]?/).each do |p|
    xml.copyright do |c|
      c.from (node.attr("copyright-year") || Date.today.year)
      p.match(/[A-Za-z]/).nil? or c.owner do |owner|
        owner.organization { |o| organization(o, p) }
      end
    end
  end
end

#metadata_ics(node, xml) ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/asciidoctor/standoc/front.rb', line 82

def (node, xml)
  ics = node.attr("library-ics")
  ics && ics.split(/,\s*/).each do |i|
    xml.ics do |ics|
      ics.code i
    end
  end
end

#metadata_id(node, xml) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/asciidoctor/standoc/front.rb', line 12

def (node, xml)
  part, subpart = node&.attr("partnumber")&.split(/-/)
  xml.docidentifier do |i|
    i.project_number node.attr("docnumber"),
      **attr_code(part: part, subpart: subpart)
  end
end

#metadata_publisher(node, xml) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/asciidoctor/standoc/front.rb', line 48

def (node, xml)
  publishers = node.attr("publisher") || return
  publishers.split(/,[ ]?/).each do |p|
    xml.contributor do |c|
      c.role **{ type: "publisher" }
      c.organization { |a| organization(a, p) }
    end
  end
end

#metadata_status(node, xml) ⇒ Object



70
71
72
73
74
# File 'lib/asciidoctor/standoc/front.rb', line 70

def (node, xml)
  xml.status(**{ format: "plain" }) do |s|
    s << ( node.attr("status") || "published" )
  end
end

#metadata_version(node, xml) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/asciidoctor/standoc/front.rb', line 20

def (node, xml)
  xml.version do |v|
    v.edition node.attr("edition") if node.attr("edition")
    v.revision_date node.attr("revdate") if node.attr("revdate")
    v.draft node.attr("draft") if node.attr("draft")
  end
end

#organization(org, orgname) ⇒ Object



34
35
36
# File 'lib/asciidoctor/standoc/front.rb', line 34

def organization(org, orgname)
    org.name orgname
end

#title(node, xml) ⇒ Object



111
112
113
114
115
116
117
118
# File 'lib/asciidoctor/standoc/front.rb', line 111

def title(node, xml)
  ["en"].each do |lang|
    at = { language: lang, format: "text/plain" }
    xml.title **attr_code(at) do |t|
      t << asciidoc_sub(node.attr("title"))
    end
  end
end