Last modified: 2013-12-04 06:01:04 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 T32930, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30930 - Unwanted change of tabs to spaces on highlighted code makes it completely unaligned
Unwanted change of tabs to spaces on highlighted code makes it completely una...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://secure.wikimedia.org/wikipedi...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-16 13:59 UTC by Helder
Modified: 2013-12-04 06:01 UTC (History)
4 users (show)

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


Attachments

Description Helder 2011-09-16 13:59:32 UTC
The code
<syntaxhighlight lang="javascript" enclose="pre" highlight="2-3">
function doSomething() {
        var     foo,
                bar;
        if (baz) {
</syntaxhighlight>

, which use tabs for indentation, is wrongly rendered as
----
function doSomething() {
     var    foo,
         bar;
    if (baz) {
----
as you can check n the provided url.

This shouldn't happen.
Comment 1 Brion Vibber 2011-09-16 17:35:54 UTC
It looks like the tab->space conversion is done by HTML tidy -- and it's behaving a bit differently on the <pre> as it does on the <span>s? Probably it's resetting its conversion on each element.

Probably the best way to fix this (other than turning off the damn conversion in tidy if we can) is to do our own tab->space conversion before passing things into syntax highlighting.

Though it'd be nicer still to preserve the original tabs I guess... but tidy doesn't seem to want to do that. :P

http://tidy.sourceforge.net/docs/quickref.html#tab-size says "Tidy never outputs tabs". whyyyyyyyyyyyyy
Comment 2 Brion Vibber 2011-09-16 17:54:19 UTC
Done in r97300 -- applying the tab-to-space as a preprocess if tidy is enabled. Will need merge to 1.18 in which case it'll be in with the update deployments in the next couple weeks.
Comment 3 Gerrit Notification Bot 2013-12-02 16:42:01 UTC
Change 98540 had a related patch set uploaded by Anomie:
Protect tabs from HTML Tidy

https://gerrit.wikimedia.org/r/98540
Comment 4 Gerrit Notification Bot 2013-12-02 19:18:03 UTC
Change 98540 merged by jenkins-bot:
Protect tabs from HTML Tidy

https://gerrit.wikimedia.org/r/98540

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


Navigation
Links