Last modified: 2010-05-24 16:36:31 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 T20608, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18608 - API should provide list of CSS styles to apply to rendered output
API should provide list of CSS styles to apply to rendered output
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.15.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-27 17:37 UTC by Roan Kattouw
Modified: 2010-05-24 16:36 UTC (History)
6 users (show)

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


Attachments

Description Roan Kattouw 2009-04-27 17:37:14 UTC
... maybe in action=parse or meta=siteinfo. Take note that these URLs depend on site config and part of it varies per skin.
Comment 1 Sam Reed (reedy) 2010-01-31 13:23:07 UTC
Seems we need OutputPage::headElement, passing in the current skin...

But we don't really want it just outputting it however.. Can we get a reference to the output page via any method?
Comment 2 Roan Kattouw 2010-01-31 15:07:32 UTC
(In reply to comment #1)
> Seems we need OutputPage::headElement, passing in the current skin...
> 
> But we don't really want it just outputting it however..
headElement() doesn't do any output, it just returns a string.

> Can we get a reference
> to the output page via any method?
Creating a new one should work just fine, as $wgOut (the global one) doesn't contain anything useful anyway and messing it up is bad style.

$out = new OutputPage;
$out->addParserOutputNoText( $po ); // PO object generated by action=parse
$headHTML = $out->headElement();
Comment 3 Sam Reed (reedy) 2010-02-02 00:21:47 UTC
In parse..

		if ( isset( $prop['stylesheets'] ) ) {
		
			$out = new OutputPage;
			$out->addParserOutputNoText( $p_result ); // PO object generated by action=parse
				
			$result_array['stylesheets'] = $out->headElement( $wgUser->getSkin() );
		}

http://mediawiki.pastebin.com/f5e69e38a

Obviously too much information, but on the right track...
Comment 4 Sam Reed (reedy) 2010-02-09 20:23:18 UTC
<link rel="stylesheet" href="/w/skins/common/shared.css?265" media="screen" /> 
<link rel="stylesheet" href="/w/skins/common/commonPrint.css?265" media="print" /> 
<link rel="stylesheet" href="/w/skins/monobook/main.css?265" media="screen" /> 
<!--[if IE 6]><link rel="stylesheet" href="/w/skins/monobook/IE60Fixes.css?265" media="screen" /><![endif]--> 
<!--[if IE 7]><link rel="stylesheet" href="/w/skins/monobook/IE70Fixes.css?265" media="screen" /><![endif]--> 
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Common.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" /> 
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Print.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" media="print" /> 
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Monobook.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" /> 
<link rel="stylesheet" href="/w/index.php?title=-&amp;action=raw&amp;maxage=18000&amp;gen=css" /> 


How much do we want to give them? Or do we just give them it like that, htmlencoded?
Comment 5 Sam Reed (reedy) 2010-02-09 20:49:40 UTC
r62195

Not quite as originally requested, but prop=headhtml on action=parse will give a dump of the <head> stuff
Comment 6 Sam Reed (reedy) 2010-05-20 20:42:00 UTC
Reopening, think I should do this in a better fashion

From OutputPage.php

<Reedy> 02121                         $this->buildCssLinks(),
<Reedy> 02122                         $this->getHeadScripts( $sk ),
<Reedy> 02123                         $this->getHeadItems(),
<Reedy> Is what it should be returning
<Reedy> but as a proper list
<Reedy> Annoyingly, most of those functions make the result into a string

HeadItems comes from prop=headitems (from extensions...)

Maybe prop=headscripts and prop=csslinks....


Suggestions?
Comment 7 Roan Kattouw 2010-05-22 21:33:12 UTC
(In reply to comment #6)
> Reopening, think I should do this in a better fashion
> 
> From OutputPage.php
> 
> <Reedy> 02121                         $this->buildCssLinks(),
> <Reedy> 02122                         $this->getHeadScripts( $sk ),
> <Reedy> 02123                         $this->getHeadItems(),
> <Reedy> Is what it should be returning
> <Reedy> but as a proper list
> <Reedy> Annoyingly, most of those functions make the result into a string
> 
> HeadItems comes from prop=headitems (from extensions...)
> 
> Maybe prop=headscripts and prop=csslinks....
> 
> 
> Suggestions?
Returning these separately means sense I guess, but it's probably also convenient to have a way to get the whole thing at once.
Comment 8 Sam Reed (reedy) 2010-05-22 21:52:45 UTC
Per IRC..

Can we get away with changing/adding onto headitems, and backport to 1.16

Or just keep seperate, and have an option to get all..
Comment 9 Roan Kattouw 2010-05-22 21:57:56 UTC
(In reply to comment #8)
> Per IRC..
> 
> Can we get away with changing/adding onto headitems, and backport to 1.16
> 
> Or just keep seperate, and have an option to get all..
Adding stuff onto headitems is definitely acceptable IMO
Comment 10 Sam Reed (reedy) 2010-05-22 23:38:58 UTC
http://mediawiki.pastebin.com/2k8UJEb2

Script is a bit nasty. Don't know if we want to split it off a bit more (find some way of

We can explode, and array_filter. But we strip whatever we add.. So would have to reappend...

Unless we regex split.

Worth doing, or not worth the faff?
Comment 11 Sam Reed (reedy) 2010-05-22 23:43:29 UTC
http://mediawiki.pastebin.com/RwwEqfQm

Is the original head items, CSS, and scripts...
Comment 12 Sam Reed (reedy) 2010-05-24 16:36:31 UTC
r66834

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


Navigation
Links