Hi Rick, Thanks for your time and the wonderful explanation.
But If you tried {{t2|{{{1}}}|anything...}} on the following site
http://meta.wikimedia.org/wiki/Help:Template
where {{t2}} is pre=efined.
You will find the template parser on meta.wikimedia.org seems to understand that {{{1}}} is the parameter and template call is ended with the last }}
So can you look into this for me.
thanks again jc
Hi, Thanks for the reply. Here is my problem.
I have a template: t2 with the following code start-{{{1}}}-middle-{{{2}}}-end
An if I do {{t2|{{{1}}}|a}} to call the
Template:t2
I suppose to get this as output, start-{{{1}}}-middle-a-end
But rather I got this on my wiki
start-{{{1-middle-{{{2}}}-end}|a}}
That is my problem
Any suggestions thanks jc
It seems to me that you might be confused about the syntax for invoking a template (the m:Help:Template pages calls the text used to invoke a template a tag) vs. the syntax within the template itself.
To expand the template T2 we use {{T2}} (or {{t2}} since the normal capitalize the first character of a title rule appllies), and if we want to pass a positional parameter we use {{t2|parm1}}
INSIDE a template {{{1}}} will expand to the first positional parameter (assuming one was passed, see below). When a TEMPLATE is being parsed, those triple brace bracketted strings will be seen as tags to "invoke" the parameters.
OUTSIDE a template {{{1}}} has no special meaning, it's just text.
The template T2 as you give it expects two parameters. What you are seeing is the effect of passing it less than two parameters.
If a parameter is NOT passed to a template then {{{n}}} (where n is 1, 2 etc) will simply output {{{n}}}. Try these invocations of Template:T2
{{t2|a|b}} -> start-a-middle-b-end
{{t2|a}} -> start-a-middle-{{{2}}}-end because no second parameter was passed.
{{t2}} -> start-{{{1}}}-middle-{{{2}}}-end
Now if we have:
{{t2|{{{1}}}|anything...}}
outside of a template, the parser sees the {{ as the start of an invocation of a template. Everything up to the next occurence of }} is the invocation, so the template invocation is
{{t2|{{{1}}
Which passes ONE parameter with the VALUE "{{{1". T2 then produces (the following with line breaks and commentary added:
start- // text from the template {{{1 // this is the expansion of the first actual positional parameter -middle-{{{2}}}-end // text from the template
The last {{{2}}} comes out unchanged since no actual second positional parameter was passed.
The rest of what you see: |{{{2}}}
is just text from the article which invoked T2.
-- Rick DeNatale
Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/
__________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com