Sha256: c8a31463d6c03ab78f975954f061441c83ade80775157197f6f5e47e55088962

Contents?: true

Size: 1.19 KB

Versions: 18

Compression:

Stored size: 1.19 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_with_object([]) do |r, m|
          @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.9.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.9.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.11 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.10 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.9 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.8 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.7 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.6 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.4 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.8.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.7.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.7.4 lib/metanorma/standoc/reqt.rb