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

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (Die Seite wurde neu angelegt.)
 
K (Textersetzung - „http://kamelopedia.mormo.org/“ durch „http://kamelopedia.net/“)
 
(8 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
Parameter <code>| include = {template}</code> makes some problems, when Wiki-syntax like <code><nowiki>{{template|foo}}</nowiki></code> is nested within <code>&lt;nowiki&gt;</code> or <code>&lt;pre&gt;</code>-tags on matching pages:
 +
 +
 
* {{#dpl:
 
* {{#dpl:
 
| mode    = userformat
 
| mode    = userformat
 
| title  = Kamel:WiMu/DPL-bug/include/nowiki
 
| title  = Kamel:WiMu/DPL-bug/include/nowiki
 
| include = {Test}
 
| include = {Test}
 +
}} (see: [[Kamel:WiMu/DPL-bug/include/nowiki]])
 +
* {{#dpl:
 +
| mode    = userformat
 +
| title  = Kamel:WiMu/DPL-bug/include/pre
 +
| include = {Test}
 +
}} (see: [[Kamel:WiMu/DPL-bug/include/pre]])
 +
* {{#dpl:
 +
| mode    = userformat
 +
| title  = Kamel:WiMu/DPL-bug/include/includeonly
 +
| include = {Test}
 +
}} (see: [[Kamel:WiMu/DPL-bug/include/includeonly]])
 +
* {{#dpl:
 +
| mode    = userformat
 +
| title  = Kamel:WiMu/DPL-bug/include/html-comment
 +
| include = {Test}
 +
}} <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])
 +
 +
 +
No problems with parameter <code>| uses</code>:
 +
 +
 +
* {{#dpl:
 +
| mode    = userformat
 +
| title  = Kamel:WiMu/DPL-bug/include/nowiki
 +
| uses    = Vorlage:Test
 
}}
 
}}
 +
 +
=== quick&dirty bug fix: ===
 +
 +
Throw away <code>&lt;nowiki&gt;</code> or <code>&lt;pre&gt;</code>-tags the way <code>&lt;!-- html-comments --&gt;</code> are deleted. Change line 515ff of <code>DynamicPageListInclude.php</code> 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>.*?<\/pre>/s','',$text);
 +
$text = preg_replace('/<includeonly>.*?<\/includeonly>/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:50, 5. Jul. 2010 (NNZ)
 +
 +
 +
----
 +
 +
 +
{{sw}}http://semeb.com/dpldemo/index.php?title=Issue:Include-bug_with_nowiki-_and_pre-tags

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:[<small>bearbeiten</small>]

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-, pre-, and includeonly-tags */
$text = preg_replace('/<!--.*?-->/s','',$parser->fetchTemplate($title));
$text = preg_replace('/<nowiki>.*?<\/nowiki>/s','',$text);
$text = preg_replace('/<pre>.*?<\/pre>/s','',$text);
$text = preg_replace('/<includeonly>.*?<\/includeonly>/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:50, 5. Jul. 2010 (NNZ)




Siehe auch.png Schau mal in die Wahnsinnig Weite Wüste: http://semeb.com/dpldemo/index.php?title=Issue:Include-bug_with_nowiki-_and_pre-tags