Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#2201 closed defect (fixed)

Extra newline at end of code block when using silvercity formatter

Reported by: dcreager@… Owned by: Matthew Good
Priority: normal Milestone:
Component: general Version: 0.9b2
Severity: minor Keywords: silvercity
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When formatting a block of code using the SilverCity formatter, the newline that separates the last line of code from the closing }}} tag is formatted and displayed when it probably shouldn't. For instance,

{{{
#!c
int main(int argc, char** argv)
}}}

renders as

int main(int argc, char** argv)

Note that not every SilverCity renderer shows this problem. (It might only be the C-based syntaxes, I haven't check them all.) For instance, Python works:

{{{
#!python
class Test:
    def __init__(self):
        print "Hello World"
if __name__ == '__main__':
   Test()
}}}
class Test:
    def __init__(self):
        print "Hello World"
if __name__ == '__main__':
   Test()

Attachments (1)

trac-chomp.patch (814 bytes ) - added by dcreager@… 19 years ago.
A possible solution

Download all attachments as: .zip

Change History (5)

by dcreager@…, 19 years ago

Attachment: trac-chomp.patch added

A possible solution

comment:1 by dcreager@…, 19 years ago

The attached patch modifies the Wiki formatting engine to ensure that, before sending any code to a WikiProcessor, a single trailing newline (as defined by the OS) is stripped, if it exists. This causes both the C and Python examples in the ticket description to render correctly.

I chose to modify this in the Wiki formatting engine; an alternative would have been to place it in the SilverCity processor. However, this seemed inappropriate, since the same processor is used for displaying file contents in the source code browser. In the source browser, however, extra newlines actually exist in the file, and should probably be rendered. In the Wiki, however, the extra newline is due to the WikiProcessor syntax.

comment:2 by Emmanuel Blot, 19 years ago

Seems to be related to/duplicate of #1649

comment:3 by Matthew Good, 19 years ago

Owner: changed from Jonas Borgström to Matthew Good
Status: newassigned

Eblot: no, this is a separate issue. SilverCity wraps everything with <span>s, including the "default" style. Trac appears to be removing these unneeded <span>s for the Python formatting, but not with others.

comment:4 by Matthew Good, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [2345].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Matthew Good 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.