Last modified: 2009-06-26 04:24:21 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 T13274, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11274 - The <pre>/<div> tag around GeSHi-highlighted code does not have a class "source"
The <pre>/<div> tag around GeSHi-highlighted code does not have a class "source"
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Tim Starling
: 16324 (view as bug list)
Depends on:
Blocks: css
  Show dependency treegraph
Reported: 2007-09-10 12:31 UTC by ais523
Modified: 2009-06-26 04:24 UTC (History)
5 users (show)

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


Description ais523 2007-09-10 12:31:24 UTC
Previously (according to memory, and to comments on some bugs, such as bug 7163), the <pre> element that was generated enclosing GeSHi-highlighted code had two classes, "source" and "source-language" (where 'language' was replaced with the language name). At present (r25673) on enwiki, the source class isn't being generated, which means there's currently no easy way to add coding that affects all languages (there's such coding on [[:w:en:MediaWiki:Geshi.css]], demonstrating that the feature is wanted, but it doesn't currently work due to this bug); the code previously worked because the class used to exist, but now it doesn't and it's preventing cross-source-language colour fixes. This seems to be a regression.
Comment 1 ais523 2007-09-10 12:56:15 UTC
(fix severity; this is a bug, not a feature request)
Comment 2 Brion Vibber 2007-09-10 18:59:43 UTC
Peeking through the code, I don't think it ever had this second class. The GeSHi code only deals with a single class on the <pre> it generates, not two, and seems to default to the language name. When we started making using of that it started being set as 'source-{$lang}'.

Without hacking GeSHi's core code or hacking the output, we I guess could put a style on the _wrapper_ <div> which seems to be used only to set directionality.
Comment 3 Brion Vibber 2008-02-25 22:26:22 UTC
Changing the summary -- this isn't a regression, but a wish. :)
Comment 4 Splarka 2008-11-28 19:31:48 UTC
Oddly, there aren't always <pre> in the output of GeSHi anymore.

On Wikimedia: <source lang="css">.foo {}</source> currently produces: 
 <div dir="ltr" style="text-align: left;"><pre class="source-css"><span class="re1">.foo</span> <span class="br0">{</span><span class="br0">}</span></pre></div>

While <source lang="css" line>.foo {}</source> produces: 
 <div dir="ltr" style="text-align: left;"><div class="source-css" style="font-family: monospace;"><ol><li class="li1"><div class="de1"><span class="re1">.foo</span> <span class="br0">{</span><span class="br0">}</span></div></li></ol></div></div>

Meanwhile, all lang stylesheets remove the borders from <pre> that are descendants of the .source-lang, which applies to neither of these cases, but does for output like like:
 <div dir="ltr" style="text-align: left;"><div class="html4strict source-html4strict" style="font-family:monospace;"><ol><li class="li1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">table</span> <span class="kw3">border</span><span class="sy0">=</span><span class="st0">&quot;1&quot;</span>&gt;</span></pre></li></pre></li></ol></div></div>

And the borders for that <pre> get removed in the inline style:
 .source-html4strict li, .source-html4strict pre {
	line-height: normal; border: 0px none white;

So simply classing all <pre> won't work. You'll probably need to class the outer object, the div setting dir="". And then probably remove the border from all descendant pre from that. Ugh.

Comment 5 Ms2ger 2009-06-24 10:10:53 UTC

*** This bug has been marked as a duplicate of bug 16324 ***
Comment 6 Obsolete 2009-06-25 22:25:34 UTC
*** Bug 16324 has been marked as a duplicate of this bug. ***
Comment 7 Obsolete 2009-06-25 22:40:00 UTC
This bug was created because of
Comment 8 Splarka 2009-06-26 04:24:21 UTC
(In reply to comment #7)
> This bug was created because of

No, it was not, it existed before bug 10967 was fixed.

The old version of GeSHi output did NOT have such a class either. But it does now in the latest version (per r52346). All GeSHi output in MediaWiki, using the latest version of the GeSHi extension, will output in a <div> or <span> labelled class="mw-geshi".

There won't be one added to the pre, because there are sometimes: 1) no <pre>, 2) multiple <pre>, so that would be pretty useless. However, if you do want one, take it up with GeSHi, the Syntax Hilight extension covered by this component can only control the outermost div/span.

Also, why did you reverse the dup?

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