Talk:Raw HTML Output from a MediaWiki Parser Function

From Jimbojw.com

Jump to: navigation, search

Comments on Raw HTML Output from a MediaWiki Parser Function

Leave a comment

Name (required):

Website:

Comment:


Contents

Evan Sultanik said ...

Your methods seem to work great, however, my only problem is that the parser seems to replace ampersands with "&" no matter what. Am I doing something wrong?

--Evan Sultanik 09:36, 17 April 2008 (MST)

Evan Sultanik said ...

Re: my last post

That ampersand in quotes is supposed to be &<nowiki> (''i.e.'' the HTML code for an ampersand) --[http://www.sultanik.com/ Evan Sultanik] 09:37, 17 April 2008 (MST) </div> == Evan Sultanik said ... == <div class='commentBlock'> One last try... <nowiki>&

& amp ; (minus the spaces)


--Evan Sultanik 09:38, 17 April 2008 (MST)

Jimbojw said ...

Hi Evan,

Yeah, MediaWiki applies some post processing at the very end of everything. It could be that.

If that's the problem, I'd recommend serializing the content that you want inside an HTML comment (as with base64encode), then hook 'ParserAfterTidy' and decode your content.

It's a bit convoluded, granted, but I don't know of another way around MediaWiki's insistence on altering & characters.

I've written about this problem before in my article Raw HTML Output from a Parser Extension. Good luck!

--Jimbojw 12:54, 23 April 2008 (MST)

Lambert Lum said ...

This insertStripItem() looks like an interesting technique. I tried making it work, but I kept seeing various errors. For example, extra <pre> tags still settled into my HTML. Another example, insertStripItem() produces UNIQ-QINU markers when used as an if clause in {{#if:}}. Am I doing something wrong? BTW, I am using mediawiki 1.12.

--Lambert Lum 15:33, 1 October 2008 (MST)

Jake said ...

Hey, great info, thanks.

One question, is this vulnerable like the previous article? Is it possible to make it unusable by non-admin usergroups?

Cheers, thanks

--Jake 03:36, 12 January 2010 (MST)

moritz said ...

this makes extension handover of html generated links impossible if i got the whole point.

raw html is removed in wiki input for security reasons ($wgRawHtml disabled). to inject raw html with an extension, the following return method is (i think generally) used :

“return $parser->insertStripItem($htmlString, $parser->mStripState);”

(HTMLets-extension uses base64encode/decode to hide html, even more dirty...)

this stores the html string in an array table with a corresponding randomized unique encryption for example like this:

"UNIQ274917e1406dc9e5-item-0--QINU"

at the tidy up at the end, AFTER wiki has removed any other html input, this unique string is replaced back with the raw html behind it. (AT WHAT TIME IS THE RETRANSLATION?)

my problem is: i have such a replaced "UNIQ-html" from another extension as input for my extension. is there a posibility to render the page (get the raw html not the uniq...qinu)before the parser gets into my extension, any flag or operation to make wiki to render the table correspondences before it continues to parse the page? else, i have a return value with the encryption and i was not able to get access to that table.

about this html hiding thing, i know there may be issues i dont know why u made this solution this way and not an easier one, and you wont fix for compatibility reasons the method from

function renderRawHTML( &$parser, $input= ) {

   return array( $input, noparse => true, isHTML => true );

, maybe a better solution would be to make a new flag like isHTML_2 =>true to return or render the html for direct reuse of another extension etc and to make the page backtranscoding to ignore such tagged html?


--moritz 03:08, 25 March 2010 (MST)

moritz said ...

im sorry, did figure out how to retranslate in raw html input. you can access the data array where the correspondances are stored and retranslate the UNIQ...QINU to the raw-html as follows:

$url = ( $parser->mStripState->general->data[$url]);

where $url is the given UNIQ-string and $parser is the used parser. $url contains after this operation something like this: <a href="link>linktitle</a>

greezz

--moritz 22:13, 25 March 2010 (MST)

Renjith said ...

testing...

--Renjith 06:41, 31 May 2010 (MST)

tamiflu forum said ...

Hello, how are the kids? http://torcs.sourceforge.net/index.php?name=Your_Account&profile=2730 cutting weight with lasix 8-O http://forum.nrgsystems.com/members/Order-Cheap-Generic-Propecia-Online.aspx finasteride propecia and proscar =-) http://posterous.com/people/4wEPgFn2sFwt bird flu tamiflu ckdjl

--tamiflu forum 13:38, 14 July 2010 (MST)

buy cheap tamiflu said ...

where can i buy Xenical without prescription said ...

buy xenical said ...

Hello, what about this terrible weather? http://torcs.sourceforge.net/index.php?name=Your_Account&profile=2733 buy cheap generic xenical no prescription 7744 http://forum.nrgsystems.com/members/Order-Cheap-Generic-Celebrex-Online.aspx buy cheap generic celebrex faum http://www.mydeejayspace.com/profiles/blogs/buy-cheapest-gener-propecia order cheap generic propecia  :-)))

--buy xenical 17:15, 14 July 2010 (MST)

Xenical buy Xenical said ...

Hello, how have you been? http://torcs.sourceforge.net/index.php?name=Your_Account&profile=2729 7 buy propecia and proscar  :-OO http://forum.nrgsystems.com/members/Order-Cheap-Generic-Xenical-Online.aspx order Xenical uk xsymk http://posterous.com/people/4wEPhi0wblh7 buy lasix without a prescription zjew

--Xenical buy Xenical 18:27, 14 July 2010 (MST)

jenalynnse said ...

comment observed brightness

--jenalynnse 11:02, 26 July 2010 (MST)

carlyleash said ...

wide , http://fixedincomecolor.com , warmest , http://www.oceanleadership.org , increases

--carlyleash 11:03, 26 July 2010 (MST)

lindellmat said ...

reductions environment time resulting

--lindellmat 11:04, 26 July 2010 (MST)

coraliaada said ...

understanding percent others occurred

--coraliaada 12:57, 5 August 2010 (MST)

lorielcate said ...

natural , http://www.pygtk.org , growing , http://www.warmi.net , driven , http://www.nationalrunningcenter.com , away , http://www.loopnet.com , major

--lorielcate 12:58, 5 August 2010 (MST)

wakefieldg said ...

seasonal new cosmic

--wakefieldg 12:59, 5 August 2010 (MST)

krystalyns said ...

evaporation nations warmer worldwide

--krystalyns 03:34, 14 August 2010 (MST)

brionnekan said ...

average , http://www.caldwellenergy.com , components , http://www.canadianappliance.ca , order , http://entropy.eu , lime , http://floatingclassroom.tamu.edu , sectors

--brionnekan 03:35, 14 August 2010 (MST)

picabospar said ...

study burning notes safari

--picabospar 03:36, 14 August 2010 (MST)

ralfdavy said ...

result simulations likely slowly

--ralfdavy 09:33, 24 August 2010 (MST)

claibornra said ...

stricter , http://jxb.oxfordjournals.org , 2100 , http://www3.interscience.wiley.com , imposed , http://www.eurekalert.org , small

--claibornra 09:34, 24 August 2010 (MST)

tedmanplan said ...

less pdf radiative resulted

--tedmanplan 09:34, 24 August 2010 (MST)

aldysfinke said ...

developer policymakers january

--aldysfinke 21:10, 3 September 2010 (MST)

anselltete said ...

extinction , http://www.sciencedaily.com , heat , http://www.lclark.edu , 104 , http://www.usnews.com , expected , http://economicgoodnews.blogspot.com , rise

--anselltete 21:11, 3 September 2010 (MST)

carleighho said ...

allowed page radiation

--carleighho 21:11, 3 September 2010 (MST)