lib/asciidoctor/cc/front.rb in metanorma-cc-1.5.1 vs lib/asciidoctor/cc/front.rb in metanorma-cc-1.5.2

- old
+ new

@@ -31,11 +31,11 @@ super end def prefix_id(node) prefix = "CC" - typesuffix = ::Metanorma::CC::DOCSUFFIX[node.attr("doctype")] || "" + typesuffix = ::Metanorma::CC::DOCSUFFIX[doctype(node)] || "" prefix += "/#{typesuffix}" unless typesuffix.empty? status = ::Metanorma::CC::DOCSTATUS[node.attr("status")] || "" prefix += "/#{status}" unless status.empty? prefix end @@ -48,14 +48,17 @@ id += ":#{year}" if year xml.docidentifier id, **{type: "CalConnect"} xml.docnumber node.attr("docnumber") end + @log_doctype = false + def doctype(node) - d = node.attr("doctype") - unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d) + d = super + unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d) && !@log_doctype @log.add("Document Attributes", nil, "#{d} is not a legal document type: reverting to 'standard'") + @log_doctype = true d = "standard" end d end end