Sha256: b4c61cbf34b1eb954bbe8b275d4c6232b7e187965cf9f2870d437181c1b4a3ee

Contents?: true

Size: 1.18 KB

Versions: 57

Compression:

Stored size: 1.18 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&.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(text)
        return text if text.nil?
        return text if /^\[.+\]$/.match?(text)

        "[#{text}]"
      end

      def termnote_delim
        " &#x2013; "
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
metanorma-itu-2.5.4 lib/isodoc/itu/terms.rb
metanorma-itu-2.5.3 lib/isodoc/itu/terms.rb
metanorma-itu-2.5.2 lib/isodoc/itu/terms.rb
metanorma-itu-2.5.1 lib/isodoc/itu/terms.rb
metanorma-itu-2.5.0 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.13 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.12 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.11 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.9 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.8 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.7 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.6 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.5 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.4 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.3 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.2 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.1 lib/isodoc/itu/terms.rb
metanorma-itu-2.4.0 lib/isodoc/itu/terms.rb
metanorma-itu-2.3.7 lib/isodoc/itu/terms.rb
metanorma-itu-2.3.6 lib/isodoc/itu/terms.rb