Template:Created with code/doc

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Parameters for display of codes

Usage

{{Created with code |c1= }}

This is a subtemplate used by many of the SVG created with ... templates and Created with ... templates.
The subtemplate is rather not intended to be used directly, the following restrictions apply:

● The subtemplate itself accepts only the short form of parameters (c1, c2, c3; h1, h2, h3; ...), see Example
● all other Created with ... templates accept every alias of each parameter name (e.g. code = c1 = source)

By the template {{Image generation}} also the short form as well as the long form are accepted, even mixed.

Template parameters

ParameterDescriptionDefaultStatus
c1
code
source
script
codethe source code used for image generation
may not contain |, || ,[[ or }}
(replace by {{!}}, {{!!}}, {{!((}} or {{))}} resp.)
emptyoptional
e1
expl
explanationexplanatory text to be shown above the codeemptyoptional
h1
title
titleheadline to be shown above the code
use title=none to suppress the headline
l1optional
l1
syntax
syntaxone of the supported languages for highlightingtextoptional
f1
format
stylestyle attribute for code displayemptyoptional
s1
collapse
textheadline to be shown instead of the code
to disable standard collapsing use s1=none
emptyoptional
code2
c2
code2nd source code for image generation
may not contain |, || ,[[ or }}
emptyoptional
expl2
e2
explanationexplanatory text to be shown above the 2nd codeemptyoptional
title2
h2
titleheadline for 2nd source code ("none" for suppress)l2optional
syntax2
l2
syntaxone of the supported languages for highlightingtextoptional
format2
f2
stylestyle attribute for 2nd code displayemptyoptional
collapse2
s2
textheadline to be shown instead of the 2nd codeemptyoptional
c3
code3
code3rd source code for image generation
may not contain |, || ,[[ or }}
emptyoptional
e3
expl3
explanationexplanatory text to be shown above the 3rdcodeemptyoptional
h3
title3
titleheadline for 3rd source code ("none" for suppress)l3optional
l3
syntax3
syntaxone of the supported languages for highlightingtextoptional
f3
format3
stylestyle attribute for 3rd code displayemptyoptional
s3
collapse3
textheadline to be shown instead of the 3rd codeemptyoptional
n1textfooting note after code 1emptyoptional
n2textfooting note after code 2emptyoptional
n3textfooting note after code 3emptyoptional
d1categorycategorizes "Images with d1 source code"emptyoptional
d2categorycategorizes "Images with d2 source code"emptyoptional
d3categorycategorizes "Images with d3 source code"emptyoptional

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

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> or substituted to avoid preliminary termination or breaking of the execution.
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 no syntax is 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.
l - syntax
specifies the language of the source code to be highlighted. Some templates preset code (and code2, code3) with languages as default values,
the defaults can be overwritten. Using of syntax=text 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.
s - collapse
defines a text string; when that parameter ist used the text string is shown instead of the collapsed source code.
n - note
defines a text string; will be diaplayed at the bottom of the code box.
d - diffusion
defines a text string for category diffusion within Images including source code in their description.

Example

{{ Created with codec1 = first code examplel1 = python
c2 = second code examplel2 = matlabh2 = seconde2 = 

There is a second code following
c3 = textual datal3 = texth3 = thirds3 = hidden datae3 = 
The third code is hidden: | n3 = finis. }} will display

Python code

first code example

There is a second code following

Second code

second code example

The third code is hidden:

Third code

finis.