Sha256: d5a4481e75f374ad8d561cd7d4c7eeab179bb9243071cf39333015194074bca2

Contents?: true

Size: 915 Bytes

Versions: 20

Compression:

Stored size: 915 Bytes

Contents

module Asciidoctor
  module Csd
    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(directive guide specification standard report administrative amendment
        technical-corrigendum advisory).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

20 entries across 20 versions & 1 rubygems

Version Path
metanorma-csd-1.3.15 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.14 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.13 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.12 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.11 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.10 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.9 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.8 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.7 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.6 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.5 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.4 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.3 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.2 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.1 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.0 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.2.3 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.2.2 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.2.1 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.2.0 lib/asciidoctor/csd/validate.rb