I have checked in a dead-simple extension "TemplateLink". It should solve the ISSN issue (and maybe become a replacement for ISBN as well?), and potentially many more.
Linking to Special:TemplateLink, you can pass a template with parameters as parameter. The separators "|" of the template have to be replaced with "::", otherwise the parser will mess up (or I'll have to mess up the parser;-)
Example: [[Special:TemplateLink/test::param1=value1::param2=value2]] links to a special page that will display "Test" (variation configurable in i18n) as title and {{test|param1=value1|param2=value2}} as content.
Potential problems: * "::" might be confusing. Then again, this will mostly be hidden in templates like {{ISSN}} anyway * Limits on template parameters: short, no wiki or HTML markup. Not fixable unless we move from the [[Special:]] link to tags. * Loss of page-specific parameters like page title. These can be passed as an extra parameter to the "stand-alone" template, though.
Magnus
Magnus Manske wrote:
I have checked in a dead-simple extension "TemplateLink". It should solve the ISSN issue (and maybe become a replacement for ISBN as well?), and potentially many more.
Linking to Special:TemplateLink, you can pass a template with parameters as parameter. The separators "|" of the template have to be replaced with "::", otherwise the parser will mess up (or I'll have to mess up the parser;-)
Example: [[Special:TemplateLink/test::param1=value1::param2=value2]] links to a special page that will display "Test" (variation configurable in i18n) as title and {{test|param1=value1|param2=value2}} as content.
Potential problems:
- "::" might be confusing. Then again, this will mostly be hidden in
templates like {{ISSN}} anyway
I don't like having yet another separator. If using a separator in page link, i'd vote for / which already has some special meaning. Or even [[Special:TemplateLink/<custom separator>/test<sep>param1=value1<sep>param2=value2]]
- Limits on template parameters: short, no wiki or HTML markup. Not
fixable unless we move from the [[Special:]] link to tags.
I still think {{Special:TemplateLink}} to create a link would have been a good system. Transclusion-to-link is not more odd than Special-page separators.
On 9/22/07, Platonides Platonides@gmail.com wrote:
Magnus Manske wrote:
I have checked in a dead-simple extension "TemplateLink". It should solve the ISSN issue (and maybe become a replacement for ISBN as well?), and potentially many more.
Linking to Special:TemplateLink, you can pass a template with parameters as parameter. The separators "|" of the template have to be replaced with "::", otherwise the parser will mess up (or I'll have to mess up the parser;-)
Example: [[Special:TemplateLink/test::param1=value1::param2=value2]] links to a special page that will display "Test" (variation configurable in i18n) as title and {{test|param1=value1|param2=value2}} as content.
Potential problems:
- "::" might be confusing. Then again, this will mostly be hidden in
templates like {{ISSN}} anyway
I don't like having yet another separator.
Me neither, but...
If using a separator in page link, i'd vote for / which already has some special meaning.
That would make passing URLs very odd, as well as titles of subpages.
Or even [[Special:TemplateLink/<custom separator>/test<sep>param1=value1<sep>param2=value2]]
Won't work without ugly parser hacking.
- Limits on template parameters: short, no wiki or HTML markup. Not
fixable unless we move from the [[Special:]] link to tags.
I still think {{Special:TemplateLink}} to create a link would have been a good system. Transclusion-to-link is not more odd than Special-page separators.
So using transclusion syntax to generate a link to a page that shows the transclusion is /less/ odd? ;-)
Maybe we should settle for <templatelink>template|param1|param2</templatelink> Ugly, but no new magic syntax and no parser hacking. Also offers alternate behaviour through tag attributes for future adaptions.
Magnus
On 9/22/07, Magnus Manske magnusmanske@googlemail.com wrote:
- "::" might be confusing. Then again, this will mostly be hidden in
templates like {{ISSN}} anyway
More to the point, it's degenerate. You can have the string '::' in page names, and the same for '='. How can you be sure that [[Special:TemplateLink/test::param1=value1::param2=value2]] doesn't mean "include the template named 'test::param1=value1' with param param2=value2", for instance? If there were any way to get this to work without imposing additional restrictions on the page names, that would be far preferable, I think.
On 23/09/2007, Simetrical Simetrical+wikilist@gmail.com wrote:
On 9/22/07, Magnus Manske magnusmanske@googlemail.com wrote:
- "::" might be confusing. Then again, this will mostly be hidden in
templates like {{ISSN}} anyway
More to the point, it's degenerate. You can have the string '::' in page names, and the same for '='. How can you be sure that [[Special:TemplateLink/test::param1=value1::param2=value2]] doesn't mean "include the template named 'test::param1=value1' with param param2=value2", for instance? If there were any way to get this to work without imposing additional restrictions on the page names, that would be far preferable, I think.
There's no problem with '=', at least not a new one. If you want to give a template a parameter containing an = sign, you have to give the param a name (or number) - exactly the same applies here.
The problem with page names including :: is much more serious issue. You can't introduce a new special character without having some way to escape it.
On 9/22/07, Thomas Dalton thomas.dalton@gmail.com wrote:
There's no problem with '=', at least not a new one. If you want to give a template a parameter containing an = sign, you have to give the param a name (or number) - exactly the same applies here.
No, because template parameters are in a different namespace from page names. We (hopefully) ban '=' in template parameters already. We don't additionally need to ban it in page names, since '|' is already banned in page names. Likewise there's no need to ban '=' in page names for this syntax if we ban '::' in page names. You're right that either way it's not the '=' that matters, it's the thing that separates the page name from the parameters, in this case '::'.
The problem with page names including :: is much more serious issue. You can't introduce a new special character without having some way to escape it.
In practice, we tend to not bother with escaping, and just ban the special character outright instead. That's moderately acceptable for small numbers of characters, but we should reuse those banned characters as much as possible for new syntactic constructs, if we really need to make new ones.
No, because template parameters are in a different namespace from page names. We (hopefully) ban '=' in template parameters already.
No, we don't, they just only work if the param has a name, as I said. If the param isn't named, you have to put '1=' or whatever at the beginning. I imagine '=' is banned in param names, if that's what you meant.
The problem with page names including :: is much more serious issue. You can't introduce a new special character without having some way to escape it.
In practice, we tend to not bother with escaping, and just ban the special character outright instead. That's moderately acceptable for small numbers of characters, but we should reuse those banned characters as much as possible for new syntactic constructs, if we really need to make new ones.
For existing special characters, banning them is fine, but we can't ban new special characters without breaking any page that already uses them. Reusing existing banned characters is the best option, but it's not easy to find one, '|' won't work in this case because it will be assumed to be given display text for the link, rather than being part of the url. What other banned characters are available?
On 9/22/07, Thomas Dalton thomas.dalton@gmail.com wrote:
No, because template parameters are in a different namespace from page names. We (hopefully) ban '=' in template parameters already.
No, we don't, they just only work if the param has a name, as I said. If the param isn't named, you have to put '1=' or whatever at the beginning. I imagine '=' is banned in param names, if that's what you meant.
Yeah, that's what I meant.
For existing special characters, banning them is fine, but we can't ban new special characters without breaking any page that already uses them. Reusing existing banned characters is the best option, but it's not easy to find one, '|' won't work in this case because it will be assumed to be given display text for the link, rather than being part of the url. What other banned characters are available?
If this is really really needed and can't be done cleanly in some other way (which I suspect is not the case), we could always do something like multiple pipes, with the last being display text:
[[Special:TemplateLink/test|param1=value1|param2=value2|display text]]
which would be entirely analogous to images.
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709221232i5884e7d6wc7b42235d15e2894@mail.gmail.com...
I have checked in a dead-simple extension "TemplateLink". It should solve the ISSN issue (and maybe become a replacement for ISBN as well?), and potentially many more.
Linking to Special:TemplateLink, you can pass a template with parameters as parameter. The separators "|" of the template have to be replaced with "::", otherwise the parser will mess up (or I'll have to mess up the parser;-)
Example: [[Special:TemplateLink/test::param1=value1::param2=value2]] links to a special page that will display "Test" (variation configurable in i18n) as title and {{test|param1=value1|param2=value2}} as content.
That seems horrifically complex!
Can't we just re-use our existing link syntax?
e.g.
1) {{test|param1=value1|param2=value2}} - include the template
2) [[Template:test]] - link to the template.
3) [[Template:test|param1=value1|param2=value2]] - render the template on a new page (as if the page contained the markup given in example 1).
There are two questions that need to be resolved to make this work: A) How to tell the difference between example 2 and 3 if the template has no parameters. B) How to supply the text for the link.
If we make it compulsory to provide link text, then it would be easy to say the last item is the link text (or the first, if you prefer). If it is not compulsory then this becomes harder (as does knowing what to display as the link text!) but I'm sure we can get a solution.
To fix point A, however, might require new syntax. For example [[Template:test]] links to the template, and [[#Template:test]] links to the rendered template (as in example 3).
- Mark Clements (HappyDog)
OK, forget the "::" thing. I've switched to <templatelink>, like this:
<templatelink>test|param1=value1|param2=value2</templatelink>
To give the link a name different from the template (in this case, "Test"), use multiple lines:
<templatelink> test|param1=value1|param2=value2 Click on this! </templatelink>
Leading and ending newlines are ignored. First line is the template, last line is the link title, everything in between is currently ignored.
This should be clean enough, syntax-wise.
Cheers, Magnus
On 9/23/07, Magnus Manske magnusmanske@googlemail.com wrote:
To give the link a name different from the template (in this case, "Test"), use multiple lines:
<templatelink> test|param1=value1|param2=value2 Click on this! </templatelink>
Doesn't that make multiline parameter values impossible?
On 9/23/07, Simetrical Simetrical+wikilist@gmail.com wrote:
On 9/23/07, Magnus Manske magnusmanske@googlemail.com wrote:
To give the link a name different from the template (in this case, "Test"), use multiple lines:
<templatelink> test|param1=value1|param2=value2 Click on this! </templatelink>
Doesn't that make multiline parameter values impossible?
In its current implementation, yes. I could move the link name to a "name=" tag attribute.
Remember, this is not intended for taxoboxes and the like. It is for ISBN/ISSN/geohack etc. where you have a few short parameter values, but rather large output generated from these.
Magnus
On 9/23/07, Magnus Manske magnusmanske@googlemail.com wrote:
In its current implementation, yes. I could move the link name to a "name=" tag attribute.
That sounds like a good idea.
Remember, this is not intended for taxoboxes and the like. It is for ISBN/ISSN/geohack etc. where you have a few short parameter values, but rather large output generated from these.
What it's intended for is, of course, not what users are likely to use it for . . .
On 9/24/07, Simetrical Simetrical+wikilist@gmail.com wrote:
On 9/23/07, Magnus Manske magnusmanske@googlemail.com wrote:
In its current implementation, yes. I could move the link name to a "name=" tag attribute.
That sounds like a good idea.
OK, will do.
Remember, this is not intended for taxoboxes and the like. It is for ISBN/ISSN/geohack etc. where you have a few short parameter values, but rather large output generated from these.
What it's intended for is, of course, not what users are likely to use it for . . .
Fully automated fancruft pages! Yay! ;-)
Magnus
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709240124h170c3eev4d1d773714b72908@mail.gmail.com...
On 9/24/07, Simetrical
Simetrical+wikilist@gmail.com wrote:
On 9/23/07, Magnus Manske
magnusmanske@googlemail.com wrote:
In its current implementation, yes. I could move the link name to a "name=" tag attribute.
That sounds like a good idea.
OK, will do.
Remember, this is not intended for taxoboxes and the like. It is for ISBN/ISSN/geohack etc. where you have a few short parameter values, but rather large output generated from these.
What it's intended for is, of course, not what users are likely to use it for . . .
Fully automated fancruft pages! Yay! ;-)
Both of these points seem unnecessarily limiting! What if the template has a name parameter? What if the input needs to be on more than one line? I see no reason not to build with this flexibility now - it will only end up being a future request if not, and a lot harder to fix if we have hacked together a clumsy syntax that we have to stick to for backward compatability.
What about the suggestion I made yesterday, about using the standard link syntax, potentially with an extra symbol at the beginning? So {{Test}} means transclude, [[Template:Test]] means link to and [[#Test]] (or [[#Template:Test]] if you like) means link to a special page, showing the rendered template.
Of course, I've now realised that # is not a suitable character for this, as although it is invalid in page names, it is valid in links as an in-page link, so maybe another character would need to be used (how about question mark?) Or perhaps use [[Test#]] instead?
(See my previous post for more details about my suggestion).
This idea is much more concise than <templatelink>Test</templatelink> which is what is currently proposed...
- Mark Clements (HappyDog)
On 9/24/07, Mark Clements gmane@kennel17.co.uk wrote:
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709240124h170c3eev4d1d773714b72908@mail.gmail.com...
On 9/24/07, Simetrical
Simetrical+wikilist@gmail.com wrote:
On 9/23/07, Magnus Manske
magnusmanske@googlemail.com wrote:
In its current implementation, yes. I could move the link name to a "name=" tag attribute.
That sounds like a good idea.
OK, will do.
Remember, this is not intended for taxoboxes and the like. It is for ISBN/ISSN/geohack etc. where you have a few short parameter values, but rather large output generated from these.
What it's intended for is, of course, not what users are likely to use it for . . .
Fully automated fancruft pages! Yay! ;-)
Both of these points seem unnecessarily limiting! What if the template has a name parameter? What if the input needs to be on more than one line? I see no reason not to build with this flexibility now - it will only end up being a future request if not, and a lot harder to fix if we have hacked together a clumsy syntax that we have to stick to for backward compatability.
Not sure we're in sync here. In the mail you replied to, I agreed to alter the extension so you can write
<templatelink name="The name of the link"> Test |param1=value1 |param2=value2 </templatelink>
What's the problem with that?
What about the suggestion I made yesterday, about using the standard link syntax, potentially with an extra symbol at the beginning? So {{Test}} means transclude, [[Template:Test]] means link to and [[#Test]] (or [[#Template:Test]] if you like) means link to a special page, showing the rendered template.
Of course, I've now realised that # is not a suitable character for this, as although it is invalid in page names, it is valid in links as an in-page link, so maybe another character would need to be used (how about question mark?) Or perhaps use [[Test#]] instead?
(See my previous post for more details about my suggestion).
This idea is much more concise than <templatelink>Test</templatelink> which is what is currently proposed...
More concise, yes, as '' is more concise than <i>. But <templatelink> is a lot cleaner IMHO. Just imagine the mess we'd be in with the redesign of the reference system if we had used wikisyntax for that...
I expect <templatelink> to be buried in templates anyway, and rarely used directly. Its use only makes sense if you have a single large "form" (template) to fill with lots'o' data sets.
Magnus
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709240411tb301940tb53f7eb531aedfae@mail.gmail.com...
On 9/24/07, Mark Clements gmane@kennel17.co.uk
wrote:
Both of these points seem unnecessarily limiting! What if the template
has
a name parameter? What if the input needs to be on more than one line?
I
see no reason not to build with this flexibility now - it will only end
up
being a future request if not, and a lot harder to fix if we have hacked together a clumsy syntax that we have to stick to for backward compatability.
Not sure we're in sync here. In the mail you replied to, I agreed to alter the extension so you can write
<templatelink name="The name of the link"> Test |param1=value1 |param2=value2 </templatelink>
What's the problem with that?
My confusion - I thought you meant something like:
<templatelink> Test param1=value1 param2=value2 name=The name of the link </templatelink>
Where (a) 'name' was a parameter in the body of the tag, and (b) you were unable to have multi-line parameter values.
What about the suggestion I made yesterday, about using the standard
link
syntax, potentially with an extra symbol at the beginning? So {{Test}} means transclude, [[Template:Test]] means link to and [[#Test]] (or [[#Template:Test]] if you like) means link to a special page, showing
the
rendered template.
Of course, I've now realised that # is not a suitable character for
this, as
although it is invalid in page names, it is valid in links as an in-page link, so maybe another character would need to be used (how about
question
mark?) Or perhaps use [[Test#]] instead?
(See my previous post for more details about my suggestion).
This idea is much more concise than <templatelink>Test</templatelink>
which
is what is currently proposed...
More concise, yes, as '' is more concise than <i>. But <templatelink> is a lot cleaner IMHO. Just imagine the mess we'd be in with the redesign of the reference system if we had used wikisyntax for that...
I expect <templatelink> to be buried in templates anyway, and rarely used directly. Its use only makes sense if you have a single large "form" (template) to fill with lots'o' data sets.
Hmmm... well if that is the case then perhaps you're approach might be better. I guess it also means it can be written as an extension (which is probably more appropriate anyway) rather than having to build it into the core code.
Also, do I understand correctly that <templatelink name="The name of the link">test|param1=value1|param2=value2</templatelink> would also work? And if so, what about:
<templatelink name="The name of the link">test|param1=a long value with multiple lines|param2=value2</templatelink>
If both the above will work OK, then the only distinction between the two methods is the use of <templatelink></templatelink> as opposed to a more standard link syntax: [[]] with some modifier. The first is clearer, the second is more concise. If that is the only difference then I agree that clearer is better.
- Mark Clements (HappyDog)
On 9/24/07, Mark Clements gmane@kennel17.co.uk wrote:
Hmmm... well if that is the case then perhaps you're approach might be better. I guess it also means it can be written as an extension (which is probably more appropriate anyway) rather than having to build it into the core code.
Yup.
Also, do I understand correctly that <templatelink name="The name of the link">test|param1=value1|param2=value2</templatelink> would also work? And if so, what about:
<templatelink name="The name of the link">test|param1=a long value with multiple lines|param2=value2</templatelink>
It should work like replacing "<templatelink>" with "{{" for transclusion. The only change it'd make is remove newline at the start/end of the text, which should not have any impact on the function. So yes, your example should work as well (as soon as I make modifications, tonight:-)
If both the above will work OK, then the only distinction between the two methods is the use of <templatelink></templatelink> as opposed to a more standard link syntax: [[]] with some modifier. The first is clearer, the second is more concise. If that is the only difference then I agree that clearer is better.
It also has room for further improvements. One could specify the target page title with <templatelink title="The title"> to override automatic naming.
Not sure we want this, or what else we might want. But, there's room...
Magnus
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709240654w7db5a2cdj2be2f9fe3439a491@mail.gmail.com...
On 9/24/07, Mark Clements gmane@kennel17.co.uk
wrote:
Hmmm... well if that is the case then perhaps you're approach might be better. I guess it also means it can be written as an extension (which
is
probably more appropriate anyway) rather than having to build it into
the
core code.
Yup.
Also, do I understand correctly that <templatelink name="The name of the link">test|param1=value1|param2=value2</templatelink> would also work?
And
if so, what about:
<templatelink name="The name of the link">test|param1=a long value with multiple lines|param2=value2</templatelink>
It should work like replacing "<templatelink>" with "{{" for transclusion. The only change it'd make is remove newline at the start/end of the text, which should not have any impact on the function. So yes, your example should work as well (as soon as I make modifications, tonight:-)
If both the above will work OK, then the only distinction between the
two
methods is the use of <templatelink></templatelink> as opposed to a more standard link syntax: [[]] with some modifier. The first is clearer,
the
second is more concise. If that is the only difference then I agree
that
clearer is better.
It also has room for further improvements. One could specify the target page title with
<templatelink title="The title"> to override automatic naming.
Not sure we want this, or what else we might want. But, there's room...
All sounds good to me!
- Mark Clements (HappyDog)
On 9/24/07, Mark Clements gmane@kennel17.co.uk wrote:
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70709240654w7db5a2cdj2be2f9fe3439a491@mail.gmail.com...
On 9/24/07, Mark Clements gmane@kennel17.co.uk
wrote:
Hmmm... well if that is the case then perhaps you're approach might be better. I guess it also means it can be written as an extension (which
is
probably more appropriate anyway) rather than having to build it into
the
core code.
Yup.
Also, do I understand correctly that <templatelink name="The name of the link">test|param1=value1|param2=value2</templatelink> would also work?
And
if so, what about:
<templatelink name="The name of the link">test|param1=a long value with multiple lines|param2=value2</templatelink>
It should work like replacing "<templatelink>" with "{{" for transclusion. The only change it'd make is remove newline at the start/end of the text, which should not have any impact on the function. So yes, your example should work as well (as soon as I make modifications, tonight:-)
If both the above will work OK, then the only distinction between the
two
methods is the use of <templatelink></templatelink> as opposed to a more standard link syntax: [[]] with some modifier. The first is clearer,
the
second is more concise. If that is the only difference then I agree
that
clearer is better.
It also has room for further improvements. One could specify the target page title with
<templatelink title="The title"> to override automatic naming.
Not sure we want this, or what else we might want. But, there's room...
All sounds good to me!
Now in SVN: <templatelink text="Click on this!" title="This will become the page title!"> test |param1=value1 |param2=value2 </templatelink>
(the single-line version works as well, of course!)
Now someone review this and put it live, and we can boast we answered the ISSN issue in record time! :-)
Magnus
What about the suggestion I made yesterday, about using the standard link syntax, potentially with an extra symbol at the beginning? So {{Test}} means transclude, [[Template:Test]] means link to and [[#Test]] (or [[#Template:Test]] if you like) means link to a special page, showing the rendered template.
Of course, I've now realised that # is not a suitable character for this, as although it is invalid in page names, it is valid in links as an in-page link, so maybe another character would need to be used (how about question mark?) Or perhaps use [[Test#]] instead?
I think parameters get confusing with such a syntax. Presumably they would be separated by |'s, but then so is the display text in links, so how do you know if the last section is a param or display text?
wikitech-l@lists.wikimedia.org