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: | 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)
Change History (5)
by , 19 years ago
Attachment: | trac-chomp.patch added |
---|
comment:1 by , 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:3 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
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.
A possible solution