lib/asciidoctor/csd/converter.rb in asciidoctor-csd-0.2.4 vs lib/asciidoctor/csd/converter.rb in asciidoctor-csd-0.2.5

- old
+ new

@@ -1,8 +1,8 @@ require "asciidoctor" require "asciidoctor/csd/version" -require "asciidoctor/csd/csdconvert" +require "isodoc/csd/csdconvert" require "asciidoctor/iso/converter" module Asciidoctor module Csd CSD_NAMESPACE = "https://www.calconnect.org/standards/csd" @@ -81,10 +81,19 @@ validate(ret1) ret1.root.add_namespace(nil, CSD_NAMESPACE) ret1 end + def doctype(node) + d = node.attr("doctype") + unless %w{presentation code proposal standard report}.include? d + warn "#{d} is not a legal document type: reverting to 'standard'" + d = "standard" + end + d + end + def document(node) init(node) ret1 = makexml(node) ret = ret1.to_xml(indent: 2) filename = node.attr("docfile").gsub(/\.adoc/, ".xml"). @@ -123,28 +132,19 @@ def style(n, t) return end - def html_converter(_node) - CsdConvert.new( - htmlstylesheet: generate_css(html_doc_path("htmlstyle.scss"), true), - standardstylesheet: generate_css(html_doc_path("csd.scss"), true), - htmlcoverpage: html_doc_path("html_csd_titlepage.html"), - htmlintropage: html_doc_path("html_csd_intro.html"), - scripts: html_doc_path("scripts.html"), + def html_converter(node) + IsoDoc::Csd::Convert.new( + script: node.attr("script"), + bodyfont: node.attr("body-font"), + headerfont: node.attr("header-font"), + monospacefont: node.attr("monospace-font"), + titlefont: node.attr("title-font"), + i18nyaml: node.attr("i18nyaml"), + scope: node.attr("scope"), ) - end - - def default_fonts(node) - b = node.attr("body-font") || - (node.attr("script") == "Hans" ? '"SimSun",serif' : - '"Overpass",sans-serif') - h = node.attr("header-font") || - (node.attr("script") == "Hans" ? '"SimHei",sans-serif' : - '"Overpass",sans-serif') - m = node.attr("monospace-font") || '"Space Mono",monospace' - "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n" end def inline_quoted(node) noko do |xml| case node.type