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.2.1 lib/isodoc/itu/terms.rb
metanorma-itu-2.2.0 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.13 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.12 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.11 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.10 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.9 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.8.1 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.8 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.7 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.6 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.5.1 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.5 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.4 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.3 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.2 lib/isodoc/itu/terms.rb
metanorma-itu-2.1.1 lib/isodoc/itu/terms.rb