Sha256: c24624700e89ad9d83724b7b2155b1579eec378f967f92c309890b8662c1e6d5

Contents?: true

Size: 914 Bytes

Versions: 18

Compression:

Stored size: 914 Bytes

Contents

module Asciidoctor
  module Mpfd
    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
          warn "Document Attributes: #{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
          warn "Document Attributes: #{stage} is not a recognised status"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
metanorma-mpfd-0.3.14 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.13 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.11 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.10 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.9 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.8 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.7 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.6 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.5 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.4 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.3 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.2 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.1 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.3.0 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.2.3 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.2.2 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.2.1 lib/asciidoctor/mpfd/validate.rb
metanorma-mpfd-0.2.0 lib/asciidoctor/mpfd/validate.rb