Sha256: 027baa8dc22a47c85664f1cb8ce09f9cb2e3d7d9a9b14ad245e1f9bbd349daab

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

module IsoDoc
  module Iso
    class WordConvert < IsoDoc::WordConvert

      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 html_doc_path(file)
        File.join(File.dirname(__FILE__), File.join("html", file))
      end

      def initialize(options)
        super
        @wordstylesheet = generate_css(html_doc_path("wordstyle.scss"), false, default_fonts(options))
        @standardstylesheet = generate_css(html_doc_path("isodoc.scss"), false, default_fonts(options))
        @header = html_doc_path("header.html")
        @wordcoverpage = html_doc_path("word_iso_titlepage.html")
        @wordintropage = html_doc_path("word_iso_intro.html")
        @ulstyle = "l3"
        @olstyle = "l2"
      end

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

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

      def colophon(body, docxml)
        body.br **{ clear: "all", style: "page-break-before:left;mso-break-type:section-break" }
        body.div **{ class: "colophon" } do |div|
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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