Sha256: d6d1208c866631912b05e9fad74b10ba7b67c3c1126036125e30e14d3d9e4675

Contents?: true

Size: 1.62 KB

Versions: 40

Compression:

Stored size: 1.62 KB

Contents

require "htmlentities"
require "uri" if /^2\./.match?(RUBY_VERSION)

module Metanorma
  module ISO
    class Converter < Standoc::Converter
      def clause_parse(attrs, xml, node)
        node.option? "appendix" and return appendix_parse(attrs, xml, node)
        super
      end

      def scope_parse(attrs, xml, node)
        attrs = attrs.merge(type: "scope") unless @amd
        clause_parse(attrs, xml, node)
      end

      def appendix_parse(attrs, xml, node)
        attrs[:"inline-header"] = node.option? "inline-header"
        set_obligation(attrs, node)
        xml.appendix **attr_code(attrs) do |xml_section|
          xml_section.title { |name| name << node.title }
          xml_section << node.content
        end
      end

      def patent_notice_parse(xml, node)
        # xml.patent_notice do |xml_section|
        #  xml_section << node.content
        # end
        xml << node.content
      end

      def sectiontype(node, level = true)
        return nil if @amd

        ret = sectiontype_streamline(sectiontype1(node))
        return ret if ret == "terms and definitions" && @vocab

        super
      end

      def term_def_subclause_parse(attrs, xml, node)
        node.role == "term" and
          return term_def_subclause_parse1(attrs, xml, node)
        super
      end

      # in ISO, term has subterm, unless
      # there is no definition to the term (subclauses start immediately),
      # or it is labelled as "grouping"
      def term_contains_subclauses(node)
        !node.sections? and return false
        node.level != node.blocks[0].level ||
          node.role == "grouping"
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
metanorma-iso-2.8.7 lib/metanorma/iso/section.rb
metanorma-iso-2.8.6 lib/metanorma/iso/section.rb
metanorma-iso-2.8.5 lib/metanorma/iso/section.rb
metanorma-iso-2.8.4 lib/metanorma/iso/section.rb
metanorma-iso-2.8.3 lib/metanorma/iso/section.rb
metanorma-iso-2.8.2 lib/metanorma/iso/section.rb
metanorma-iso-2.8.1 lib/metanorma/iso/section.rb
metanorma-iso-2.8.0 lib/metanorma/iso/section.rb
metanorma-iso-2.7.10 lib/metanorma/iso/section.rb
metanorma-iso-2.7.9 lib/metanorma/iso/section.rb
metanorma-iso-2.7.8 lib/metanorma/iso/section.rb
metanorma-iso-2.7.7 lib/metanorma/iso/section.rb
metanorma-iso-2.7.6 lib/metanorma/iso/section.rb
metanorma-iso-2.7.5 lib/metanorma/iso/section.rb
metanorma-iso-2.7.4 lib/metanorma/iso/section.rb
metanorma-iso-2.7.3 lib/metanorma/iso/section.rb
metanorma-iso-2.7.2 lib/metanorma/iso/section.rb
metanorma-iso-2.7.1 lib/metanorma/iso/section.rb
metanorma-iso-2.7.0 lib/metanorma/iso/section.rb
metanorma-iso-2.6.4 lib/metanorma/iso/section.rb