Sha256: 2852b71b12296101b97c5bc237c37507618ac1f15eea75e2ef51a153c09208ef

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

module IsoDoc
  module Iso
    class HtmlConvert < IsoDoc::HtmlConvert

      def default_fonts(options)
        b = options[:bodyfont] ||
          (options[:script] == "Hans" ? '"SimSun",serif' :
           '"Cambria",serif')
        h = options[:headerfont] ||
          (options[:script] == "Hans" ? '"SimHei",sans-serif' :
           '"Cambria",serif')
        m = options[:monospacefont] || '"Courier New",monospace'
        "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
      end

      def alt_fonts(options)
        b = options[:bodyfont] ||
          (options[:script] == "Hans" ? '"SimSun",serif' :
           '"Lato",sans-serif')
        h = options[:headerfont] ||
          (options[:script] == "Hans" ? '"SimHei",sans-serif' :
           '"Lato",sans-serif')
        m = options[:monospacefont] || '"Space Mono",monospace'
        "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
      end

      def html_doc_path(file)
        File.join(File.dirname(__FILE__), File.join("html", file))
      end

      def initialize(options)
        super
        if options[:alt]
          css = generate_css(html_doc_path("style-human.scss"), true, alt_fonts(options))
        else
          css = generate_css(html_doc_path("style-iso.scss"), true, default_fonts(options))
        end
        @htmlstylesheet = css
        @htmlcoverpage = html_doc_path("html_iso_titlepage.html")
        @htmlintropage = html_doc_path("html_iso_intro.html")
        @scripts = html_doc_path("scripts.html")
      end

      def implicit_reference(b)
        isocode = b.at(ns("./docidentifier")).text
        isocode == "IEV"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
isodoc-0.8.4 lib/isodoc/iso/html_convert.rb
isodoc-0.8.3 lib/isodoc/iso/html_convert.rb
isodoc-0.8.1 lib/isodoc/iso/html_convert.rb
isodoc-0.8 lib/isodoc/iso/html_convert.rb