Benutzer:WiMu/DPL-bug/include: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K + includeonly
K Textersetzung - „http://kamelopedia.mormo.org/“ durch „http://kamelopedia.net/“
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 21: Zeile 21:
| title  = Kamel:WiMu/DPL-bug/include/html-comment
| title  = Kamel:WiMu/DPL-bug/include/html-comment
| include = {Test}
| include = {Test}
}} <code>&lt;!-- html-comments --&gt;</code> seem to work as intended (see [http://kamelopedia.mormo.org/index.php?title=Kamel:WiMu/DPL-bug/include/html-comment&action=edit Kamel:WiMu/DPL-bug/include/html-comment])
}} <code>&lt;!-- html-comments --&gt;</code> seem to work as intended (see [http://kamelopedia.net/index.php?title=Kamel:WiMu/DPL-bug/include/html-comment&action=edit Kamel:WiMu/DPL-bug/include/html-comment])




Zeile 38: Zeile 38:


<source lang="php">
<source lang="php">
/* get text and throw away html comments, nowiki- and pre-tags */
/* 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>



Aktuelle Version vom 3. Januar 2014, 02:09 Uhr

Parameter | include = {template} makes some problems, when Wiki-syntax like {{template|foo}} is nested within <nowiki> or <pre>-tags on matching pages:



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('/