Template:CB
{{{1}}}
Purpose
Create a code block which can be indented with the usual :
indentation marker. Normally, a preformatted text block can be inserted with an additional space in the beginning, e.g.
MY_SPECIAL_TAG = A B C
will print as:
MY_SPECIAL_TAG = A B C
However, this syntax does not allow indenting, e.g., in lists. The CB
(as in Code Block) template allows the box to be indented any level.
Warning: Unfortunately, this currently works for single lines, multiple lines are unreadable. |
Parameters
{{CB|<content>|<<padding>>}}
content
: The content of the code block.padding
: (optional) Specifies the padding of the code box, the default is1em
.
Examples
Without optional arguments the following example
::{{CB|MY_SPECIAL_TAG {{=}} A B C}}
gives:
MY_SPECIAL_TAG = A B C
Note that the box is correctly indented two levels. The padding can be reduced with the optional argument, e.g.:
::{{CB|MY_SPECIAL_TAG {{=}} A B C|0.5em}}
results in:
MY_SPECIAL_TAG = A B C
Problems and workarounds
The content
cannot contain the "=" character because this has a special meaning for named template parameters. Therefore, we have to use the {{=}}
template instead.