Last modified: 2011-11-12 10:21:18 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 T34131, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32131 - #subpagelist: Incorrect HTML code.
#subpagelist: Incorrect HTML code.
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SubPageList (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-01 22:03 UTC by Van de Bugger
Modified: 2011-11-12 10:21 UTC (History)
1 user (show)

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


Attachments
Bug fix. (2.19 KB, patch)
2011-11-01 22:06 UTC, Van de Bugger
Details
Alternative fix. (945 bytes, patch)
2011-11-02 19:37 UTC, Van de Bugger
Details

Description Van de Bugger 2011-11-01 22:03:16 UTC
{{ #subpagelist: page=page | kidsonly=yes }}XX

generates code:

<div class="subpagelist">
<ul><li><a href="...">Subpage1</a>
</li><li><a href="...">Subpage2</a></div>XX
</li></ul>

Note intersection between div and ul: <div><ul></div></ul>. That's incorrect. must be <div><ul></ul></div>.

The problem is in `makeList' function and MediaWiki parser. MediaWiki parsers thinks a list item is finished by newline; while `makeList' function adds newline /before/ each item, and omits newline after the last item of the list.
Comment 1 Van de Bugger 2011-11-01 22:06:39 UTC
Created attachment 9344 [details]
Bug fix.
Comment 2 Jeroen De Dauw 2011-11-02 02:00:52 UTC
Is this a patch against trunk? And can you please not change var names all over the place and make a functional change at the same time? This makes it quite hard to review.
Comment 3 Jeroen De Dauw 2011-11-02 02:03:34 UTC
I honestly don't see where the current code is wrong, and how your patch fixes it.
Comment 4 Van de Bugger 2011-11-02 19:36:38 UTC
> Is this a patch against trunk? 

Yes.

> And can you please not change var names all over
the place and make a functional change at the same time? 

I change var name because the meaning of the variable is changed. I do not think it would be helpful to use $start variable for a character used for finishing list item. This is exact reason why I named it $itemFinish.

> I honestly don't see where the current code is wrong, and how your patch fixes
it.

Let us consider lists of ul or ol types. makeList generates a newline at the front of each list item, and DOES NOT generate newline at the end of the last item, so result (before pass it to parseWikitext) will be 

intro...<div> 
* item1
* item2</div>outro

Mwdiawiki parser allows </div>, but does not understand that </div> terminates the item, and generates 

intro...<div>
<ul><li>item1
</li><li>item2</div>outro
</li><ul>

The problem can be solved by adding newline after the end of last item of the list:

intro...<div> 
* item1
* item2<!-- This newline solves the issue. -->
</div>outro

So parser will generate

intro...<div>
<ul><li>item1
</li><li>item2
</li><ul>
</div>outro
Comment 5 Van de Bugger 2011-11-02 19:37:49 UTC
Created attachment 9348 [details]
Alternative fix.

Alternative fix. May be it would be easier to understand.
Comment 6 Jeroen De Dauw 2011-11-02 23:34:53 UTC
Oh.. So it's the parser messing it up - that explains why I did not see anything wrong :)

Will apply your patch later today - thnx!
Comment 7 Jeroen De Dauw 2011-11-03 03:02:04 UTC
Applied in r101783
Comment 8 Van de Bugger 2011-11-12 10:21:18 UTC
Verified on r102853.

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


Navigation
Links