Template:Created with code

Template documentation[view · edit · history · purge]
This documentation is transcluded from Template:Created with code/doc.
Category:Main message boxes

Parameters for display of codes

Usage


{{Created with code |code= }}

Or use the shorthand
{{Cwcode|… parameters as described …}}

This is mainly a subtemplate of Image generation, but can also be used in stand-alone mode.

Template parameters

ParameterDescriptionDefaultStatus
code
code1
c1
codethe source code used for image generation
may not contain |, || ,[[ or }}
(replace by {{!}}, {{!!}}, {{!((}} or {{))}} resp., or embed everything in <nowiki></nowiki>)
The alias c4= can be used directly from Image generation.[clarification needed]
emptyoptional
title
title1
h1
titleheadline to be shown above the code (see #title}
use title=none to suppress the headline
syntax
syntax1
l1
optional
syntax
syntax1
l1
syntaxone of the supported languages for highlightingtextoptional
format
format1
f1
stylestyle attribute for code display
1st colors are #AFA and #DFD
emptyoptional
collapse
collapse1
s1
textheadline to be shown instead of the code if collapsed
to disable standard collapsing use s1=none
emptyoptional
code2
c2
code2nd source code for image generation
may not contain |, || ,[[ or }} (see code1)
emptyoptional
title2
h2
titleheadline for 2nd source code ("none" for suppress)syntax2
l2
optional
syntax2
l2
syntaxone of the supported languages for highlightingtextoptional
format2
f2
stylestyle attribute for 2nd code display
2nd colors are #DFA and #FEE
emptyoptional
collapse2
s2
textheadline to be shown instead of the 2nd code if collapsedemptyoptional
code3
c3
code3rd source code for image generation
may not contain |, || ,[[ or }} (see code1)
emptyoptional
title3
h3
titleheadline for 3rd source code ("none" for suppress)syntax3
l3
optional
l3
syntax3
syntaxone of the supported languages for highlightingtextoptional
format3
f3
stylestyle attribute for 3rd code display
3rd colors are #FFA and #EEB
emptyoptional
collapse3
s3
textheadline to be shown instead of the 3rd code if collapsedemptyoptional
d1, d2, d3diff_catcategorizes "Images with dx source code"emptyoptional
e1, e2, e3explanationexplanatory text to be shown above the codeemptyoptional
g1, g2, g3grandeurfont sizes for code display (when other than 100%)100optional
n1, n2, n3notefooting note after codex (within the border)emptyoptional
+name(+c in Igen) create a name as an Information fieldSource codeoptional
ntswitchwhen specified (even empty) avoids hx interpretion as headingsemptyoptional
ccswitchwhen specified (even empty) the categorization is suppressedemptyoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Category:Templates using an unknown approach for internationalisation

Categorizing

Occurs normally centralized by Image generation where it always can be suppressed with the parameter "cc": cc=, cc=n,cc=-
The string " code" is inserted between the toolname and the subcategory, it looks like: Valid/Invalid SVG created with toolcat codesubcat
Depending on the defined categories, often either code or subcat can be used, and the other one needs to be suppressed.

External code

For the code/code1/c1 parameter the special value external can be used, instead of a code block a line is displayed with the value of parameter e1 to show that the code is contained elsewhere:

|c1=external|e1=See the SVG code in the {{F|Test.svg|+}}. displays
 
See the SVG code in the File:Test.svg.
with suppression of the categorizing.

Parameters

c - code
Because the source code is passed as a parameter value, characters or combinations as |, [[, }} may not appear within the source code; such characters or combinations must be enclosed in <nowiki></nowiki> or substituted to avoid preliminary termination or breaking of the execution.
When e.g. <!-- should be shown, it can be done with {{ Charsubst | < }}!-- to avoid misinterpretion.
e - expl
May specify any text, wiki syntax or other content; precedes the block with the code.
h - title
The default value for a title is "syntax code". When syntax is not specified, defaults are "Source code", "Data code" and "Text code".
Every text string can be used to title the code, but "none" can be used to suppress any titling, e.g. when the source code is collapsed.
Any text string is followed by " code", like every other headline text, but that display of " code" can be suppressed when the headline text starts with "_", or with "<nowiki/> " (the tag "<nowiki/>" followed by a slash).
l - syntax
Specifies the language of the source code to be highlighted. Some templates preset code (and code2, code3) with languages as default values, but not
Setswana: Created with code
itself.
The defaults can be overwritten. When using as subtemplate adding of syntax=text (syntax2, syntax3) suppresses any highlighting.
f - format
With this parameter values of the <div style="clear:both;border:1px solid#AFE;background-color:#EFE;margin:2px 0;">
can be altered or completed. The three codes use different border and background colors, #AFE/#EFE, #DFA/#FEE and #FFA/#EEB.
g - greatness
Another font size than 100%[clarification needed]; can as well be specified with |fx=font-size:xxx%.
s - collapse
Defines a text string; when that parameter is used, the text string is shown instead of the collapsed source code.
n - note
Defines a text string; will be displayed at the bottom of the code box.
d - diffusion
Defines a text string for category diffusion within Images including source code in their description.[clarification needed]
+ - name
defines a name, esp. for Other fields of {{Information}}.

Example

{{ Created with code | code1 = first code example | syntax1 = python
| code2 = second code example | syntax2 = matlab | title2 = second | e2 = :There is a second code following
| code3 = textual data | syntax3 = text | title3 = _third | collapse3 = hidden data | e3 = :The third code is hidden: | n3 = finis. | format3 = background-color:#FFA }} will display

Python

first code example

There is a second code following

Second code

second code example

The third code is hidden:

third

hidden data
textual data
finis.
Category:Main message boxesCategory:Heavily used templates Category:Created with ... templates#. Category:Image generation subtemplates#+
Category:Created with ... templates Category:Heavily used templates Category:Image generation subtemplates Category:Main message boxes Category:Templates using an unknown approach for internationalisation