Topic on Project:Support desk

Geshi SyntaxHighlighter CSS missing on diff-pages (or: How to disable AJAX?)

9
TomasRiker (talkcontribs)

Hi,

when I show the revision history of a page that contains source code (I use the mwGeShi extension), the CSS is not included in the "current version of the article" that is displayed below the diff table. So all the code is unformatted and looks very ugly. I noticed that the current version gets loaded via AJAX, probably that's the source of the problem. And it seems like AJAX is disabled on Wikipedia, so they don't have this problem.

Setting $wgUseAjax to false doesn't change anything.

I can disable the feature completely by setting "diffonly" to true for all users and hiding the preference. But this is not what I really want!

How can I disable AJAX in the version history?

Any ideas?

Reach Out to the Truth (talkcontribs)

What is mwGeSHi?

TomasRiker (talkcontribs)

It's an extension that highlights sourcecode in Wiki articles. However it outputs CSS to the page's head section, which is not copied to the overall page's head section during AJAX.

Reach Out to the Truth (talkcontribs)

It's not listed on MediaWiki.org. Do you have a link to where this code is hosted?

Reach Out to the Truth (talkcontribs)
TomasRiker (talkcontribs)

On this site, AJAX is not used, probably for this reason. The current version is just output right away.

My question was how to disable AJAX.

Reach Out to the Truth (talkcontribs)

And that's why I want to know the specific extension. Is it in fact the same extension used on this site, or a different one? I'm not sure the GeSHi extension used on this wiki ever loaded its stylesheet that way.

You could probably just copy the styles to MediaWiki:Common.css, so you don't have to rely on the extension loading it.

TomasRiker (talkcontribs)

This wiki uses the same extension. The CSS is embedded in the page header. Look at the HTML code of SyntaxHighlight_GeSHi, you will find:

<style type="text/css">/*<![CDATA[*/
.source-php {line-height: normal;}
.source-php li, .source-php pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for php
 * CSS class: source-php, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.php.source-php .de1, .php.source-php .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.php.source-php  {font-family:monospace;}
.php.source-php .imp {font-weight: bold; color: red;}

// ...

And now look here: http://www.mediawiki.org/w/index.php?title=Extension%3ASyntaxHighlight_GeSHi&action=historysubmit&diff=448677&oldid=446097

This is the page I'm referring to.
Below the diff you find the "Latest revision as of 15:49, 28 October 2011", which is statically integrated into the page.
On my wiki, this part of the page is loaded dynamically using AJAX. But it fails to copy the loaded page's embedded CSS to the overall page and therefore the sourcecode looks very ugly (not just not highlighted, but when you use line numbers, every single line has a border around it).

So, somehow the AJAX part must have been disabled here.

TomasRiker (talkcontribs)

I found the source of the problem! It's the Flagged Revisions extension, which uses a ArticleContentOnDiff hook and inserts an AJAX call there ... :(

Reply to "Geshi SyntaxHighlighter CSS missing on diff-pages (or: How to disable AJAX?)"