Last modified: 2009-08-17 22:38:19 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 T3483, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1483 - Centering the output of an extension improperly nests tags
Centering the output of an extension improperly nests tags
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.8.x
All All
: Normal normal with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: html
  Show dependency treegraph
 
Reported: 2005-02-06 23:47 UTC by Ryan Schmidt
Modified: 2009-08-17 22:38 UTC (History)
2 users (show)

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


Attachments

Description Ryan Schmidt 2005-02-06 23:47:09 UTC
Hi. I just installed a MediaWiki on my laptop, after using it a bit over at hrwiki.org and deciding that I liked it. One of 
the first things I tried was to create an extension to let me render graphs with GraphViz [1]. Now I can write this:

<dot>digraph G {
    foo [URL="foo.html"]
    foo -> bar
}</dot>

And my extension saves the rendered graph image to a cache file and returns this HTML:

<map id="graphviz" name="graphviz">
<area shape="rect" href="foo.html" title="foo" alt="" coords="8,8,80,56" />
</map>
<img src="cache/dotneato/graphviz.png" width="87" height="159" border="0" usemap="#graphviz" />

MediaWiki renders it in the page this way, which is fine:

<p><map id="graphviz" name="graphviz">
<area shape="rect" href="foo.html" title="foo" alt="" coords="8,8,80,56" />
</map>
<img src="cache/dotneato/graphviz.png" width="87" height="159" border="0" usemap="#graphviz" />
</p>

Supposing I want to center this then, I write this:

<center><dot>digraph G {
    foo [URL="foo.html"]
    foo -> bar
}</dot></center>

Only the output is now not what I expect, and my browser (Safari 1.2.4) doesn't render it because of the improperly-
nested tags:

<div class="center"><map id="graphviz" name="graphviz">
<p><area shape="rect" href="foo.html" title="foo" alt="" coords="8,8,80,56" />
</map>
</p>
<img src="cache/dotneato/graphviz.png" width="87" height="159" border="0" usemap="#graphviz" /></div>

See, I open the <map> tag, then for some reason MediaWiki has opened a <p> in the middle of my code, then I close 
my </map>, then MediaWiki closes its </p>, still within my code. I can work around the problem by putting my 
<center> and <dot> tags on separate lines:

<center>
<dot>digraph G {
    foo [URL="foo.html"]
    foo -> bar
}</dot></center>

Then MediaWiki renders it correctly:

<div class="center">
<p><map id="graphviz" name="graphviz">
<area shape="rect" href="foo.html" title="foo" alt="" coords="8,8,80,56" />
</map>
<img src="cache/dotneato/graphviz.png" width="87" height="159" border="0" usemap="#graphviz" />
</p>
</div>

But I'm not sure why this workaround should be necessary, so this feels like a bug in MediaWiki. In fact it feels very 
peculiar that MediaWiki is inserting tags into the middle of the code my extension returned. It seems to me like any 
code that my extension returns should be echoed to the page verbatim.

[1] http://www.graphviz.org/
Comment 1 Tisza Gergő 2006-08-12 10:10:04 UTC
Still appears in current version, see testcase here: [[hu:User:Tgr/bug 1483]].

The center tag also breaks auto paragraph formatting (<p> tags are not inserted
where they should).
Comment 2 Nandor Meszarosh 2006-08-12 10:42:07 UTC
Yes, the center tag also breaks auto paragraph formatting (<p> tags are not
inserted where they should) using together with math tags.

Comment 3 Tisza Gergő 2008-08-26 20:57:59 UTC
Seems to be working fine now (though the extension output is wrapped in an extra <p> if it starts on a new line, but that's still correct syntax, and does not cause any visible difference with the standard stylesheets). Fixed by the new parser?
Comment 4 Tisza Gergő 2008-08-26 21:03:05 UTC
The strange <p> behavior is probably independent from this, see bug 9207.
Comment 5 Chad H. 2009-08-17 22:38:19 UTC
Marking FIXED per comment #3. The <p> issue is separate and already logged at 9207.

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


Navigation
Links