Sha256: f988d6f145bd50e65ee67d7bfcda40e368c780404b412a030835d9417e7ffc25

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require "isodoc"
require "metanorma-iso"
require_relative "base_convert"
require_relative "init"

module IsoDoc
  module BSI
    class HtmlConvert < IsoDoc::Iso::HtmlConvert
      def initialize(options)
        super
        @libdir = File.dirname(__FILE__)
      end

      # TODO : true font is BSI Gesta, which is a webfont
      def default_fonts(options)
        {
          bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : '"Tahoma",sans-serif'),
          headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Tahoma",sans-serif'),
          monospacefont: '"Courier New",monospace',
          monospacefontsize: "1.0em",
          footnotefontsize: "0.9em",
        }
      end

      def default_file_locations(_options)
        @libdir = File.dirname(__FILE__)
        {
          htmlstylesheet: html_doc_path("htmlstyle.scss"),
          htmlcoverpage: html_doc_path("html_bsi_titlepage.html"),
          htmlintropage: html_doc_path("html_bsi_intro.html"),
        }
      end

      def htmlstyle(docxml)
        ret = super
        b = ret.at("div[@class = 'boilerplate_legal']/ol")
        b and b["type"] = "1"
        ret
      end

      def authority_cleanup(docxml)
        auth = docxml.at("//div[@id = 'boilerplate-feedback' or @class = 'boilerplate-feedback']")
        auth&.remove
        super
      end

      def insert_tab(out, n)
        tab = "&#x2003;"
        [1..n].each { out << tab }
      end

      include BaseConvert
      include Init
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metanorma-bsi-0.0.1 lib/isodoc/bsi/html_convert.rb