Last modified: 2013-10-23 18:16:59 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 T38080, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36080 - ParserAfterTidy-Hook gives wrong value
ParserAfterTidy-Hook gives wrong value
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.18.x
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-18 22:35 UTC by desertwolf
Modified: 2013-10-23 18:16 UTC (History)
2 users (show)

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


Attachments

Description desertwolf 2012-04-18 22:35:35 UTC
Hi,

i finaly wanted to upgrade (or better said use) from 1.16 to the latest stable 1.18.2.

With that upgrade, on a clean install, i tried to use some of the old extensions, as i need one for my skin (but regardless of the skin the result is the same).

i used the http://www.mediawiki.org/wiki/Extension:Edit_Section_Link_Transform to modify the headerline (put some html before and after it).

that worked well in 1.16 but not anymore in 1.18.2 (as well as 1.18.1).

whenever i try using that extension nothing happens.

a friend told me to try a die($text); inside the function which results in a 

This page has been accessed XX times.

message. But I would expect the whole postprocessed page from the ParserAfterTidy-Hook like it did in 1.16.

If I am wrong feel free to close this report and please point me to the right hook.
Comment 1 Mark A. Hershberger 2012-04-19 01:12:59 UTC
It would help if you gave us a list of what extensions you have installed as well as your LocalSettings.php.
Comment 2 Bawolff (Brian Wolff) 2012-04-19 01:34:25 UTC
>i used the http://www.mediawiki.org/wiki/Extension:Edit_Section_Link_Transform
>to modify the headerline (put some html before and after it).

Eww, an extension that screen scrapes.


However, at some point (I'm not sure when) we changed to doing edit links in a post process step, so ParserAfterTidy sees things like "<mw:editsection page="Main Page" section="2">f</mw:editsection>" instead (See ParserOutput::replaceEditSectionLinksCallback for details)

-----
Anyhow, the extension should be using the 'DoEditSectionLink' hook (as opposed to weird regex black magic).


>But I would expect the whole postprocessed page from the
>ParserAfterTidy-Hook like it did in 1.16.

The parser is used to parse many things, not just the page. That hook will be called several times, your die would only catch the first.

----
p.s. I'm unsure if this bug is valid. ParserAfterTidy does give right value, although i suppose you're right in that most people expect full html, no pseudo-xml markers. otoh, I somewhat doubt we're changing that.
Comment 3 desertwolf 2012-04-19 15:27:33 UTC
Hi,


first of all i don't use that extension to modify the edit button - i just want to add a div with a css class before and after a heading - and i found out that this method was pretty simple - i DO NOT WANT to change the edit text/icon with that

currently i replace this:

$text = preg_replace('/<h([23])><span class="editsection">\[<a href="(.+)" title="(.+)">(.+)<\/a>\]<\/span> <span(.+)>(.+)<\/span><\/h[23]>/i', '<div class="MainHead"><h$1><span class="editsection">[<a href="$2" title="$3">$4</a>]</span> <span $5">$6</span></h$1></div>', $text);

which should work fine according to regexbuddy and did in mw1.16

for my extensions - besides Edit_Section_Link_Transform extension i only have the extensions installed that came with mw1.18

require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/Gadgets/Gadgets.php" );
require_once( "$IP/extensions/Nuke/Nuke.php" );
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
require_once( "$IP/extensions/Renameuser/Renameuser.php" );
require_once( "$IP/extensions/Vector/Vector.php" );
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );

also tried it with comment all the lines - but it didnt help

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


Navigation
Links