(Created page with "{{doc subpage}} <!-- ADD DOCUMENTATION BELOW THIS LINE --> This template is designed to be used when creating a draft for new pages in the User namespace. It can produce a li...") |
m (→Example Usage: added transclude=yes) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<!-- ADD DOCUMENTATION BELOW THIS LINE --> | <!-- ADD DOCUMENTATION BELOW THIS LINE --> | ||
This template is designed to be used when creating a draft for new pages in the User namespace. It can produce a link (or transclusion) to a related page in the same namespace. When it appears in the user namespace, the link will be preceded with the same User prefix as the page it is displayed on. When it is moved to a different (or main) namespace, the link will be used without a prefix. | This template is designed to be used when creating a draft for new pages in the User namespace. It can produce a link (or transclusion) to a related page in the same namespace. | ||
*When it appears in the user namespace, the link will be preceded with the same User prefix as the page it is displayed on. | |||
*When it appears in the template namespace, the link will be preceded with '''Template:''' | |||
*When it is moved to a different (or main) namespace, the link will be used without a prefix. | |||
It accepts one unnamed parameter for the link text. If the parameter is not specified the BASEPAGENAME is used instead. | === Parameters === | ||
* It accepts one unnamed parameter for the link text. If the parameter is not specified the BASEPAGENAME is used instead. | |||
* {{para|transclude|no}} Use this parameter if you want to '''link to''' a template page, instead of transcluding it. | |||
* {{para|transclude|yes}} Use this parameter if you want to '''transclude''' a main page, instead of linking to it. ''This will prefix the output with a colon (:), but '''only when it appears in the main space'''''. | |||
== Example Usage == | |||
{| Class=wikitable | |||
|+ Location sensitive Variable Outputs | |||
|- | |||
!Space!!PAGENAME!!DraftLink!!Output | |||
|- | |||
|Main||Road Names||{{tlx|DraftLink}}||Road Names | |||
|- | |||
|User||User:PesachZ/Road Names||{{tlx|DraftLink}}||User:PesachZ/Road Names | |||
|- | |||
|Main||Road Names||{{tlx|DraftLink|Road Names/USA}}||Road Names/USA | |||
|- | |||
|Main||Road Names||{{tlx|DraftLink|Road Names/USA|transclude{{=}}yes}}||:Road Names/USA | |||
|- | |||
|User||User:PesachZ/Road Names||{{tlx|DraftLink|Road Names/USA}}||User:PesachZ/Road Names/USA | |||
|- | |||
|Template||Template:DraftLink||{{tlx|DraftLink}}||DraftLink | |||
|- | |||
|Template||Template:DraftLink||{{tlx|DraftLink|transclude{{=}}no}}||Template:DraftLink | |||
|- | |||
|Template||Template:DraftLink||{{tlx|DraftLink|Road Names/USA}}||Road Names/USA | |||
|} | |||
The template can be placed inside double square OR curly braces depending on the desired effect. You can also append subpages after the template. | |||
For example use the following code: | |||
{{pre2|<nowiki>[[</nowiki>{{tlx|DraftLink|Topic page}}/specific detail<nowiki>]]</nowiki>}} | |||
When placed on a user page it will produce {{pre2|<nowiki>[[User:PesachZ/Topic page/specific detail]]</nowiki>}} | |||
When that page is moved to the main space the template will produce {{pre2|<nowiki>[[Topic page/Specific detail]]</nowiki>}} | |||
To use curly braces and transclude that same subpage use this code ''(notice the space between the sets of curly braces)'': | |||
{{pre2|<nowiki>{{ </nowiki>{{tlx|DraftLink|Topic page}}/specific detail<nowiki>}}</nowiki>}} | |||
When placed on a user page it will produce {{pre2|<nowiki>{{User:PesachZ/Topic page/specific detail}}</nowiki>}} | |||
When that page is moved to the main space the template will produce {{pre2|<nowiki>{{Topic page/Specific detail}}</nowiki>}} | |||
=== Transition === | |||
This template smoothes the transition to publish a page, but after the page is published, the template can be replaced with proper wiki links. | |||
To replace the template with proper links, simply edit the page, and (using find & replace) add <code>subst:</code> directly before the word "DraftLink" throughout the page. During the next save the templates will be substituted, and converted into their output. | |||
<includeonly> | <includeonly> | ||
<!-- ADD CATEGORIES BELOW THIS LINE --> | <!-- ADD CATEGORIES BELOW THIS LINE --> |
Latest revision as of 01:40, 3 June 2015
This is a documentation subpage for . It contains usage information, categories and other content that is not part of the original template page. |
This template is designed to be used when creating a draft for new pages in the User namespace. It can produce a link (or transclusion) to a related page in the same namespace.
- When it appears in the user namespace, the link will be preceded with the same User prefix as the page it is displayed on.
- When it appears in the template namespace, the link will be preceded with Template:
- When it is moved to a different (or main) namespace, the link will be used without a prefix.
Parameters
- It accepts one unnamed parameter for the link text. If the parameter is not specified the BASEPAGENAME is used instead.
|transclude=no
Use this parameter if you want to link to a template page, instead of transcluding it.|transclude=yes
Use this parameter if you want to transclude a main page, instead of linking to it. This will prefix the output with a colon (:), but only when it appears in the main space.
Example Usage
Space | PAGENAME | DraftLink | Output |
---|---|---|---|
Main | Road Names | {{DraftLink}} |
Road Names |
User | User:PesachZ/Road Names | {{DraftLink}} |
User:PesachZ/Road Names |
Main | Road Names | {{DraftLink|Road Names/USA}} |
Road Names/USA |
Main | Road Names | {{DraftLink|Road Names/USA|transclude=yes}} |
:Road Names/USA |
User | User:PesachZ/Road Names | {{DraftLink|Road Names/USA}} |
User:PesachZ/Road Names/USA |
Template | Template:DraftLink | {{DraftLink}} |
DraftLink |
Template | Template:DraftLink | {{DraftLink|transclude=no}} |
Template:DraftLink |
Template | Template:DraftLink | {{DraftLink|Road Names/USA}} |
Road Names/USA |
The template can be placed inside double square OR curly braces depending on the desired effect. You can also append subpages after the template.
For example use the following code:
[[{{DraftLink|Topic page}}
/specific detail]]
When placed on a user page it will produce
[[User:PesachZ/Topic page/specific detail]]
When that page is moved to the main space the template will produce
[[Topic page/Specific detail]]
To use curly braces and transclude that same subpage use this code (notice the space between the sets of curly braces):
{{ {{DraftLink|Topic page}}
/specific detail}}
When placed on a user page it will produce
{{User:PesachZ/Topic page/specific detail}}
When that page is moved to the main space the template will produce
{{Topic page/Specific detail}}
Transition
This template smoothes the transition to publish a page, but after the page is published, the template can be replaced with proper wiki links.
To replace the template with proper links, simply edit the page, and (using find & replace) add subst:
directly before the word "DraftLink" throughout the page. During the next save the templates will be substituted, and converted into their output.