Module: Webgen::ContentProcessor::Tidy
- Defined in:
- lib/webgen/content_processor/tidy.rb
Overview
Uses the external tidy
program to format the content as valid (X)HTML.
Class Method Summary collapse
-
.call(context) ⇒ Object
Process the content of
context
with thetidy
program.
Class Method Details
.call(context) ⇒ Object
Process the content of context
with the tidy
program.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/webgen/content_processor/tidy.rb', line 13 def self.call(context) Webgen::Utils::ExternalCommand.ensure_available!('tidy', '-v') cmd = "tidy -q #{context.website.config['content_processor.tidy.options']}" status, stdout, stderr = systemu(cmd, 'stdin' => context.content) if status.exitstatus != 0 stderr.split(/\n/).each do |line| context.website.logger.send(status.exitstatus == 1 ? :warn : :error) do "Tidy reported problems for <#{context.dest_node.alcn}>: #{line}" end end end context.content = stdout context end |