Sha256: 648f1e63fd6b2a6c948442c63cca84ecf91eb4786f0aa7ea50d08398b677cb25
Contents?: true
Size: 1.78 KB
Versions: 40
Compression:
Stored size: 1.78 KB
Contents
require "metanorma/processor" module Metanorma module Gb class Processor < Metanorma::Processor def initialize @short = :gb @input_format = :asciidoc @asciidoctor_backend = :gb end def output_formats super.merge( html: "html", compliant_html: "compliant.html", doc: "doc" ) end def version "Metanorma::Gb #{Metanorma::Gb::VERSION}" end def input_to_isodoc(file, filename) Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend) end def extract_options(file) head = file.sub(/\n\n.*$/m, "\n") /\n:standard-logo-img: (?<standardlogoimg>[^\n]+)\n/ =~ head /\n:standard-class-img: (?<standardclassimg>[^\n]+)\n/ =~ head /\n:standard-issuer-img: (?<standardissuerimg>[^\n]+)\n/ =~ head /\n:title-font: (?<titlefont>[^\n]+)\n/ =~ head new_options = { standardlogoimg: defined?(standardlogoimg) ? standardlogoimg : nil, standardclassimg: defined?(standardclassimg) ? standardclassimg : nil, standardissuerimg: defined?(standardissuerimg) ? standardissuerimg : nil, titlefont: defined?(titlefont) ? titlefont : nil, }.reject { |_, val| val.nil? } super.merge(new_options) end def output(isodoc_node, outname, format, options={}) case format when :html IsoDoc::Gb::HtmlConvert.new(options).convert(outname, isodoc_node) when :compliant_html IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(outname, isodoc_node) when :doc IsoDoc::Gb::WordConvert.new(options).convert(outname, isodoc_node) else super end end end end end
Version data entries
40 entries across 40 versions & 1 rubygems