require "htmlentities" require "uri" module Asciidoctor module ISO class Converter < Standoc::Converter def section(node) a = section_attributes(node) noko do |xml| case sectiontype(node) when "introduction" then introduction_parse(a, xml, node) when "patent notice" then patent_notice_parse(xml, node) when "scope" then scope_parse(a, xml, node) when "normative references" then norm_ref_parse(a, xml, node) when "terms and definitions", "terms, definitions, symbols and abbreviated terms", "terms, definitions, symbols and abbreviations", "terms, definitions and symbols", "terms, definitions and abbreviations", "terms, definitions and abbreviated terms" @term_def = true term_def_parse(a, xml, node, true) @term_def = false when "symbols and abbreviated terms", "abbreviations", "abbreviated terms", "symbols" symbols_parse(a, xml, node) when "bibliography" then bibliography_parse(a, xml, node) else if @term_def then term_def_subclause_parse(a, xml, node) elsif @biblio then bibliography_parse(a, xml, node) elsif node.attr("style") == "bibliography" bibliography_parse(a, xml, node) elsif node.attr("style") == "appendix" && node.level == 1 annex_parse(a, xml, node) elsif node.option? "appendix" appendix_parse(a, xml, node) else clause_parse(a, xml, node) end end end.join("\n") end def appendix_parse(attrs, xml, node) attrs["inline-header".to_sym] = node.option? "inline-header" set_obligation(attrs, node) xml.appendix **attr_code(attrs) do |xml_section| xml_section.title { |name| name << node.title } xml_section << node.content end end def patent_notice_parse(xml, node) # xml.patent_notice do |xml_section| # xml_section << node.content # end xml << node.content end def scope_parse(attrs, xml, node) xml.clause **attr_code(attrs) do |xml_section| xml_section.title { |t| t << "Scope" } content = node.content xml_section << content end end end end end