Sha256: 64e8d2c950ef983401acee88bbcd443932cdc3a651d9cc6f6b3cc1f45d2e4b74

Contents?: true

Size: 1.77 KB

Versions: 10

Compression:

Stored size: 1.77 KB

Contents

require_relative "base_convert"
require "isodoc"

module IsoDoc
  module Generic
    # A {Converter} implementation that generates Word output, and a document
    # schema encapsulation of the document for validation

    class WordConvert < IsoDoc::WordConvert
      def initialize(options)
        @libdir = File.dirname(__FILE__)
        super
      end

      class << self
        attr_accessor :_file
      end

      def self.inherited( k )
        k._file = caller_locations.first.absolute_path
      end

      def default_fonts(options)
        {
          bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : configuration.word_bodyfont || '"Arial",sans-serif'),
          headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :  configuration.word_headerfont ||  '"Arial",sans-serif'),
          monospacefont:  configuration.word_monospacefont ||  '"Courier New",monospace'
        }
      end

      def default_file_locations(options)
        {
          wordstylesheet: baselocation(configuration.wordstylesheet) ||
            html_doc_path("wordstyle.scss"),
          standardstylesheet: baselocation(configuration.standardstylesheet) ||
            html_doc_path("generic.scss"),
          header: baselocation(configuration.header) ||
            html_doc_path("header.html"),
          wordcoverpage: baselocation(configuration.wordcoverpage) ||
            html_doc_path("word_generic_titlepage.html"),
          wordintropage: baselocation(configuration.wordintropage) ||
            html_doc_path("word_generic_intro.html"),
          i18nyaml: baselocation(configuration.i18nyaml),
          ulstyle: "l3",
          olstyle: "l2",
        }
      end

      def configuration
        Metanorma::Generic.configuration
      end

      include BaseConvert
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/metanorma-generic-1.5.1/lib/isodoc/generic/word_convert.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/metanorma-generic-1.5.1/lib/isodoc/generic/word_convert.rb
metanorma-generic-1.5.1 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.5.0 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.10 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.9 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.8 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.7 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.6 lib/isodoc/generic/word_convert.rb
metanorma-generic-1.4.5 lib/isodoc/generic/word_convert.rb