Sha256: 7ed0a16ae3f4b3715149997d8efea48d1b1e7da740594854e83f0083d502ab9c

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

require_relative "init"
require "isodoc"

module IsoDoc
  module Iec
    class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
      def clause(docxml)
        docxml.xpath(ns("//clause[not(ancestor::annex)] | "\
                        "//definitions | //references | "\
                        "//preface/introduction[clause]")).
        each do |f|
          clause1(f)
        end
        docxml.xpath(ns("//terms")).each do |f|
          termclause1(f)
        end
      end

      def termclause1(f)
        return clause1(f) unless @is_iev
        return if @suppressheadingnumbers || f["unnumbered"]
        lbl = @xrefs.anchor(f['id'], :label, true) or return
        prefix_name(f, " ", "#{lbl}#{clausedelim}", "title")
      end

      def clause1(f)
        IsoDoc::PresentationXMLConvert.instance_method(:clause1).bind(self).
          call(f)
      end

      def bibdata_i18n(b)
        fr = IsoDoc::Iec::I18n.new("fr", "Latn")
        en = IsoDoc::Iec::I18n.new("en", "Latn")
        [{ lang: "en", i18n: en }, { lang: "fr", i18n: fr }].each do |v|
          hash_translate(b, v[:i18n].get["doctype_dict"], "./ext/doctype", v[:lang])
          hash_translate(b, v[:i18n].get["stage_dict"], "./status/stage", v[:lang])
          hash_translate(b, v[:i18n].get["substage_dict"], "./status/substage", v[:lang])
          hash_translate(b, v[:i18n].get["function_dict"], "./ext/function", v[:lang])
          hash_translate(b, v[:i18n].get["horizontal_dict"], "./ext/horizontal", v[:lang])
        end
      end

      include Init
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
metanorma-iec-1.3.4 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.3.3 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.3.2 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.3.1 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.3.0 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.17 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.16 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.15 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.14 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.13 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.12 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.11 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.10 lib/isodoc/iec/presentation_xml_convert.rb
metanorma-iec-1.2.9 lib/isodoc/iec/presentation_xml_convert.rb