Sha256: ba76f3b610246b5588a5a8ad381c44a92b61b3d6c8e63d6d03528e99e1530c89

Contents?: true

Size: 1.15 KB

Versions: 24

Compression:

Stored size: 1.15 KB

Contents

module IsoDoc
  module ITU
    module BaseConvert
      def termdef_parse1(node, div, defn, source)
        div.p **{ class: "TermNum", id: node["id"] } do |p|
          p.b do |b|
            node&.at(ns("./name"))&.children&.each { |n| parse(n, b) }
            insert_tab(b, 1)
            node&.at(ns("./preferred"))&.children&.each { |n| parse(n, b) }
          end
          p << ": "
          source and p << "#{bracket_opt(source.value)} "
        end
        defn and defn.children.each { |n| parse(n, div) }
      end

      def termdef_parse(node, out)
        defn = node.at(ns("./definition"))
        source = node.at(ns("./termsource/origin/@citeas"))
        out.div **attr_code(id: node["id"]) do |div|
          termdef_parse1(node, div, defn, source)
          set_termdomain("")
          node.children.each do |n|
            next if %w(preferred definition termsource title name).include? n.name
            parse(n, out)
          end
        end
      end

      def bracket_opt(b)
        return b if b.nil?
        return b if /^\[.+\]$/.match(b)
        "[#{b}]"
      end

      def termnote_delim
        " &ndash; "
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
metanorma-itu-1.3.13 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.12 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.11 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.10 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.9 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.8 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.7 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.6 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.5 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.4 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.3 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.2 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.1 lib/isodoc/itu/terms.rb
metanorma-itu-1.3.0 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.16 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.15 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.14 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.13 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.12 lib/isodoc/itu/terms.rb
metanorma-itu-1.2.11 lib/isodoc/itu/terms.rb