cc – Template
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Add Templates category) |
Lou Montana (talk | contribs) (Add partial multiline support) |
||
Line 1: | Line 1: | ||
<includeonly><span style="color: #00F; font-style: italic | <includeonly>{{#ifeq:{{{1}}} | ||
|{{#replace:{{{1}}}|<nowiki/> | |||
<nowiki/>|}} | |||
|<span style="color: #00F; font-style: italic"><nowiki>//</nowiki> {{Trim|{{{1|-no comment defined-}}}}}</span> | |||
|<span style="color: #00F; font-style: italic">/* | |||
{{#ifeq: | |||
{{#replace:{{{1}}}|<nowiki> | |||
</nowiki>|}}| | |||
{{#replace:{{{1}}}|<nowiki/> | |||
<nowiki/> <nowiki/>|}} | |||
|{{Trim|{{{1|-no comment defined-}}}}} | |||
<nowiki/>*/ | |||
|<nowiki/> | |||
{{{1|-no comment defined-}}} | |||
<nowiki/>*/}}</span> | |||
}}</includeonly><noinclude>__NOTOC__ | |||
Displays a code comment. | Displays a code comment. | ||
{| style="float: right; min-width: 50em; max-width: 50%" | |||
| colspan="4" | | |||
{{Important|This template has an issue with multiline comments in code blocks formatted with space-starting lines (see below). Use <tt><code></tt> tags instead for multiline comments.}} | |||
|- | |||
| style="vertical-align: top" | | |||
spaced | |||
{{cc|test1 | |||
test2 | |||
test3}} | |||
| style="vertical-align: top" | | |||
spaced + line return | |||
{{cc| | |||
test1 | |||
test2 | |||
test3}} | |||
| style="vertical-align: top" | | |||
code tag | |||
<code>{{cc|test1 | |||
test2 | |||
test3}}</code> | |||
| style="vertical-align: top" | | |||
code tag + line return | |||
<code>{{cc| | |||
test1 | |||
test2 | |||
test3}}</code> | |||
|} | |||
== Usage == | == Usage == | ||
{{<nowiki/>cc|'''''message'''''}} | |||
* message: comment to display | |||
= | {| class="wikitable" | ||
|+ Examples | |||
! Code | |||
! Result | |||
|- | |||
| <nowiki>{{cc}}</nowiki> | |||
| {{cc}} | |||
|- | |||
| <nowiki>{{cc|this code is wonderful}}</nowiki> | |||
| {{cc|this code is wonderful}} | |||
|- | |||
| <nowiki>{{cc|this | |||
code | |||
is | |||
wonderful}}</nowiki> | |||
| | |||
{{cc|this | |||
code | |||
is | |||
wonderful}} | |||
|- | |||
| | |||
<pre><code>{{cc|this | |||
code | |||
is | |||
wonderful}}</code></pre> | |||
| <span style="color: #00F; font-style: italic; white-space: pre">/* | |||
this | |||
code | |||
is | |||
wonderful | |||
<nowiki/>*/</span> | |||
|- | |||
| | |||
<pre><code>{{cc| | |||
this | |||
code | |||
is | |||
wonderful}}</code></pre> | |||
| <span style="color: #00F; font-style: italic; white-space: pre">/* | |||
this | |||
code | |||
is | |||
wonderful | |||
<nowiki/>*/</span> | |||
|} | |||
== Source == | == Source == | ||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
<span style="color: #00F; font-style: italic | <span style="color: #00F; font-style: italic"><nowiki>//</nowiki> {{Trim|{{{1|-no comment defined-}}}}}</span> | ||
</syntaxhighlight> | |||
== See also == | == See also == |
Revision as of 19:11, 29 November 2020
Displays a code comment.
spaced /*
test1 test2 test3 */ |
spaced + line return /*
test1 test2 test3 */ |
code tag
|
code tag + line return
|
Usage
{{cc|message}}
- message: comment to display
Code | Result |
---|---|
{{cc}} | // -no comment defined- |
{{cc|this code is wonderful}} | // this code is wonderful |
{{cc|this code is wonderful}} |
/* this code is wonderful */ |
<code>{{cc|this code is wonderful}}</code> |
/*
this code is wonderful */ |
<code>{{cc| this code is wonderful}}</code> |
/*
this code is wonderful */ |
Source
<span style="color: #00F; font-style: italic"><nowiki>//</nowiki> {{Trim|{{{1|-no comment defined-}}}}}</span>