Sha256: f96f699b3741aa5a81101d34dfa5425d567c828daa842a4f4d96dba97cc8f9c6
Contents?: true
Size: 927 Bytes
Versions: 18
Compression:
Stored size: 927 Bytes
Contents
# -*- encoding: utf-8 -*- require 'webgen/content_processor' require 'webgen/utils/external_command' module Webgen class ContentProcessor # Uses the external +tidy+ program to format the content as valid (X)HTML. module Tidy # Process the content of +context+ with the +tidy+ program. 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 end end end
Version data entries
18 entries across 18 versions & 1 rubygems