Template talk:1x

(Redirected from Template talk:1x/sandbox)
Latest comment: 3 years ago by Jonesey95 in topic Note about usage

Comment

edit

What 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)Reply

It's also useful for testing. See, for example, {{transclusion depth test}}. JIMp talk·cont 05:17, 27 February 2012 (UTC)Reply
My request to add documentation below (#Documentation) explains an important use case. —Zenexer [talk] 00:24, 10 November 2012 (UTC)Reply

Documentation

edit

This 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 (&lt; and &gt;), 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.

Zenexer [talk] 00:21, 10 November 2012 (UTC)Reply

Edit request on 18 February 2013

edit

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)Reply

  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)Reply

Note about usage

edit

I 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)Reply