Sha256: 3644e035a39304427f4c8c61ea9a652b460b72c599b807f6c88f21c738048e29

Contents?: true

Size: 1.18 KB

Versions: 18

Compression:

Stored size: 1.18 KB

Contents

module Metanorma
  module Standoc
    module Blocks
      def reqt_subpart?(name)
        @reqt_model&.reqt_subpart?(name)
      end

      def requirement_subpart(node)
        @reqt_model.requirement_subpart(node, keep_attrs(node))
      end

      def default_requirement_model
        :default
      end

      def select_requirement_model(node)
        return if @reqt_model

        @reqt_model_name = node.attr("model") || @default_requirement_model
        @reqt_model = @reqt_models.model(@reqt_model_name)
      end

      def requirement(node, obligation, type)
        nested = @reqt_model
        !node.attr("type") &&
          !%w(requirement recommendation permission).include?(type) and
          node.set_attr("type", type)
        attrs = keep_attrs(node).merge(id_unnum_attrs(node))
          .merge(model: @reqt_model_name)
        ret = @reqt_model.requirement(node, obligation, attrs)
        @reqt_model = nil unless nested
        ret
      end

      def requirement_validate(docxml)
        docxml.xpath("//requirement | //recommendation | //permission")
          .each do |r|
          @reqt_models.model(r["model"]).validate(r, @log)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
metanorma-standoc-2.10.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.10 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.9 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.8 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.7 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.6 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.4 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.8 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.7 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.6 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.4 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.3.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.2.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.2.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.2.2 lib/metanorma/standoc/reqt.rb