Sha256: 5997b975ce0da45f3a8976729d3467f5184805e4489f2745ba393bc1ec1b98f0
Contents?: true
Size: 786 Bytes
Versions: 6
Compression:
Stored size: 786 Bytes
Contents
require "nokogiri" require "jing" module Asciidoctor module RFC::V2 module Validate class << self def validate(doc) filename = File.join(File.dirname(__FILE__), "validate2.rng") schema = Jing.new(filename) File.open(".tmp.xml", "w") { |f| f.write(doc.to_xml) } begin errors = schema.validate(".tmp.xml") rescue Jing::Error => e abort "[asciidoctor-rfc] Validation error: #{e}" end if errors.none? warn "[asciidoctor-rfc] Validation passed." else errors.each do |error| warn "[asciidoctor-rfc] #{error[:message]} @ #{error[:line]}:#{error[:column]}" end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems