Hello all,
Is there a way to embed a template parameter within a PRE block?
For example, I need a "File" template that is to be used like this: {{File|file name|file contents}} The template source might look like this: '''{{{1|sample file}}}''' <pre>{{{2|sample contents}}}</pre>
Unfortunately, the second parameter is never resolved, i.e. it shows up as literal "{{{2|sample contents}}}". I understand that's because PRE sections are not wikified.
However, the file contents need to be contained within a PRE (or NOWIKI) block to prevent them from being wikified (e.g. "# comment" would be transformed into a numbered list otherwise).
Do I have to rely on users wrapping the file contents into PRE tags?
-- F.
On 28/01/2008, Frederik Dohr fdg001@gmx.net wrote:
Hello all,
Is there a way to embed a template parameter within a PRE block?
For example, I need a "File" template that is to be used like this: {{File|file name|file contents}} The template source might look like this: '''{{{1|sample file}}}''' <pre>{{{2|sample contents}}}</pre>
Unfortunately, the second parameter is never resolved, i.e. it shows up as literal "{{{2|sample contents}}}". I understand that's because PRE sections are not wikified.
However, the file contents need to be contained within a PRE (or NOWIKI) block to prevent them from being wikified (e.g. "# comment" would be transformed into a numbered list otherwise).
Do I have to rely on users wrapping the file contents into PRE tags?
Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and </pre<noinclude></noinclude>>, that sometimes works with these kind of things.
Thomas Dalton wrote:
Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and </pre<noinclude></noinclude>>, that sometimes works with these kind of things.
It doesn't, but <noinclude><pre></noinclude> {{{2}}} <noinclude></pre></noinclude> does.
On 28/01/2008, Platonides Platonides@gmail.com wrote:
Thomas Dalton wrote:
Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and </pre<noinclude></noinclude>>, that sometimes works with these kind of things.
It doesn't, but <noinclude><pre></noinclude> {{{2}}} <noinclude></pre></noinclude> does.
That won't work - with that, the preformating will only apply to the Template: page itself, rather than on pages it's transcluded to.
That won't work
I'm afraid that's correct; unfortunately, none of the suggested workarounds solves the problem (I've tried using a number of different approaches with NOINCLUDE and INCLUDEONLY).
Maybe with some sort of meta-template (like {{!}})? I'm not sure what else to try though...
-- F.
On 28/01/2008, Frederik Dohr fdg001@gmx.net wrote:
That won't work
I'm afraid that's correct; unfortunately, none of the suggested workarounds solves the problem (I've tried using a number of different approaches with NOINCLUDE and INCLUDEONLY).
Maybe with some sort of meta-template (like {{!}})? I'm not sure what else to try though...
I just tried my method and it works for me (the one with <pre<noinclude></noinclude>>). Could this be something that's changed with the new preprocessor? (I'm testing on the latest version from SVN - I assume you're using a stable version?)
I just tried my method and it works for me (the one with <pre<noinclude></noinclude>>).
I'm running v1.11, and I've just tried it on Wikia's 1.12alpha - without success, I'm afraid: * Template: http://tinyurl.com/2ugkzt (http://scratchpad.wikia.com/index.php?title=Template:File&oldid=284739) * Transcluded: http://tinyurl.com/2so8qr (http://scratchpad.wikia.com/index.php?title=Scratchpad:Sandbox&oldid=284...)
Oddly enough, it shows up fine on the template's page, but not when transcluded. Not sure what I might be doing wrong there...
-- F.
On 28/01/2008, Frederik Dohr fdg001@gmx.net wrote:
I just tried my method and it works for me (the one with <pre<noinclude></noinclude>>).
I'm running v1.11, and I've just tried it on Wikia's 1.12alpha - without success, I'm afraid:
I think 1.12alpha predates the new preprocessor - try it on Wikipedia (or just take at look at my sandbox there: http://en.wikipedia.org/wiki/User:Tango/Sandbox where I have it working). It seems it is something different with the new preprocessor. I don't know which is the intended behaviour... (Tim? Care to comment?) I also don't know if there's another trick that will work on older versions (since the preprocessor is still in the testing phase, you may not want to update just yet - hopefully not long, though, it's being tested on the English Wikipedia, so it must be nearly ready).
Thomas Dalton wrote:
On 28/01/2008, Platonides wrote:
Thomas Dalton wrote:
Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and </pre<noinclude></noinclude>>, that sometimes works with these kind of things.
It doesn't, but <noinclude><pre></noinclude> {{{2}}} <noinclude></pre></noinclude> does.
That won't work - with that, the preformating will only apply to the Template: page itself, rather than on pages it's transcluded to.
I tested it on wikipedia before posting. Initially i was going to suggest something like <{{{starttag|pre}}}> or {{{starttag|<pre>}}} which didn't work
I tested it on wikipedia before posting.
So Thomas is probably right about the new preprocessor. Either way, MGrabovsky's solution (using HTML entities) works for me - I'll try your version after upgrading to the (upcoming) new version.
Thanks to all!
-- F.
On 28/01/2008, Platonides Platonides@gmail.com wrote:
Thomas Dalton wrote:
On 28/01/2008, Platonides wrote:
Thomas Dalton wrote:
Try replacing <pre> and </pre> with <pre<noinclude></noinclude>> and </pre<noinclude></noinclude>>, that sometimes works with these kind of things.
It doesn't, but <noinclude><pre></noinclude> {{{2}}} <noinclude></pre></noinclude> does.
That won't work - with that, the preformating will only apply to the Template: page itself, rather than on pages it's transcluded to.
I tested it on wikipedia before posting.
And it worked? Odd... either I'm completely misunderstanding noinclude, or there's bug there. The pre should be removed when transcluding it, so the parameter would display as regular text, not preformatted.
*** I've just tested it myself and you're right, it definitely works. That looks like a bug to me...
mediawiki-l@lists.wikimedia.org