Template:Code: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
(+TR)
imported>FrozenPlum
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<code class={{{class|code}}} style={{{style|}}}>{{#tag:syntaxhighlight|{{{1|}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|code}}}|id={{{id|}}}|style={{{style|}}}|enclose="none"}}</code><noinclude>
<onlyinclude><includeonly><code class={{{class|code}}} style={{{style|}}}>{{#tag:syntaxhighlight|{{{1|}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|code}}}|id={{{id|}}}|style={{{style|}}}|enclose="none"}}</code></includeonly></onlyinclude>
{{doc}}
{{Documentation}}
[[Category:Formatting templates]]
[[tr:Şablon:Kod]]</noinclude><!--

Base template copied over from https://en.wikipedia.org/wiki/Template:Code ->
{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang={{{lang|{{{2|text}}}}}}|class={{{class|}}}|id={{{id|}}}|style={{{style|}}}|inline=1}}

https://www.mediawiki.org/wiki/Template:Code ->
then:
<code class="{{{class|code}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}}>{{#tag:syntaxhighlight|{{{1|}}}|lang="{{{lang|{{{2|text}}}}}}"|enclose="none"}}</code>
now:
{{#if:{{{inline|}}}|<code {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}}>{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang="{{{lang|{{{2|text}}}}}}"|enclose="none"}}</code>|{{#tag:syntaxhighlight
|{{{1|}}}
|lang={{{2|bash}}}
}}}}
-->

Latest revision as of 02:36, 29 March 2022

[view | edit | purge]Template Documentation

To be used if you want to list some short code, which you would like to stand out. Similar to using <code></code> tags, except that it has a grey background.

Usage

Use {{code|Code to display}}, which results in Code to display.

Unnamed parameter 1

The code to display.

class=

CSS class(es).

id=

Id attribute.

lang=

The language of code.

Examples

{{code|code|lang{{=}}css|border:1px solid #fff}} => results in border:1px solid #fff

Note: Template based off wikipedia:Template:Code and mw:Template:Code

[view | edit | purge]The above documentation is transcluded from Template:Code/doc.