Sha256: 5d9f12b962ab65eccd87f244a10d90b239d4a293c4a612a148e08470b41614ce
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
require "asciidoctor" require "asciidoctor/standoc/converter" require "fileutils" module Asciidoctor module CC class Converter < Standoc::Converter def default_publisher "CalConnect" end def metadata_committee(node, xml) return unless node.attr("technical-committee") xml.editorialgroup do |a| a.technical_committee node.attr("technical-committee"), **attr_code(type: node.attr("technical-committee-type")) i = 2 while node.attr("technical-committee_#{i}") do a.technical_committee node.attr("technical-committee_#{i}"), **attr_code(type: node.attr("technical-committee-type_#{i}")) i += 1 end end end def metadata_status(node, xml) status = node.attr("status") unless status && ::Metanorma::CC::DOCSTATUS.keys.include?(status) @log.add("Document Attributes", nil, "#{status} is not a legal status") end super end def prefix_id(node) prefix = "CC" typesuffix = ::Metanorma::CC::DOCSUFFIX[node.attr("doctype")] || "" prefix += "/#{typesuffix}" unless typesuffix.empty? status = ::Metanorma::CC::DOCSTATUS[node.attr("status")] || "" prefix += "/#{status}" unless status.empty? prefix end def metadata_id(node, xml) id = node.attr("docnumber") || "???" prefix = prefix_id(node) id = "#{prefix} #{id}" year = node.attr("copyright-year") id += ":#{year}" if year xml.docidentifier id, **{type: "CalConnect"} xml.docnumber node.attr("docnumber") end def doctype(node) d = node.attr("doctype") unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d) @log.add("Document Attributes", nil, "#{d} is not a legal document type: reverting to 'standard'") d = "standard" end d end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
metanorma-cc-1.5.1 | lib/asciidoctor/cc/front.rb |