Sha256: 63eb240979d40ab8738917bb3c9f74b709dc2e591782fb661e1c4c380e92728d

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 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
        @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

7 entries across 7 versions & 1 rubygems

Version Path
metanorma-csd-1.3.23 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.22 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.21 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.20 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.18 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.17 lib/asciidoctor/csd/validate.rb
metanorma-csd-1.3.16 lib/asciidoctor/csd/validate.rb