[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Uneven spacing in menu comment in HTML output
From: |
Gavin Smith |
Subject: |
Re: Uneven spacing in menu comment in HTML output |
Date: |
Mon, 4 Jan 2016 21:42:53 +0000 |
On 4 January 2016 at 20:13, Gavin Smith <address@hidden> wrote:
> , which has three newlines between the opening <pre> tag and the
> closing </pre> tag. I suspect, however, that the first one,
> immediately after <pre>, is being ignored.
>
> Any clues what the correct way to stop the first newline from being
> ignored is? I've looked for documentation online about the HTML <pre>
> tag, but nothing I've seen so far addresses this point.
According to http://www.w3.org/MarkUp/html3/literal.html
Line breaks within the text are rendered as a move to the beginning of
the next line. The exceptions are line breaks immediately following
the starting PRE tag or immediately preceding the ending PRE tag,
which should be ignored.
I think the following is the right fix:
Index: HTML.pm
===================================================================
--- HTML.pm (revision 6919)
+++ HTML.pm (working copy)
@@ -3703,6 +3703,7 @@ sub _convert_preformatted_type($$$$)
if ($self->in_string()) {
return $content;
}
+ $content =~ s/^\n/\n\n/;
my $result = $self->_attribute_class('pre',
$pre_class).">".$content."</pre>";
# this may happen with lines without textual content
I don't think that trailing newlines are a problem: that means that
aaa</pre>
and
aaa
</pre>
are equivalent, and there isn't an empty line after the "aaa".