Cdml Code
From: CdmlElements
Description
This CmdlElement is used to display text without word wrapping, primarily useful for program code.
Example
The display:
| PRINT "Hello World"
PRINT "Program end." |
|
|
is produced by:
[[code]
PRINT "Hello World"
PRINT "Program end."
]
The following parameters adapt the code-function:
- color selects the text color (default: #000066). (c.f. HtmlColorCodes, CdmlColorNames)
- distance sets the horiszontal distance between the left page border and the code frame in pixel units (default: 50).
- width set the width of the code frame in pixel units (default: 400).
- background sets the background color of the code frame (default: #e7e7e7). (c.f. HtmlColorCodes, CdmlColorNames)
- linewidth sets the width of the border line (default: 2).
- linecolor sets the color of the border line (default: #cccccc). (c.f. HtmlColorCodes, CdmlColorNames)
- padding increases the empty space between the text and the border line (default: 8).
- linenumber starts numbering of lines starting with the value given. Alphanumeric values (=y) start numbering with 1. There is no default value (default is unnumbered lines).
- linenumberformat results in numbering the lines, starting with the value of the paramter linenumber. Use C-syntax for the format, quoting is optional (default: "%3d: ").
More examples
[[code][color=lightgreen][background=#000000][linecolor=lightgreen][width=400]
[padding=20]
the result is 17.314
please enter the new starting value: _
]
|
the result is 17.314
please enter the new starting value: _
|
|
|
- Hint:
- empty lines (CR/LF only) at the beginning and end of the text are ignored. If they are intentional, make them contain at least a blank character.
[[code][linenumber=132]
for(i=0; i<100; i++) {
print("%d\n",i);
}
]
| 132: for(i=0; i<100; i++) {
133: print("%d\n",i);
134: }
|
|
|
[[code][linenumberformat="%05d| "]
for(i=0; i<100; i++) {
print("%d\n",i);
}
]
| 00001| for(i=0; i<100; i++) {
00002| print("%d\n",i);
00003| }
|
|
|
FolderWikiFeatures FolderCdml
|