Template talk:Code: Difference between revisions
SilverLocust (talk | contribs) Tag: Reverted |
SilverLocust (talk | contribs) Tag: Reverted |
||
Line 93: | Line 93: | ||
::{{Reply|HotMess}} I have made a new version in [[Template:Code/sandbox2]] that may be correct — but it could use more checking. [<ins>Edit: Now that my changes have been moved to /sandbox, I have put HotMess's original version in /sandbox2.</ins>] [[User:SilverLocust|<small style="color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em">SilverLocust</small>]] [[User talk:SilverLocust|💬]] 10:16, 5 March 2024 (UTC) |
::{{Reply|HotMess}} I have made a new version in [[Template:Code/sandbox2]] that may be correct — but it could use more checking. [<ins>Edit: Now that my changes have been moved to /sandbox, I have put HotMess's original version in /sandbox2.</ins>] [[User:SilverLocust|<small style="color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em">SilverLocust</small>]] [[User talk:SilverLocust|💬]] 10:16, 5 March 2024 (UTC) |
||
:::@[[User:SilverLocust|SilverLocust]] I've incorporated those changes into [[Template:Code/sandbox]], and updated [[Template:Code/testcases]] with those additional checks (and a couple extra checks) - and it appears to be functioning correctly now. <span style="white-space: nowrap;">[[User:HotMess|<b style="color:red;">🔥HOT<i style="color:orange;">m̵̟͆e̷̜̓s̵̼̊s̸̜̃</i>🔥</b>]] ([[User_talk:HotMess|talk]]・[[Special:Contributions/HotMess|edits]])</span> 13:13, 5 March 2024 (UTC) |
:::@[[User:SilverLocust|SilverLocust]] I've incorporated those changes into [[Template:Code/sandbox]], and updated [[Template:Code/testcases]] with those additional checks (and a couple extra checks) - and it appears to be functioning correctly now. <span style="white-space: nowrap;">[[User:HotMess|<b style="color:red;">🔥HOT<i style="color:orange;">m̵̟͆e̷̜̓s̵̼̊s̸̜̃</i>🔥</b>]] ([[User_talk:HotMess|talk]]・[[Special:Contributions/HotMess|edits]])</span> 13:13, 5 March 2024 (UTC) |
||
::::{{Reply|HotMess}} There is also a difference for how they treat html codes. |
|||
::::{| class="wikitable" |
|||
|+ |
|||
|- |
|||
! |
|||
! &ndash; |
|||
! &ndash; <br/>lang=something |
|||
|- |
|||
| <nowiki>{{code}}</nowiki> |
|||
|| {{code|–}} |
|||
|| {{code|–|lang=something}} |
|||
|- |
|||
| <nowiki>{{code/sandbox}}</nowiki> |
|||
|| {{code/sandbox|–}} |
|||
|| {{code/sandbox|–|lang=something}} |
|||
|- |
|||
| <nowiki>{{code/sandbox2}}</nowiki> <br/>(your original request) |
|||
|| {{code/sandbox2|–}} |
|||
|| {{code/sandbox2|–|lang=something}} |
|||
|- |
|||
| <syntaxhighlight inline> |
|||
|| <syntaxhighlight inline>–</syntaxhighlight> |
|||
|| <syntaxhighlight inline lang=something>–</syntaxhighlight> |
|||
|- |
|||
| <code><nowiki> |
|||
|| <code><nowiki>–</nowiki></code> |
|||
|| <code lang=something><nowiki>–</nowiki></code> |
|||
|- |
|||
| <nowiki><code></nowiki> |
|||
|| <code>–</code> |
|||
|| <code lang=something>–</code> |
|||
|} |
|||
::::For context about the need for the change, is there a page/situation where you encountered an issue because of the current template? (It is, of course, possible to have an issue by just using the template 501 times, or on a page with 500 other expensive calls, but I want to know how much this has been an issue.) [[User:SilverLocust|<small style="color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em">SilverLocust</small>]] [[User talk:SilverLocust|💬]] 23:43, 5 March 2024 (UTC) |
Revision as of 23:43, 5 March 2024
This is the talk page for discussing improvements to the Code template. |
|
Archives: 1Auto-archiving period: 6 months |
Template:Code 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. Functionality of the template can be checked using test cases. |
Text and/or other creative content from this version of Template:Code was copied or moved into incubator:Template:Wp/nod/code with this edit. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
|
This page has archives. Sections older than 180 days may be automatically archived by Lowercase sigmabot III. |
Template-protected edit request on 4 March 2024
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Update template to match this edit I made to Template:Code/Sandbox. The specific change to line 1, and is as follows, compared to the current version of Template:Code (disregard the mangled noinclude in the left/old one, it's an issue with Template:TextDiff, new version is on the right anyway):
− | {{#tag: | + | {{#tag:{{#ifeq:{{{lang|{{{2|text}}}}}}|text|code|syntaxhighlight}}|{{{code|{{{1}}}}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|}}}|id={{{id|}}}|style={{{style|}}}|inline=1}}<noinclude> |
The change has been tested in Template:Code/testcases, and produces the expected output.
Purpose of change: makes this template use #tag:code instead of #tag:syntaxhighlight when lang/param 2 is either undefined or has been defined as 'text', but still uses #tag:syntaxhighlight in all other cases. #tag:syntaxhighlight is a WP:EXPENSIVE parser function, and current template behaviour always uses #tag:syntaxhighlight, even when unnecessary (as 'lang=text' has no syntax highlighting) - but, this change ensures that the non-expensive #tag:code will be used instead when syntax highlighting is not necessary. 🔥HOTm̵̟͆e̷̜̓s̵̼̊s̸̜̃🔥 (talk・edits) 20:01, 4 March 2024 (UTC)
- It needs some additional work first. There are differences in markup behavior:
plain ''ABC'' <b>bold</b> {{mdash}} {{PAGENAME}} {{code}} plain
''ABC''
<b>bold</b>
—
Code
{{code/sandbox}} plain
''ABC''
<b>bold</b>
—
Code
<syntaxhighlight inline> plain
''ABC''
<b>bold</b>
{{mdash}}
{{PAGENAME}}
<code><nowiki> plain
''ABC''
<b>bold</b>
{{mdash}}
{{PAGENAME}}
<code> plain
ABC
bold
—
Code
- See this template's documentation about how syntaxhighlight works like code plus nowiki (except that with this template inner templates/magic words expand first). SilverLocust 💬 08:54, 5 March 2024 (UTC)
{{code}} plain
''ABC''
<b>bold</b>
—
Code
{{code/sandbox2}} plain
ABC
bold
—
Code
- @HotMess: I have made a new version in Template:Code/sandbox2 that may be correct — but it could use more checking. [Edit: Now that my changes have been moved to /sandbox, I have put HotMess's original version in /sandbox2.] SilverLocust 💬 10:16, 5 March 2024 (UTC)
- @SilverLocust I've incorporated those changes into Template:Code/sandbox, and updated Template:Code/testcases with those additional checks (and a couple extra checks) - and it appears to be functioning correctly now. 🔥HOTm̵̟͆e̷̜̓s̵̼̊s̸̜̃🔥 (talk・edits) 13:13, 5 March 2024 (UTC)
- @HotMess: I have made a new version in Template:Code/sandbox2 that may be correct — but it could use more checking. [Edit: Now that my changes have been moved to /sandbox, I have put HotMess's original version in /sandbox2.] SilverLocust 💬 10:16, 5 March 2024 (UTC)
- @HotMess: There is also a difference for how they treat html codes.
– –
lang=something{{code}} –
–
{{code/sandbox}} –
–
{{code/sandbox2}}
(your original request)–
–
<syntaxhighlight inline> –
–
<code><nowiki> –
–
<code> –
–
- For context about the need for the change, is there a page/situation where you encountered an issue because of the current template? (It is, of course, possible to have an issue by just using the template 501 times, or on a page with 500 other expensive calls, but I want to know how much this has been an issue.) SilverLocust 💬 23:43, 5 March 2024 (UTC)