Sha256: 74a8891b67c41df7c58fc0d6a1f61651fd369e96d70ed9660e615c33b1a3dba4

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require "isodoc"
require "metanorma-iso"

module IsoDoc
  module Iec
    module BaseConvert
      def boilerplate(node, out)
        # processed in foreword instead
      end

      def foreword(clause, out)
        out.div **attr_code(id: clause["id"]) do |s|
          clause_name(nil, clause.at(ns("./fmt-title")), s,
                      { class: "ForewordTitle" })
          clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
        end
      end

      def bibliography(node, out)
        @is_iev or return super
      end

      def biblio_list(elem, div, biblio)
        @is_iev or return super
        elem.children.each do |b|
          parse(b, div) unless %w(fmt-title bibitem).include? b.name
        end
      end

      def terms_parse(node, out)
        @is_iev or return super
        page_break(out)
        out.div **attr_code(id: node["id"]) do |div|
          depth = clause_title_depth(node, nil)
          out.send "h#{depth}", class: "zzSTDTitle2" do |p|
            p.b do |b|
              node&.at(ns("./fmt-title"))&.children&.each { |c2| parse(c2, b) }
            end
          end
          node.children.reject { |c1| c1.name == "fmt-title" }.each do |c1|
            parse(c1, div)
          end
        end
      end

      def para_class(node)
        case node["class"]
        when "zzSTDTitle1", "zzSTDTitle2" then "zzSTDTitle1"
        else super
        end
      end

      def clause_attrs(node)
        ret = super
        node["type"] == "boilerplate_legal" and ret["class"] = "boilerplate_legal"
        ret
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-iec-2.5.11 lib/isodoc/iec/base_convert.rb
metanorma-iec-2.5.10 lib/isodoc/iec/base_convert.rb
metanorma-iec-2.5.9 lib/isodoc/iec/base_convert.rb
metanorma-iec-2.5.8 lib/isodoc/iec/base_convert.rb