Benutzer:WiMu/DPL-bug/include: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WiMu (Diskussion | Beiträge) K + includeonly |
WiMu (Diskussion | Beiträge) KKeine Bearbeitungszusammenfassung |
||
| Zeile 38: | Zeile 38: | ||
<source lang="php"> | <source lang="php"> | ||
/* get text and throw away html comments, nowiki- and | /* get text and throw away html comments, nowiki-, pre-, and includeonly-tags */ | ||
$text = preg_replace('/<!--.*?-->/s','',$parser->fetchTemplate($title)); | $text = preg_replace('/<!--.*?-->/s','',$parser->fetchTemplate($title)); | ||
$text = preg_replace('/<nowiki>.*?<\/nowiki>/s','',$text); | $text = preg_replace('/<nowiki>.*?<\/nowiki>/s','',$text); | ||
$text = preg_replace('/<pre>.*?<\/pre>/s','',$text); | $text = preg_replace('/<pre>.*?<\/pre>/s','',$text); | ||
$text = preg_replace('/<includeonly>.*?<\/includeonly>/s','',$text); | |||
</source> | </source> | ||
Version vom 5. Juli 2010, 11:05 Uhr
Parameter | include = {template} makes some problems, when Wiki-syntax like {{template|foo}} is nested within <nowiki> or <pre>-tags on matching pages:
- This is (not) a template-call within <nowiki>-tags (see: Kamel:WiMu/DPL-bug/include/nowiki)
- This is (not) a template-call within <pre>-tags (see: Kamel:WiMu/DPL-bug/include/pre)
- This is (not) a template-call within <includeonly>-tags (see: Kamel:WiMu/DPL-bug/include/includeonly)
- Vorlage:Test.default
<!-- html-comments -->seem to work as intended (see Kamel:WiMu/DPL-bug/include/html-comment)
No problems with parameter | uses:
quick&dirty bug fix:
Throw away <nowiki> or <pre>-tags the way <!-- html-comments --> are deleted. Change line 515ff of DynamicPageListInclude.php to:
<source lang="php"> /* get text and throw away html comments, nowiki-, pre-, and includeonly-tags */ $text = preg_replace('//s',,$parser->fetchTemplate($title)); $text = preg_replace('/<nowiki>.*?<\/nowiki>/s',,$text);
$text = preg_replace('/
.*?<\/pre>/s',,$text);
$text = preg_replace('/