Class: Metanorma::Iso::Processor
- Inherits:
-
Processor
- Object
- Processor
- Metanorma::Iso::Processor
- Defined in:
- lib/metanorma/iso/processor.rb
Instance Method Summary collapse
-
#document_transformers ⇒ Object
Register the native metanorma-document ISO-STS transformer for the
:isostsleg. - #fonts_manifest ⇒ Object
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
- #output(isodoc_node, inname, outname, format, options = {}) ⇒ Object
- #output_formats ⇒ Object
- #use_presentation_xml(ext) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ Processor
rubocop:disable Lint/MissingSuper
6 7 8 9 10 |
# File 'lib/metanorma/iso/processor.rb', line 6 def initialize # rubocop:disable Lint/MissingSuper @short = :iso @input_format = :asciidoc @asciidoctor_backend = :iso end |
Instance Method Details
#document_transformers ⇒ Object
Register the native metanorma-document ISO-STS transformer for the
:isosts leg. This declaration is inert while the QA gate
(+Metanorma::Iso::Sts.enabled?+) is off: #output intercepts
:isosts with mnconvert and never reaches the base-class driver.
NISO :sts is deliberately absent — it has no metanorma-document
transformer and stays on mnconvert.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/metanorma/iso/processor.rb', line 45 def document_transformers { isosts: { reader: Metanorma::IsoDocument::Root, transformer: Metanorma::Iso::Sts::Transformer::Standard, strip_default_namespace: true, post_process: lambda do |xml, _transformer, | Metanorma::Iso::Sts::Transformer::NbspProcessor.apply_to_text(xml) end, }, } end |
#fonts_manifest ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/metanorma/iso/processor.rb', line 27 def fonts_manifest { "Cambria" => nil, "Cambria Math" => nil, "Times New Roman" => nil, "Source Han Sans" => nil, "Source Han Sans Normal" => nil, "Courier New" => nil, "Inter" => nil, } end |
#output(isodoc_node, inname, outname, format, options = {}) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/metanorma/iso/processor.rb', line 68 def output(isodoc_node, inname, outname, format, = {}) () case format when :html IsoDoc::Iso::HtmlConvert.new() .convert(inname, isodoc_node, nil, outname) when :html_alt IsoDoc::Iso::HtmlConvert.new(.merge(alt: true)) .convert(inname, isodoc_node, nil, outname) when :doc IsoDoc::Iso::WordConvert.new() .convert(inname, isodoc_node, nil, outname) when :pdf IsoDoc::Iso::PdfConvert.new() .convert(inname, isodoc_node, nil, outname) when :sts IsoDoc::Iso::StsConvert.new() .convert(inname, isodoc_node, nil, outname) when :isosts if Metanorma::Iso::Sts.enabled? # native metanorma-document transformer via the base-class # document_transformers driver (QA gate ON) super else # default: mnconvert (QA gate OFF) IsoDoc::Iso::IsoStsConvert.new() .convert(inname, isodoc_node, nil, outname) end when :presentation IsoDoc::Iso::PresentationXMLConvert.new() .convert(inname, isodoc_node, nil, outname) else super end end |
#output_formats ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/metanorma/iso/processor.rb', line 12 def output_formats super.merge( html: "html", html_alt: "alt.html", doc: "doc", pdf: "pdf", sts: "sts.xml", isosts: "iso.sts.xml", ) end |
#use_presentation_xml(ext) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/metanorma/iso/processor.rb', line 58 def use_presentation_xml(ext) # When the native ISO-STS transformer is enabled it consumes semantic # XML (matching mnconvert's input_format: MN); while gated off, keep # the historical presentation-XML routing so mnconvert is unchanged. return false if ext == :isosts && Metanorma::Iso::Sts.enabled? return true if %i[html_alt sts isosts].include?(ext) super end |