Edgewall Software

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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:
Release Notes:
API Changes:


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 Changed 10 years ago by Emmanuel Blot

Typo: I meant "this doesn't look good".

comment:2 Changed 10 years ago by Christopher Lenz

  • Owner changed from Jonas Borgström to Christopher Lenz
  • Priority changed from normal to low
  • Severity changed from normal to minor
  • Status changed from new to assigned

comment:3 Changed 10 years ago by Christopher Lenz

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 Changed 10 years ago by Emmanuel Blot

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:

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">

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:5 Changed 10 years ago by Emmanuel Blot

This default appears on this page with Firefox 1.0.4, and IE 6.0.2800

comment:6 Changed 10 years ago by Emmanuel Blot

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 Changed 10 years ago by Shun-ichi Goto <gotoh@…>

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 Changed 10 years ago by Christopher Lenz

  • Resolution set to fixed
  • Status changed from assigned to closed

Patch applied in [2056]. Thanks!

comment:9 Changed 10 years ago by Christopher Lenz

testing notification

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.