Sha256: ea3869fb43573d74a95990926aeb92e59f6bf2e211b9f0f69c290e7930bab70c
Contents?: true
Size: 783 Bytes
Versions: 5
Compression:
Stored size: 783 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 "[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