lib/asciidoctor/nist/converter.rb in metanorma-nist-0.1.4 vs lib/asciidoctor/nist/converter.rb in metanorma-nist-0.1.5

- old
+ new

@@ -14,11 +14,12 @@ class Converter < Standoc::Converter register_for "nist" def example(node) - return pseudocode_example(node) if node.attr("style") == "pseudocode" + role = node.role || node.attr("style") + return pseudocode_example(node) if role == "pseudocode" super end def pseudocode_example(node) noko do |xml| @@ -29,11 +30,12 @@ end end.join("\n") end def table(node) - return errata(node) if node.attr("style") == "errata" + role = node.role || node.attr("style") + return errata(node) if role == "errata" super end def errata1(node) cols = [] @@ -66,11 +68,12 @@ end end end def dlist(node) - return glossary(node) if node.attr("style") == "glossary" + role = node.role || node.attr("style") + return glossary(node) if role == "glossary" super end def glossary(node) noko do |xml| @@ -143,13 +146,13 @@ @files_to_delete.each { |f| FileUtils.rm f } ret end def clause_parse(attrs, xml, node) - attrs[:preface] = true if node.attr("style") == "preface" - attrs[:executivesummary] = true if node.attr("style") == - "executive-summary" + role = node.role || node.attr("style") + attrs[:preface] = true if role == "preface" + attrs[:executivesummary] = true if role == "executive-summary" super end def acknowledgements_parse(attrs, xml, node) xml.acknowledgements **attr_code(attrs) do |xml_section| @@ -172,10 +175,10 @@ def style(n, t) return end def section(node) - a = { id: Asciidoctor::Standoc::Utils::anchor_or_uuid(node) } + a = section_attributes(node) noko do |xml| case sectiontype(node) #when "normative references" then norm_ref_parse(a, xml, node) when "glossary", "terminology" if node.attr("style") == "appendix" && node.level == 1