Page MenuHomePhabricator

Allow pre tag be indented as source can be
Closed, DuplicatePublic


Insert following two examples to some wikipage and compare the outputs:
Example 1

:: Hi
::: Would you take a look on this code?

Example 2

:: Hi
::: Would you take a look on this code?

As you can see, the source tag is correctly indented, but the pre tag isn't. This behavior looks like a bug. If this behavior is intensional, then it should be reconsidered.

Currently there are some templates (like this one on cswiki) used as a hack to indent pre tag somehow, but it is not ideal.

Event Timeline

Dvorapa created this task.May 3 2017, 4:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 3 2017, 4:26 PM
Arlolra added a subscriber: Arlolra.

This can probably be closed as a duplicate of T3115

What's happening is,

> echo -e ":<pre>\nhi\n</pre>" | php maintenance/parse.php

and then,

echo -e ":<pre>\nhi\n</pre>" | php maintenance/parse.php --tidy

The reason this works for <source> is because in doBlockLevels() extension tag content hasn't been replaced yet and so it all exists on a single line as a replacement token.

The same is true for the other pseudo-extension tag, <gallery>, as for <pre>.

> echo -e ":<gallery>\nhi\n</gallery>" | php maintenance/parse.php --tidy
<ul class="gallery mw-gallery-traditional"></ul>
<div style="width: 155px">
<div class="thumb" style="height: 150px;">Hi</div>
<div class="gallerytext"></div>

Note that Parsoid gives you what you want here,

> echo -e ":<pre>\nhi\n</pre>" | node bin/parse --normalize
Arlolra triaged this task as Low priority.Jul 18 2017, 10:07 PM