Uses the external xmllint program to check if the content is valid (X)HTML.
Checks the content of context with the xmllint program for validness.
# File lib/webgen/contentprocessor/xmllint.rb, line 12 12: def call(context) 13: error_file = Tempfile.new('webgen-xmllint') 14: error_file.close 15: 16: `xmllint --version 2>&1` 17: if $?.exitstatus != 0 18: raise Webgen::CommandNotFoundError.new('xmllint', self.class.name, context.dest_node) 19: end 20: 21: cmd = "xmllint #{context.website.config['contentprocessor.xmllint.options']} - 2>'#{error_file.path}'" 22: result = IO.popen(cmd, 'r+') do |io| 23: io.write(context.content) 24: io.close_write 25: io.read 26: end 27: if $?.exitstatus != 0 28: File.read(error_file.path).scan(/^-:(\d+):(.*?\n)(.*?\n)/).each do |line, error_msg, line_context| 29: log(:warn) { "xmllint reported problems for <#{context.dest_node}:~#{line}>: #{error_msg.strip} (context: #{line_context.strip})" } 30: end 31: end 32: context 33: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.