lib/asciidoctor/iso/front.rb in asciidoctor-iso-0.6.1 vs lib/asciidoctor/iso/front.rb in asciidoctor-iso-0.7.0
- old
+ new
@@ -8,13 +8,14 @@
module Asciidoctor
module ISO
module Front
def metadata_id(node, xml)
+ part, subpart = node&.attr("partnumber")&.split(/-/)
xml.docidentifier do |i|
i.project_number node.attr("docnumber"),
- **attr_code(part: node.attr("partnumber"))
+ **attr_code(part: part, subpart: subpart)
if node.attr("tc-docnumber")
i.tc_document_number node.attr("tc-docnumber")
end
end
end
@@ -31,11 +32,11 @@
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)
+ def metadata_author(_node, xml)
xml.contributor do |c|
c.role **{ type: "author" }
c.organization do |a|
a.name "ISO"
end
@@ -66,12 +67,12 @@
end
end
def metadata_status(node, xml)
xml.status do |s|
- s.stage ( node.attr("docstage") || "60" )
- s.substage ( node.attr("docsubstage") || "60" )
+ s.stage (node.attr("docstage") || "60")
+ s.substage (node.attr("docsubstage") || "60")
end
end
def metadata_committee(node, xml)
xml.editorialgroup do |a|
@@ -86,30 +87,42 @@
title node, xml
metadata_id(node, xml)
metadata_author(node, xml)
metadata_publisher(node, xml)
xml.language node.attr("language")
- xml.script "Latn"
+ xml.script (node.attr("script") || "Latn")
metadata_status(node, xml)
metadata_copyright(node, xml)
metadata_committee(node, xml)
end
+ def title_intro(node, t, lang, at)
+ return unless node.attr("title-intro-#{lang}")
+ t.title_intro(**attr_code(at)) do |t1|
+ t1 << node.attr("title-intro-#{lang}")
+ end
+ end
+
+ def title_main(node, t, lang, at)
+ t.title_main **attr_code(at) do |t1|
+ t1 << node.attr("title-main-#{lang}")
+ end
+ end
+
+ def title_part(node, t, lang, at)
+ return unless node.attr("title-part-#{lang}")
+ t.title_part(**attr_code(at)) do |t1|
+ t1 << node.attr("title-part-#{lang}")
+ end
+ end
+
def title(node, xml)
["en", "fr"].each do |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 **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
+ title_intro(node, t, lang, at)
+ title_main(node, t, lang, at)
+ title_part(node, t, lang, at)
end
end
end
end
end