#870 First tab character inside <pre/> not handled correctly

open
nobody
5
2013-12-02
2008-02-02
cujyaz
No

The first tab character in a preformatted paragraph
will be converted to a wrong number of spaces if it
is on the same line as the <pre> start tag.

The tab-to-space converting algorithm seems to
calculate the position of the tab stops accordingly
to the source text instead of the contents of the
<pre/> element.

Example ("{tab}" represents a tab character):

<pre>1{tab}a{tab}a{tab}a
2{tab}b{tab}b{tab}b
3{tab}c{tab}c{tab}c</pre>

causes this output:

<pre>
1 a a a
2 b b b
3 c c c
4 d d d
5 e e e
</pre>

Also see this bug of MediaWiki:
http://bugzilla.wikimedia.org/show_bug.cgi?id=12751

Discussion

  • Brad Jorsch
    Brad Jorsch
    2013-12-02

    Since whitespace is significant inside

    , IMO Tidy should not be touching it at all. So I'd say the bug here is that Tidy is mangling tab characters inside 
     tags, not that it's converting them to the wrong number of spaces.