Sha256: f8a9bafb219d255eb667f5f1dedddb456fcc97b2162c160937cb36d06a48d0ba
Contents?: true
Size: 1.02 KB
Versions: 5
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 "[metanorma-ietf] Validation error: #{e}" end if errors.none? warn "[metanorma-ietf] Validation passed." else errors.each do |error| warn "[metanorma-ietf] #{error[:message]} @ #{error[:line]}:#{error[:column]}" end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems