Sha256: b2a80ed2a5f7c28a2967fb57a84d1b049b96da9306b5b5a6a401fa65ee5a501d

Contents?: true

Size: 1.18 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
metanorma-itu-2.5.6 lib/isodoc/itu/terms.rb
metanorma-itu-2.5.5 lib/isodoc/itu/terms.rb