Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

#12803 closed defect (fixed)

Trac wiki should use LF or CRLF rather than os.linesep for generating HTML

Reported by: Jun Omae Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.3
Component: wiki system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

LF is always used as separator when generating HTML rather than using platform-dependent line separator.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Trac wiki uses inconsistently \n and os.linesep to generate HTML. I think the newline in HTML generated from Trac wiki should be independent with newline in platform.

$ git grep '\\n' -- trac/wiki/*.py
trac/wiki/formatter.py:        return Markup('<!--\n%s-->\n' % text)
trac/wiki/formatter.py:            self.out.write('</dd></dl>\n')
trac/wiki/formatter.py:            self.out.write('<blockquote class="citation">\n')
trac/wiki/formatter.py:            self.out.write('</blockquote>\n')
trac/wiki/formatter.py:        out.write('\n')
trac/wiki/formatter.py:                    out.write(whitespace_indent * (2*i) + '<ol>\n' +
trac/wiki/formatter.py:                              whitespace_indent * (2*i+1) + '<li>\n')
trac/wiki/formatter.py:                    out.write(whitespace_indent * (2*i+1) + '</li>\n' +
trac/wiki/formatter.py:                              whitespace_indent * (2*i) + '</ol>\n')
trac/wiki/formatter.py:                out.write(whitespace_indent * (2*depth-1) + '</li>\n' +
trac/wiki/formatter.py:                          whitespace_indent * (2*depth-1) + '<li>\n')
trac/wiki/formatter.py:                out.write( whitespace_indent * (2*depth-1) + '</li>\n' +
trac/wiki/formatter.py:                           whitespace_indent * (2*depth-1) + '<li>\n')
trac/wiki/formatter.py:                      '<a href="#%s">%s</a>\n' % (anchor, text))
trac/wiki/formatter.py:            out.write(whitespace_indent * (2*i+1) + '</li>\n' +
trac/wiki/formatter.py:                      whitespace_indent * (2*i) + '</ol>\n')
trac/wiki/interwiki.py:        for line in content.split('\n'):
trac/wiki/macros.py:                           '\n')
trac/wiki/test.py:                g1 = ["%s\n" % x for x in match.group(1).split(r'\n')]
trac/wiki/test.py:                g2 = ["%s\n" % x for x in match.group(2).split(r'\n')]
trac/wiki/test.py:                wiki = repr(self.input).replace(r'\n', '\n')
trac/wiki/test.py:                    return '\n========== %s: ==========\n%s' % args
trac/wiki/test.py:                '%s\n\n%s:%s: "%s" (%s flavor)' \
trac/wiki/test.py:            if not test or test == '\n':
trac/wiki/test.py:            next_line += len(test.split('\n')) - 1
trac/wiki/test.py:            blocks = test.split('-' * 30 + '\n')
$ git grep 'linesep' -- trac/wiki/*.py
trac/wiki/formatter.py:                self.out.write('<blockquote%s>' % class_attr + os.linesep)
trac/wiki/formatter.py:            self.out.write('</blockquote>' + os.linesep)
trac/wiki/formatter.py:            self.out.write('<table class="wiki">' + os.linesep)
trac/wiki/formatter.py:            self.out.write('</table>' + os.linesep)
trac/wiki/formatter.py:            self.out.write('<p>' + os.linesep)
trac/wiki/formatter.py:            self.out.write('</p>' + os.linesep)
trac/wiki/formatter.py:                code_text = os.linesep.join(self.code_buf)
trac/wiki/formatter.py:                self.out.write('<hr />' + os.linesep)
trac/wiki/formatter.py:            sep = os.linesep
trac/wiki/formatter.py:                            buf.write(' [...]' + os.linesep)
trac/wiki/formatter.py:                buf.write(line + os.linesep)
trac/wiki/formatter.py:        result = buf.getvalue()[:-len(os.linesep)]

Attachments (0)

Change History (3)

comment:1 by Jun Omae, 7 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 7 years ago

Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

Tests pass with the following changes:

comment:3 by Ryan J Ollos, 7 years ago

Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r16287, merged to trunk in r16288.

Modify Ticket

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