Page MenuHomePhabricator

multiple template use leads to wrong output
Closed, ResolvedPublic

Assigned To
None
Authored By
bzimport
May 7 2005, 5:05 AM
Referenced Files
F2031: testcase_2094.txt
Nov 21 2014, 8:29 PM
F2030: patch_2094_Parser_REL14.txt
Nov 21 2014, 8:29 PM
F2029: patch_2094_Parser_HEAD.txt
Nov 21 2014, 8:29 PM

Description

Author: gangleri

Description:
Halló!

At
http://jadesukka.homelinux.org:8180/betawiki/Betawiki:Rendering_of_templetes_01
the '''same template''' renders differently.

As you can see the first template is rendered "''properly''" both

  1. at the top of http://jadesukka.homelinux.org:8180/betawiki/%E7%84%A1
  2. at the bottom of

http://jadesukka.homelinux.org:8180/betawiki/Mu_%E2%80%93_W%C3%BA/Mou

at the bottom of

http://jadesukka.homelinux.org:8180/betawiki/Mu_%E2%80%93_W%C3%BA/Mou_%28from_Wikipedia%29
(that page is also using another template and renders '''both''' properly)

More complex examples are described at
http://jadesukka.homelinux.org:8180/betawiki/Betawiki:Users
and
http://jadesukka.homelinux.org:8180/betawiki/Betawiki:Users_%28fix%29

THERE

The pages in the "'''''(fix)''''' set" are using an additional colomn

"'''''width=1px'''''".

  1. This behaviour is known to me seince begining of version 1.4.
  2. It seams to me that extra lines are inserted depending on
    1. repetitiv calls of the same template
    2. the number of extra lines depends if enumeration lists or tables are usef
    3. in the later case it seems that some overflow occurs because the number

depends on the content of the last cell

Regards Reinhardt [[user:gangleri


Version: 1.5.x
Severity: normal
URL: http://jadesukka.homelinux.org:8180/betawiki/Betawiki:Rendering_of_templetes_01

Details

Reference
bz2094

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:29 PM
bzimport set Reference to bz2094.
bzimport added a subscriber: Unknown Object (MLST).

Michael.Keppler wrote:

patch for HEAD

The problem is located in the code for the template cache table. When a
template is used multiple times on the same page, then the following happens,
when the template is first parsed:
a) The output text is set to the article content.
b) The line start (anything before the template pattern) is prepended to the
text.
c) The text is stored in the template cache.
As one can see, the prepending of the line start happens too early as the line
start of the first template occurence will be used as content of the second
template occurence this way (and the linestart variable contains a linebreak in
the example of this bug).

So we need to reorder c) and b). The attached patch does just this. The
linestart of the template is only prepended to the output after the cache has
been stored.

Attached:

Michael.Keppler wrote:

changed title to better describe the problem

Michael.Keppler wrote:

*** Bug 2116 has been marked as a duplicate of this bug. ***

Michael.Keppler wrote:

patch for REL14

same patch for REL14 as for HEAD

Attached:

gangleri wrote:

Feedback:

Thanks Michael for your attachment. It is active at
http://jadesukka.homelinux.org:8180/betawiki/

http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Betawiki:Rendering_of_templetes_01&action=purge
LOOKS GREAT!

What I experienced with:
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Betawiki:Users&action=purge
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Betawiki:Users_%28fix%29&action=purge
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Betawiki:Users_%28alternate%29&action=purge
With some efforts ALL are FIXED.

There is a problem with Windows XP Mozilla Firefox and Java:

When I hit two times return and (make a preview | click on a Java button in the
Romanian interface to generate special characters) ONLY ONE line ( is inserted |
WILL "SURVIVE" ). Most of the time I avoid this inserting some new lines and
deleting them after just counting the number of new lines I REALY need.

When you look at the HISTORY of the last three mentioned pages you will see that
there are some ODD versions. I noticed that your patch MAY relate to the
mentioned Java bug.

What I did to fix
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Betawiki:Users_%28alternate
: I commented the line containing "GangleriBot". Then I made a preview. After
this I hit some new lines and made the Preview a few times again until I was
shure that the "blank characters" where "REAL NEW LINES" (whatever this means).

Maybe you are more skilled to analyse the code of the pages in the history and
find out "WHAT ( IS | WAS ) THERE". Maybe it would be an improuvment to be able
to distinguish between ( spaces | tabs | different new line variants in
Linux|Windows|whatever ). Similar to what you can do in TextPad, Word etc.

There shoud be a bug report about beeing able to see changes in "white space"
(?) in history|diff.

Best regards Reinhardt [[user:gangleri]]

Michael.Keppler wrote:

testcase for parsertests

This test case reproduces the bug. Please paste complete attachment content at
the end of your parsertests.txt file.

Without the patch, the test fails because there is an unwanted "<p></p>" in
line 7 of the parser output.

With the patch applied, this unwanted paragraph (caused by a the newline
wrongly taken from the linestart variable) is removed and the test succeeds.

Attached:

wegge wrote:

Patch comitted to REL1_4 and HEAD.

  • Bug 1146 has been marked as a duplicate of this bug. ***