r113190 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113189‎ | r113190 | r113191 >
Date:22:35, 6 March 2012
Author:krinkle
Status:deferred (Comments)
Tags:
Comment:
[SyntaxHighlight GeSHi] Use <code> and <pre> instead of <span> and <div> to allow skins to universally style these without requiring local wikis to manually maintain a copy of each skins's <pre> style and apply it to .mw-geshi

* Fixes
-- (bug 19416) GeSHi-generated blocks should use <pre> style for the container
Modified paths:
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
@@ -108,7 +108,7 @@
109109 $parser->getOutput()->addModuleStyles( 'ext.geshi.local' );
110110 }
111111
112 - $encloseTag = $enclose === GESHI_HEADER_NONE ? 'span' : 'div';
 112+ $encloseTag = $enclose === GESHI_HEADER_NONE ? 'code' : 'pre';
113113 $attribs = Sanitizer::validateTagAttributes( $args, $encloseTag );
114114
115115 //lang is valid in HTML context, but also used on GeSHi

Follow-up revisions

RevisionCommit summaryAuthorDate
r113198MFT r113190reedy23:19, 6 March 2012
r113200Revert r113198reedy23:35, 6 March 2012

Comments

#Comment by Krinkle (talk | contribs)   23:35, 6 March 2012

This works on trunk, but when on 1.19wmf1 it made it look like this when used in a list:

http://i.imgur.com/pVwhd.png

#Comment by Krinkle (talk | contribs)   01:33, 7 March 2012

Using User:Krinkle/Test suite source code as test case. This is what I'm getting:

#Comment by TheDJ (talk | contribs)   12:56, 25 March 2012

I seem to have 2 pre's now around my geshi code....

<pre class="source-javascript">

http://imgur.com/JfNeR

#Comment by TheDJ (talk | contribs)   12:59, 25 March 2012

oh of course, i should have pre'd my pre's :D

<pre dir="ltr" class="mw-geshi mw-content-ltr"><pre class="source-javascript">
</pre></pre>
#Comment by Krinkle (talk | contribs)   14:43, 27 March 2012

I can't tell for sure, but I believe that may be due to a local CSS rule on the wiki you took the snapshot on.

This code isn't live on WMF afaik, but some of the popular WMF wikis have local CSS rules to overwrite Geshi's internal stylesheet for it's HTML input (namely the source-javascript class in this case, which has a strong reset on it by Geshi itself).

Since Geshi doesn't want those to be overwritten (it has a strong reset on it), and because we want core styles for PRE to apply. Therefor Geshi's output (wether it are ‎<p> with ‎<span> and css for pre-style or one ore more ‎<pre> tags doesn't matter).. that output is wrapped in a container. So far this container has been like <div dir="ltr" class="mw-geshi mw-content-ltr">, this revision changes that to <pre dir="ltr" class="mw-geshi mw-content-ltr">.

#Comment by MaxSem (talk | contribs)   20:49, 13 April 2012

Now it's broken on WMF: User:MaxSem/sandbox.

#Comment by Krinkle (talk | contribs)   01:11, 14 April 2012

Status & tagging log