--- Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/27 17:26:43 180
+++ Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/27 18:18:11 181
@@ -180,25 +180,31 @@
qr/inserting missing 'title' element/,
qr/lacks "summary" attribute/,
] );
- if ( $tidy->parse('html', $html) ) {
- if ( $tidy->messages ) {
- $html .= '
HTML Tidy output:';
- my @lines = split(/[\n\r]+/, $html);
+ my @lines = split( "\n", $html );
+ $_ = "$_\n" for @lines;
+ if ( $tidy->parse('tidy', @lines) ) {
+ if ( $tidy->messages ) {
+ $html .= <<__TIDY_CLOSE__;
+
?
+
+
close
+HTML Tidy output:
+
+__TIDY_CLOSE__
# Escape <, >, & and ", and to produce valid XML
my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
my $escape_re = join '|' => keys %escape;
-
foreach my $m ( $tidy->messages ) {
- my $c = $lines[ ( $m->line - 2 ) ];
+ my $c = $lines[ ( $m->line - 1 ) ];
my $txt = $m->as_string;
$c =~ s/($escape_re)/$escape{$1}/g;
$txt =~ s/($escape_re)/$escape{$1}/g;
my $class = '';
$class = ' class="tidy_'.lc($1).'"' if ($txt =~ /(Warning|Error):/s);
- $html .= "
$txt | $c
";
+ $html .= 'line ' . $m->line . ":
$txt$c";
}
$html .= '
';
}