cc – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add partial multiline support)
m (Fix demo)
Line 16: Line 16:
}}</includeonly><noinclude>__NOTOC__
}}</includeonly><noinclude>__NOTOC__
Displays a code comment.
Displays a code comment.
== Usage ==
{| style="float: right; min-width: 50em; max-width: 50%"
{| style="float: right; min-width: 50em; max-width: 50%"
| colspan="4" |
| colspan="4" |
{{Important|This template has an issue with multiline comments in code blocks formatted with space-starting lines (see below). Use <tt>&lt;code&gt;</tt> tags instead for multiline comments.}}
{{Important|
* There is an issue with multiline comments in space-triggered code blocks (see below). Use <tt>&lt;code&gt;</tt> tags instead for multiline comments.
* There is also an issue where leaving a blank line would break the code block (even in <tt>&lt;code&gt;</tt> tags - use <tt>&lt;br&gt;</tt> twice instead)}}
|-
|-
| style="vertical-align: top" |
| style="vertical-align: top" |
Line 30: Line 34:
  test1
  test1
  test2
  test2
  test3}}
  test3}}
| style="vertical-align: top" |
| style="vertical-align: top" |
Line 41: Line 46:
test1
test1
test2
test2
test3}}</code>
test3}}</code>
|}
|}
== Usage ==
{{<nowiki/>cc|'''''message'''''}}
{{<nowiki/>cc|'''''message'''''}}
* message: comment to display
* message: comment to display
Line 57: Line 62:
| <nowiki>{{cc|this code is wonderful}}</nowiki>
| <nowiki>{{cc|this code is wonderful}}</nowiki>
| {{cc|this code is wonderful}}
| {{cc|this code is wonderful}}
|-
| <nowiki>{{cc|this
code
is
wonderful}}</nowiki>
|
{{cc|this
code
is
wonderful}}
|-
|-
|
|
Line 84: Line 79:
this
this
code
code
is
is
wonderful}}</code></pre>
wonderful
 
}}</code></pre>
| <span style="color: #00F; font-style: italic; white-space: pre">/*
| <span style="color: #00F; font-style: italic; white-space: pre">/*
this
this
code
code
is
is
wonderful
wonderful

Revision as of 01:53, 30 November 2020

Displays a code comment.

Usage

  • There is an issue with multiline comments in space-triggered code blocks (see below). Use <code> tags instead for multiline comments.
  • There is also an issue where leaving a blank line would break the code block (even in <code> tags - use <br> twice instead)

spaced

/*

test1
test2
test3
*/

spaced + line return

/*

test1
test2
test3
*/

code tag /* test1 test2 test3 */

code tag + line return /* test1 test2

test3 */

{{cc|message}}

  • message: comment to display
Examples
Code Result
{{cc}} // -no comment defined-
{{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>&nbsp;{{Trim|{{{1|-no comment defined-}}}}}</span>

See also