Last modified: 2012-05-09 19:08:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38576, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36576 - Update Wikimedia's NOC's highlight.php to not convert tab characters into spaces
Update Wikimedia's NOC's highlight.php to not convert tab characters into spaces
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://noc.wikimedia.org/conf/highlig...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-06 20:36 UTC by Jack Phoenix
Modified: 2012-05-09 19:08 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jack Phoenix 2012-05-06 20:36:36 UTC
Currently highlight.php converts tab characters into spaces, which is not a big deal, but it's somewhat annoying, especially given how the MediaWiki convention is to indent code with tabs instead of spaces.

Compare:

http://noc.wikimedia.org/conf/CommonSettings.php.txt

to:

http://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php

In the very first if() loop on the file, you'll notice that in the original (.txt) version, the three lines are indented with a tab character. However, highlight.php converts the tabs to spaces, because it uses highlight_file() internally.

This is very easy to fix. I fixed it by adding the following line:

$hl = str_replace( '    ', '	', $hl ); // convert 4 spaces to 1 tab character; bug #NNNNN

right after the line:

$hl = str_replace( ' ', ' ', $hl ); // https://bugzilla.wikimedia.org/show_bug.cgi?id=19253
Comment 1 Roan Kattouw 2012-05-09 19:08:49 UTC
Fixed. Bugzilla mangled the tab character, so I changed it to use "\t" instead.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links