Sha256: baa6442b52612af8bbf606a6e40bac9a6166b2a43a26c5a3db038c94c3cbeb3d
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
require "nokogiri" require "jing" module Asciidoctor module RFC::V3 module Validate class << self def validate(doc) # svg_location = File.join(File.dirname(__FILE__), "svg.rng") # schema = Nokogiri::XML::RelaxNG(File.read(File.join(File.dirname(__FILE__), "validate.rng")). # gsub(%r{<ref name="svg"/>}, "<externalRef href='#{svg_location}'/>")) filename = File.join(File.dirname(__FILE__), "validate.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