#1649 closed defect (fixed)
Extra lines w/ Silvercity mime formatting
Reported by: | Emmanuel Blot | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | low | Milestone: | 0.9 |
Component: | wiki system | Version: | devel |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I think there is a trouble with the current SilverCity formatting, as per [1764]
<pre> blocks are appended to the formatted HTML stream, which creates two extra linefeed inside each code-block, i.e. a empty line appears between the code block and the first quoted line, as well as between the last quoted line and the end of the code-block. This does look good.
Removing the two last REs br_re
and span_default_re
, as well as the <pre>
tag in the api.py file helps, but I guess there are here on purpose ;-), and that this trick will break another formatting.
BTW, I think there is a typo with the second <pre>
tag after the code block which should be a </pre>
tag (ending tag instead of opening tag).
Attachments (0)
Change History (9)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
Owner: | changed from | to
---|---|
Priority: | normal → low |
Severity: | normal → minor |
Status: | new → assigned |
comment:3 by , 20 years ago
Hmm, it works correctly here AFAICT. What version of SilverCity are you using, and what kind of file are you trying to display?
comment:4 by , 20 years ago
I tried several file types, such as C and PERL.
(I'm not sure how to get the actual SilverCity release, so) I've just updated to 0.9.5
With the following Wiki sample:
{{{ #!perl use strict; print "Hello World"; }}}
I get the following HTML code:
<div class="code-block"><pre><span class="pl_word">use</span><span class="pl_default"> </span><span class="pl_identifier">strict</span><span class="pl_operator">;</span><span class="pl_default"> </span><span class="pl_word">print</span><span class="pl_default"> </span><span class="pl_string">"Hello World"</span><span class="pl_operator">;</span><span class="pl_default"> </span> <pre></div>
which displays as:
use strict; print "Hello World";
On my computer (WinXP SP1 FireFox 1.0.4), the extra lines appear in this very bug report.
comment:6 by , 19 years ago
Can somebody confirm that the extra lines appear in this very report ?
I can see them w/ MacOS 10.4.2/Safari, as well as Firefox 1.0.6 (both under WinXP SP2 and Mac OsX)
comment:7 by , 19 years ago
I think this is a bug of SilverCity around CRLF issue. I noticed same behaviour on viewing C++ file in source browser. SilverCity seems to generates extra line in some type of line like comment or #include (in C++) with CRLF end-of-lne.
I made a patch for workaround by converting CRLF to LF:
--- silvercity.py (revision 2017) +++ silvercity.py (working copy) @@ -90,6 +90,11 @@ err = "No SilverCity lexer found for mime-type '%s'." % mimetype raise Exception, err + # SilverCity generates extra empty line against some types of + # the line such as comment or #include with CRLF. So we + # standardize to LF end-of-line style before call. + crlf_re = re.compile('\r$', re.MULTILINE) + content = crlf_re.sub('', content) buf = StringIO() generator().generate_html(buf, content)
I'm using Trac r2017 and SilverCity 0.9.5 served on WindowsXP + Apache + mod_python.
comment:8 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Patch applied in [2056]. Thanks!
Typo: I meant "this doesn't look good".