Last modified: 2011-03-13 18:05:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T7253, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 5253 - template parameters not expanded inside <pre> tags
template parameters not expanded inside <pre> tags
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
1.6.x
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://test.wikipedia.org/wiki/Templa...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-14 23:33 UTC by todd lambert
Modified: 2011-03-13 18:05 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description todd lambert 2006-03-14 23:33:26 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
Comment 1 Brion Vibber 2006-03-15 01:08:15 UTC
<pre> works like <nowiki>. Try using the wiki markup for this instead; put spaces at 
the start of the line.
Comment 2 todd lambert 2006-03-15 01:26:57 UTC
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.
Comment 3 Daniel Kinzler 2006-03-15 01:37:27 UTC
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...
Comment 4 Erez Segal 2006-03-15 20:02:30 UTC
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.
Comment 5 Erez Segal 2006-03-25 06:33:40 UTC
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.
Comment 6 lɛʁi לערי ריינהארט 2006-04-06 15:12:11 UTC
{{msgnw::{{{1}}}}} would be nice.

This would *not* be the same as {{msgnw:{{{1}}}}} with one colon only.
Comment 7 Adam Nielsen 2006-11-18 01:30:17 UTC
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.)
Comment 8 P.Copp 2009-11-26 03:13:33 UTC
For some time now there is the possibility to use {{#tag:pre|{{{1}}}}} to get the desired result.

Marking as FIXED
Comment 9 Ralf Schmitt 2009-12-11 09:26:37 UTC
It's not fixed. 

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links