Template talk:Code: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
 
m (Removed {{Message}} template from talk page. This action was performed by a bot)
 
Line 1: Line 1:
== Improve [[Template:Code]] with revision [[Special:PermanentLink/301901|301901]] (and also decide what it wants to be) ==
== Improve [[Template:Code]] with revision [[Special:PermanentLink/301901|301901]] (and also decide what it wants to be) ==


{{Message
}}1{{)))}}</code> results in identical behaviour to <code>{{(((}}style{{=}}"user-select: all"{{)))}}</code>
| user = 結衣
| time = 22:32, 29 Apr 2023
| This concerns revision [[Special:PermanentLink/301901|301901]] for [[Template:Code]] and also the template in general.
 
As of revision [[Special:PermanentLink/302080|302080]], Template:Code has regressed from its [[wp:Template:Code|Wikipedia counterpart]] significantly:
* Text is wrapped in <code><kbd<nowiki />></code> instead of <code><syntaxhighlight<nowiki />></code>
:* using <code><kbd<nowiki />></code> to denote computer code is semantically incorrect and will throw surprises at user-agents that expect otherwise;
* <code>{{(((}}style{{)))}}</code> has been co-opted for pre-determined CSS styles instead of allowing editors to specify arbitrary CSS styles
:* this is inconsistent with [[Template:Pre]] by the same maintainer and with the other in-house Wikipedia imports
:* this is another surprise to editors
:* editors can no longer specify arbitrary CSS styles without either a) using <code>#tag:</code>, b) using <code><code<nowiki />></code>, or c) using some nasty syntax hacks
* spurious parameters attempt to solve the inability to provide arbitrary CSS styles with another layer of unnecessary and obscure abstraction
:* e.g., <code>{{(((}}select{{=}}1{{)))}}</code> results in identical behaviour to <code>{{(((}}style{{=}}"user-select: all"{{)))}}</code>
::* this appears to be a recurring element in other templates by the same maintainer
::* this appears to be a recurring element in other templates by the same maintainer
::* editors must now remember a new set of arbitrary integer-key mappings
::* editors must now remember a new set of arbitrary integer-key mappings
Line 37: Line 24:
Perhaps Template:Code would better serve as a wrapper for <code><code<nowiki />></code> with sane CSS defaults (I suppose, as it is now), but maintain compatibility with syntax given by other Wikipedia ports.
Perhaps Template:Code would better serve as a wrapper for <code><code<nowiki />></code> with sane CSS defaults (I suppose, as it is now), but maintain compatibility with syntax given by other Wikipedia ports.


idk :3
idk :3 --[[結衣]] ([[User talk:結衣|talk]]) 22:32, 29 Apr 2023
}}

Latest revision as of 20:42, 17 June 2024

Improve Template:Code with revision 301901 (and also decide what it wants to be)

}}1}}} results in identical behaviour to {{{style="user-select: all"}}}

  • this appears to be a recurring element in other templates by the same maintainer
  • editors must now remember a new set of arbitrary integer-key mappings
  • existing values are fragile; changes to valid values will propagate across all invocations until someone fixes them
  • e.g., {{{color}}} and {{{bg}}} abstract away CSS color and background-color
  • preset CSS styles have inconsistent styling and can reflow the page if changed
  • see: padding, border

Given that this Wiki has pitiful tooling for mass-updates, a template rewrite must:

  • maintain backwards-compatibility with previous invocations; and
  • produce correct backwards-compatible output

while providing new functionality. The code paths for this backwards-compatibility will probably persist until all old invocations are sanitized.

I already have a rewrite (revision 301901) that satisfied these complaints but was reverted almost immediately; changing the internal tag from <syntaxhighlight> to <code> will allow the template from this revision to produce correct output.

I would recommend replacing the current incarnation of Template:Code with a patched revision 301901, pending review.

On the other hand, the site administrators have made dubious changes to the site-wide CSS that revert the Vector skin styles. <code> is effectively indistinguishable from <kbd>; the number of template changes with <kbd> committed where <code> should be is non-zero. Perhaps Template:Code would better serve as a wrapper for <code> with sane CSS defaults (I suppose, as it is now), but maintain compatibility with syntax given by other Wikipedia ports.

idk :3 --結衣 (talk) 22:32, 29 Apr 2023