lib/asciidoctor/iso/front.rb in asciidoctor-iso-0.6.0 vs lib/asciidoctor/iso/front.rb in asciidoctor-iso-0.6.1
- old
+ new
@@ -8,11 +8,11 @@
module Asciidoctor
module ISO
module Front
def metadata_id(node, xml)
- xml.id do |i|
+ xml.docidentifier do |i|
i.project_number node.attr("docnumber"),
**attr_code(part: node.attr("partnumber"))
if node.attr("tc-docnumber")
i.tc_document_number node.attr("tc-docnumber")
end
@@ -25,32 +25,45 @@
v.revision_date node.attr("revdate") if node.attr("revdate")
v.draft node.attr("draft") if node.attr("draft")
end
end
+ 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
+
def metadata_author(node, xml)
- xml.creator **{ role: "author" } do |a|
- a.technical_committee node.attr("technical-committee"),
- **attr_code(number: node.attr("technical-committee-number"))
- if node.attr("subcommittee")
- a.subcommittee node.attr("subcommittee"),
- **attr_code(number: node.attr("subcommittee-number"))
+ xml.contributor do |c|
+ c.role **{ type: "author" }
+ c.organization do |a|
+ a.name "ISO"
end
- if node.attr("workgroup")
- a.workgroup node.attr("workgroup"),
- **attr_code(number: node.attr("workgroup-number"))
+ end
+ end
+
+ def metadata_publisher(node, xml)
+ publishers = node.attr("publisher") || "ISO"
+ publishers.split(/,[ ]?/).each do |p|
+ xml.contributor do |c|
+ c.role **{ type: "publisher" }
+ c.organization do |a|
+ a.name p
+ end
end
- a.secretariat node.attr("secretariat") if node.attr("secretariat")
end
end
def metadata_copyright(node, xml)
from = node.attr("copyright-year") || Date.today.year
xml.copyright do |c|
c.from from
- c.owner do |o|
- o.affiliation "ISO"
+ c.owner do |owner|
+ owner.organization do |o|
+ o.name "ISO"
+ end
end
end
end
def metadata_status(node, xml)
@@ -58,29 +71,44 @@
s.stage ( node.attr("docstage") || "60" )
s.substage ( node.attr("docsubstage") || "60" )
end
end
+ def metadata_committee(node, xml)
+ xml.editorialgroup do |a|
+ committee_component("technical-committee", node, a)
+ committee_component("subcommittee", node, a)
+ committee_component("workgroup", node, a)
+ node.attr("secretariat") && a.secretariat(node.attr("secretariat"))
+ end
+ end
+
def metadata(node, xml)
- metadata_status(node, xml)
+ title node, xml
+ metadata_id(node, xml)
metadata_author(node, xml)
+ metadata_publisher(node, xml)
xml.language node.attr("language")
- xml.script "latn"
- xml.type node.attr("doctype")
- metadata_id(node, xml)
- metadata_version(node, xml)
+ xml.script "Latn"
+ metadata_status(node, xml)
metadata_copyright(node, xml)
+ metadata_committee(node, xml)
end
def title(node, xml)
["en", "fr"].each do |lang|
- xml.title **{ language: lang } do |t|
- if node.attr("title-intro-#{lang}")
- t.title_intro { |t1| t1 << node.attr("title-intro-#{lang}") }
+ xml.title do |t|
+ at = { language: lang, format: "text/plain" }
+ node.attr("title-intro-#{lang}") and
+ t.title_intro **attr_code(at) do |t1|
+ t1 << node.attr("title-intro-#{lang}")
end
- t.title_main { |t1| t1 << node.attr("title-main-#{lang}") }
- if node.attr("title-part-#{lang}")
- t.title_part node.attr("title-part-#{lang}")
+ t.title_main **attr_code(at) do |t1|
+ t1 << node.attr("title-main-#{lang}")
+ end
+ node.attr("title-part-#{lang}") and
+ t.title_part **attr_code(at) do |t1|
+ t1 << node.attr("title-part-#{lang}")
end
end
end
end
end