Benutzer:WiMu/DPL-bug/include: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WiMu (Diskussion | Beiträge) K |
WiMu (Diskussion | Beiträge) K (so, jetzt ersmal genug rumgenerded) |
||
Zeile 27: | Zeile 27: | ||
| uses = Vorlage:Test | | uses = Vorlage:Test | ||
}} | }} | ||
+ | |||
+ | === quick&dirty bug fix: === | ||
+ | |||
+ | Throw away <code><nowiki></code> or <code><pre></code>-tags the way <code><!-- html-comments --></code> are deleted. Change line 515ff of <code>DynamicPageListInclude.php</code> to: | ||
+ | |||
+ | <source lang="php"> | ||
+ | /* get text and throw away html comments, nowiki- and pre-tags */ | ||
+ | $text = preg_replace('/<!--.*?-->/s','',$parser->fetchTemplate($title)); | ||
+ | $text = preg_replace('/<nowiki>.*?<\/nowiki>/s','',$text); | ||
+ | $text = preg_replace('/<pre>.*?<\/pre>/s','',$text); | ||
+ | </source> | ||
+ | |||
+ | Works fine in my local MediaWiki, but maybe there is a better way to find template-calls than via matching regular expressions --[[Kamel:WiMu|WiMu]] 11:49, 5. Jul. 2010 (NNZ) | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | {{sw}}http://semeb.com/dpldemo/index.php?title=Issue:Include-bug_with_nowiki-_and_pre-tags |
Version vom 5. Juli 2010, 10:49 Uhr
Parameter | include = {template}
makes some problems, when Wiki-syntax like {{template|foo}}
is nested within <nowiki>
or <pre>
-tags on matching pages:
- (see: Kamel:WiMu/DPL-bug/include/nowiki)
- (see: Kamel:WiMu/DPL-bug/include/pre)
<!-- 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:
/* get text and throw away html comments, nowiki- and pre-tags */
$text = preg_replace('/<!--.*?-->/s','',$parser->fetchTemplate($title));
$text = preg_replace('/<nowiki>.*?<\/nowiki>/s','',$text);
$text = preg_replace('/<pre>.*?<\/pre>/s','',$text);
Works fine in my local MediaWiki, but maybe there is a better way to find template-calls than via matching regular expressions --WiMu 11:49, 5. Jul. 2010 (NNZ)
Schau mal in die Wahnsinnig Weite Wüste: http://semeb.com/dpldemo/index.php?title=Issue:Include-bug_with_nowiki-_and_pre-tags