Last modified: 2012-04-19 07:04:29 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 T37875, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35875 - <pre> tags generated by extensions should not be collapsed into <pre></pre><div> (content) </div> by Tidy
<pre> tags generated by extensions should not be collapsed into <pre></pre><d...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: High blocker (vote)
: MW 1.20 version
Assigned To: Krinkle
https://www.mediawiki.org/w/index.php...
:
: 35896 35968 36031 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-11 03:32 UTC by Krinkle
Modified: 2012-04-19 07:04 UTC (History)
7 users (show)

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


Attachments
The bug happening on 1.20wmf1 on mediawiki.org (126.80 KB, image/png)
2012-04-11 03:32 UTC, Krinkle
Details
The bug NOT happening on 1.20alpha (localhost) (105.97 KB, image/png)
2012-04-11 03:35 UTC, Krinkle
Details

Description Krinkle 2012-04-11 03:32:50 UTC
Created attachment 10401 [details]
The bug happening on 1.20wmf1 on mediawiki.org

When I initially fixed[1] SyntaxHighlighter a few months back to use <pre class="mw-geshi>...geshi output</pre> instead of <div class="mw-geshi>...geshi output</div> 

( .. so that PRE styles by skins apply to geshi, without requiring local wikis to maintain a copy of each skins's <pre> css style and apply it in MediaWiki:Common.css to div.mw-geshi) .. )

.. it was working fine on SVN trunk. Then I requested that fix to be merged to 1.19wmf1 then suddenly this bug was occurring, the same bug that is happening now. Back then I figured it was due to a change in 1.20 that therefor didn't work well on 1.19wmf1 so it[2] was backed out[3].

But now that 1.20wmf1 is live I'm seeing the same bug again (see attachment).

Oddly enough it still isn't happening on my localhost running git master (2nd attachment), so contrary to what I suspected a few months back it can't be due to changes in core since the branching because 1.20wmf1 was branched *today*. It has to be something specific to wmf config.
Comment 1 Krinkle 2012-04-11 03:35:39 UTC
Created attachment 10402 [details]
The bug NOT happening on 1.20alpha (localhost)
Comment 2 Krinkle 2012-04-11 03:38:16 UTC
[1] r113190, bug 19416)
[2] r113198 MFT 1.19wmf1 r113190
[3] r113200 revert MFT 1.19wmf1 r113190
Comment 3 Krinkle 2012-04-11 03:40:28 UTC
Rephrasing summary, not limited to list item inline context.

Confirmed that the bug doesn't happen on master locally by Roan as well. But installing Tidy made the bug appear, so I suppose that's the "wmf config specific thing" thats causing it.
Comment 5 Krinkle 2012-04-11 04:02:47 UTC
So it turns out that...

.. although Geshi IS using <pre> internally, the reason the skin's style didn't
apply (and hence bug 19416 filed) is because it has a very strong reset. Not a
problem so we can simply wrap another <pre> around that that is loose
from Geshi (geshi's output is simply encapsulated inside of our <pre>).

... Geshi is also using a few <div>s and <span>s internally as wrappings
sometimes (not always), but those are out of the MediaWiki extension's control.

.. and Tidy does not allow a <div> to be inside a <pre> so it closes the <pre>
before the, only child, <div> starts with a </pre>, and lets the div continue
outside the <pre> and them snips out the original </pre> at the and as a
closing tag with no matching opening tag.
Comment 6 Krinkle 2012-04-11 04:17:09 UTC
A report from 2006 (still status: open) upstream shows a similar problem: http://sourceforge.net/tracker/?func=detail&atid=390963&aid=1604555&group_id=27659
Comment 7 Krinkle 2012-04-11 04:19:26 UTC
Another similar problem about <div> inside <button>, although that one was recognized and fixed:

http://sourceforge.net/tracker/?func=detail&atid=390963&aid=1003361&group_id=27659

Console output:

krinkle$ tidy
<button><div>..</div></button>

krinkle$ tidy
<pre><div>..</div></pre>
line 4 column 1 - Warning: missing </pre> before <div>
line 4 column 18 - Warning: inserting implicit <pre>
Comment 8 Krinkle 2012-04-11 22:44:37 UTC
*** Bug 35896 has been marked as a duplicate of this bug. ***
Comment 9 Krinkle 2012-04-11 22:49:15 UTC
Apparently W3 agrees that no <div> is allowed inside <pre>. imho stupid since both are block-level elements (or at least behave like one), but I suppose the easiest solution is to just not use enclose=div (which is the default for whatever reason), but that is fortunately still in the little part of the container that the extension does have control over.

Are there are reasons to support enclose=div ?
Comment 10 Sam Reed (reedy) 2012-04-12 22:42:45 UTC
https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113190

Needs reverting out of master till fixed, and MFT to 1.20wmf1
Comment 11 Krinkle 2012-04-12 23:06:45 UTC
If we can't find a fix, then sure, revert it and reopen bug 19416.

But like I said in comment 9 there is a simple solution, I just wanted to make sure there are no gotchas before I commit it.
Comment 12 Krinkle 2012-04-14 03:01:06 UTC
Okay so to remove the support for <source enclose=div> (which could previously be set manually from wikitext), these lines would have to change in SyntaxHighlight_GeSHi.class.php:

before:
		// Override default enclose from "enclose" attribute?
		$enclose = $pre;
		if ( isset( $args['enclose'] ) ) {
			if ( $args['enclose'] === 'div' ) {
				$enclose = GESHI_HEADER_DIV;
			} elseif ( $args['enclose'] === 'none' ) {
				$enclose = GESHI_HEADER_NONE;
			}
		}
after:
		// Override default enclose from "enclose" attribute?
		$enclose = $pre;
		if ( isset( $args['enclose'] ) ) {
			if ( $args['enclose'] === 'none' ) {
				$enclose = GESHI_HEADER_NONE;
			}
		}

and that would fix it mostly, however there is still the case where line-numering are enabling and then geshi will force a <div> still because of XHTML restrictions (no table allowed in <pre>), which makes perfect sense. So it looks like we'll have to fix this from mediawiki instead and provide a class we can use to give pre-styling.
Comment 14 Kevin Israel (PleaseStand) 2012-04-14 06:32:54 UTC
*** Bug 35968 has been marked as a duplicate of this bug. ***
Comment 15 p858snake 2012-04-17 07:25:06 UTC
*** Bug 36031 has been marked as a duplicate of this bug. ***
Comment 16 T. Gries 2012-04-19 07:04:29 UTC
I suggest to purge all pages to re-render incorrectly rendered pages.

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


Navigation
Links