Last modified: 2011-03-13 18:05:31 UTC
When using a template, if wanting to use the <pre></pre> tags on a parameter it doesn't work. The pre tags actually affect the template and not the parameter entered. So if in the template I put <pre>{{{1}}}</pre> the page calling the template will display {{{1}}} and not the actual entered parameter with preserved formatting. Examples were confirmed here. confirmed at http://test.wikipedia.org/wiki/CodeBoxTest and http://test.wikipedia.org/wiki/Template:CodeBox
<pre> works like <nowiki>. Try using the wiki markup for this instead; put spaces at the start of the line.
I do understand that, if I wasn't clear with my description of the problem, I apologize. The purpose is to add pre tags inside of a template so editors do not have to indent or add the pre tags while editing, They simply add the template command and a parameter and the tags in the template (pre) are applied to the entered parameter. I brought this up on irc #mediawiki and was told this appears to be a bug in the way a template handles the tags so I submitted this. Instead of applying the tags to the parameter entered on a page it applies the tag on the template.
hm, having <pre> behave link <nowiki> seems awkward... I see how it can be useful, but still... A blank at the start of the line will not work with template parameters, I think, if the parameter values has multiple lines (not all starting with whitespace). So the only workaround seems to be to use <div style='white-space:pre;'> and hope the browser gets it right...
this solution won't work for me. I need the pre tag to insert HTML code which in part is wiki code. after a very long discussion at #mediawiki the solution found was that wiki will parse the variables before parsing the pre tag on templates. another option is to define another tag: <template_pre> that will be parsed as the <pre> tag only after the variable is parsed. Please let me know by email about new developments on this issue.
Solution suggestion: 1. Define <template_pre> tag which will be parsed like this: 2. Make it possible to pass html (and javascript). as template variable, and remove dangerous tags only after template have been inlined. '''before parsing and/or removing html etc.''' 1.Check for templates on current page. for each template: 1.1. search for <template_pre> tag 1.2. if not within <includonly> 1.2.1. converted <template_pre> to <pre> tag. 1.2.2. continue normal parsing of template 1.3. if within <includeonly> 1.3.1. parameters will be imported 1.3.2. <template_pre> will be converted to <pre> 1.3.3. continue normal parsing of template 1.4. insert template to page 2 continue normal parsing of page.
{{msgnw::{{{1}}}}} would be nice. This would *not* be the same as {{msgnw:{{{1}}}}} with one colon only.
I was just about to submit a bug for this when I discovered this entry. Have there been any attempts to fix this yet? It seems odd to me as well that the whole point of a template is to provide replaceable parameters, yet there are times when the parameters aren't replaced. Twice in the last week as I've been learning about Wikis I've tried to use <pre>{{{1}}}</pre> as well as <nowiki>{{{1}}}</nowiki> only to have {{{1}}} printed instead of the parameter's value. I assumed it would work like #define does in C, where it gets replaced before anything else happens. It does work when you use subst:, but then of course the wikitext on the original page is changed to include the template's wikitext, which you usually don't want in these situations. I can't think of any occasions where you'd *want* to have {{{Something}}} appear when you embed a template inside another page anyway - and even if you did, you could just use something like <span>{{{</span>Something}}} anyway. I think the template replacements should happen *first*, before any tags are processed (this would make it consistent with the behaviour of subst: too.)
For some time now there is the possibility to use {{#tag:pre|{{{1}}}}} to get the desired result. Marking as FIXED
It's not fixed.