Sha256: 77d0ed1fd391e570582688cf56da61aae87d70452e775f7d8c0fbe171674f00e

Contents?: true

Size: 934 Bytes

Versions: 41

Compression:

Stored size: 934 Bytes

Contents

module Asciidoctor
  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

41 entries across 41 versions & 1 rubygems

Version Path
metanorma-mpfa-0.5.16 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.15 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.14 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.13 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.12 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.11 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.10 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.9 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.8 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.7 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.6 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.5 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.4 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.3 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.2 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.1 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.5.0 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.4.3 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.4.2 lib/asciidoctor/mpfa/validate.rb
metanorma-mpfa-0.4.1 lib/asciidoctor/mpfa/validate.rb