Yes it would be large, which is why I didn't make it that way.
Here's my proposal (in as much detail as I can muster):
1) Give all <pre> and <div> tags generated from <source> a css class (or several).
2) Modify Brion's syntax-hightlight extension so that it doesn't add any <style> tags to the header, but a single <link> instead OR one <link> for each language represented in the article. Preferably this would be earlier in the link chain than User CSS so that users can modify how source code looks for themselves.
3) Set the link urls to the "action=raw&ctype=text/css&maxage=whatever" version of something like "MediaWiki:SyntaxHighlighting.css" or "MediaWiki: SyntaxHighlighting-LANG.css" where LANG is the name of a language used in a <source> element in the page.
4) Fill MediaWiki:SyntaxHighlighting.css or MediaWiki: SyntaxHighlighting-LANG.css files with the GeShi generated versions of all the css, modified slightly so that all selectors are prefixed with the class/classes identified in step 1.
I feel that the gains of doing this are the following:
1) Less bandwidth since the style information is not being fed for every page which happens to contain a <source> block (the syntax highlighting files can be browser/proxy cached)
2) If the <link> is added early enough in the document <head>, then either Skin CSS or User CSS could be used to override the styles.
I don't pretend to know everything there is to know about this problem or how wikipedia does business, so if there are flaws/holes in the proposal above, I'd love to hear them so that together we can come up with the best solution. :)
-- Jim
On 4/6/07, Tim Starling tstarling@wikimedia.org wrote:
Jim Wilson wrote:
You could give the wrapper elements (<pre> and <div> tags) CSS classes
to
identify that it's source code and what language.
So
<source lang="php"> echo('hi there'); </source>
Might become
<pre class="sourcecode php"> .... </pre>
Then the pre-generated GeShi files could be modified to have all
elements
prefixed with .sourcecode .php or whatever.
That's what it does already, except for the bit about generating files.
It would probably make sense though to put all of this generated stuff
into
something other than Common.css but still loaded via a <link> tag which
only
appears on pages with at least one <source> block. Reason being that
the
CSS for all supported GeShi languages will probably be large, and unnecessary for the wide gamut of Wikipedia articles.
Yes it would be large, which is why I didn't make it that way.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l