Sha256: 8739529db5efe3d027c4b99b0dbb3ed5d1891690a596ef24a514a163c0f37a31

Contents?: true

Size: 1.6 KB

Versions: 20

Compression:

Stored size: 1.6 KB

Contents

require_relative "base_convert"
require "isodoc"

module IsoDoc
  module Csd
    # A {Converter} implementation that generates CSD output, and a document
    # schema encapsulation of the document for validation
    class HtmlConvert < IsoDoc::HtmlConvert
      def initialize(options)
        @libdir = File.dirname(__FILE__)
        super
      end

      def default_fonts(options)
        {
          bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
          headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
          monospacefont: '"Space Mono",monospace'
        }
      end

      def default_file_locations(options)
        {
          htmlstylesheet: html_doc_path("htmlstyle.scss"),
          htmlcoverpage: html_doc_path("html_csd_titlepage.html"),
          htmlintropage: html_doc_path("html_csd_intro.html"),
          scripts: html_doc_path("scripts.html"),
        }
      end

      def googlefonts()
        <<~HEAD.freeze
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
        HEAD
      end

      def make_body(xml, docxml)
        body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
        xml.body **body_attr do |body|
          make_body1(body, docxml)
          make_body2(body, docxml)
          make_body3(body, docxml)
        end
      end

      include BaseConvert
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
metanorma-csd-1.3.20 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.18 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.17 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.16 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.15 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.14 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.13 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.12 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.11 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.10 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.9 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.8 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.7 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.6 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.5 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.4 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.3 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.2 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.1 lib/isodoc/csd/html_convert.rb
metanorma-csd-1.3.0 lib/isodoc/csd/html_convert.rb