Template talk:1x
This template was considered for deletion on 9 September 2009. The result of the discussion was "keep". |
Template:1x is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here. |
Comment
editWhat is this template used for? — Preceding unsigned comment added by 18:20, 20 August 2009 (talk) 64.231.202.93
- I think this template can be very useful if you want to have an option that uses the return value of the template as an input. For example, consider the following template:
{{ {{#if: {{{smallcaps|}}} | smallcaps | 1x }} |1=The entire template comes here.}}
If the parameter smallcaps is defined, the result will be in small capitals using {{smallcaps}}. To test this sample, suppose the parameter is yes:
{{ {{#if: yes | smallcaps | 1x }} |1=The entire template comes here.}}
The result will be:
The entire template comes here.
Then suppose it is a null:
{{ {{#if: | smallcaps | 1x }} |1=The entire template comes here.}}
The result will be:
The entire template comes here.
- TAKASUGI Shinji (talk) 16:16, 11 December 2009 (UTC)
- It's also useful for testing. See, for example, {{transclusion depth test}}. JIMp talk·cont 05:17, 27 February 2012 (UTC)
- My request to add documentation below (#Documentation) explains an important use case. —Zenexer [talk] 00:24, 10 November 2012 (UTC)
Documentation
editThis template is particularly useful as a meta-metatemplate. A metatemplate can use, for example, {{1x|<}}includeonly{{1x|>}}
to generate an <includeonly>
tag. Unlike such a tag made with XML/HTML entities (<
and >
), this tag will be evaluated when the resulting template is substituted.
It would nice to add some documentation on a /doc subpage about this confusing use case. I'll write the documentation if a sysop adds the {{documentation}} template to the page.
Edit request on 18 February 2013
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add the {{documentation}} template in this page in order to add interwikis and the documentation itself. Cainamarques (talk) 17:02, 18 February 2013 (UTC)
- Done If you're going to add some actual documentation, that's fine; but please note that once this problem gets fixed, interlanguage links will be handled through WP:Wikidata. --Redrose64 (talk) 17:17, 18 February 2013 (UTC)
Note about usage
editI submitted T293582 because the Parsoid Linter was not detecting <{{1x|pre}}>
as a valid tag. The bug report was declined with this note:
Parsoid does not support creating HTML tags by piecing together strings via templates. So
{{1x|<pre>}}
will work but<{{1x|pre}}>
will not. We don't plan to support this usecase and it should be fixed on that page. There is really no reason not to just use<pre>
on that page. [attribution: copied from T293582]
I don't know if this needs to go in the documentation, but I wanted at least to put it here on the talk page. – Jonesey95 (talk) 22:17, 17 October 2021 (UTC)