ok, i tried to look at Parser.php. It looks like the parser replaces the '<ask>...</ask>' part with a marker, and then callse the foreach2 function. so the function gets a marker.
since the actual text is in $matches, which is a local variable in the strip function, i don't think i can access it to get the text
ittay
Ittay Dror wrote:
sorry to be bothering you again.
ok, so the reason is how the function is called: {{ #foreach2: <ask format="list" link="none">[[Category:Plugin]]</ask> | /.*Local/ }}
i tried parsing the $text variable: $localParser = new Parser(); $output = $localParser->parse($text, $parser->mTitle, $parser->mOptions); $text = $output->getText(); but it seems not to work.
if i add this: $text = preg_replace('/ask/', 'f', $text); return '<nowiki>got:' . $text . '</nowiki>';
then i see a string like <p>UNIQ300a0835c1305ee-f-00000002-QINU </p> (otherwise, it looks like after <ask> is invoked)
i looked at http://meta.wikimedia.org/wiki/QINU_fix, nothing helpful
Ittay Dror wrote:
after much more digging, i think the text is processed, but preg_replace doesn't work.
printing the parameters (returning debug message enclosed in <nowiki>) and creating a test.php file with the same parameters works.
please help, thanks, ittay
Ittay Dror wrote:
I'm trying to write a 'foreach' parser function. here is the code: public function foreach2Hook(&$parser, $text = '', $pattern = '', $replacement = '', $insep = ',', $outsep = ',' ) { $text= trim( $text ); $variables = explode(trim($insep), $text); $return = preg_replace(trim($pattern), trim($replacement), $variables); return implode(trim($outsep), $return); } my problem is that (i think) $text contains unprocessed text. i want the text after the wiki engine has gone over it, or, make it go over it (giving me the resulting html)
thanks, ittay