Sha256: d5a0ec381320ddc4350503c164d11f5614e29d5d9fb06bffa6114d1d890c8704

Contents?: true

Size: 932 Bytes

Versions: 12

Compression:

Stored size: 932 Bytes

Contents

module Metanorma
  module MPFA
    class Converter < Standoc::Converter
      def content_validate(doc)
        super
        bibdata_validate(doc.root)
      end

      def bibdata_validate(doc)
        doctype_validate(doc)
        stage_validate(doc)
      end

      def doctype_validate(xmldoc)
        doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
        %w(policy-and-procedures best-practices supporting-document
        report legal directives proposal standard).include? doctype or
        @log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
      end

      def stage_validate(xmldoc)
        stage = xmldoc&.at("//bibdata/status/stage")&.text
        %w(proposal working-draft committee-draft draft-standard final-draft
        published withdrawn).include? stage or
        @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
metanorma-mpfa-0.9.2 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.9.1 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.9.0 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.8 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.7 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.6 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.5 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.4 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.3 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.2 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.1 lib/metanorma/mpfa/validate.rb
metanorma-mpfa-0.8.0 lib/metanorma/mpfa/validate.rb