Jump to content

Template:ArtBox: Difference between revisions

From wikiNonStop
Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:
{{#if:{{{scheme|}}}|{{#tag:templatestyles||src="ArtBox/{{{scheme}}}.css"}}}}
{{#if:{{{scheme|}}}|{{#tag:templatestyles||src="ArtBox/{{{scheme}}}.css"}}}}
<div class="wt-artbox-wrapper wt-artbox-{{{scheme|noscheme}}}">
<div class="wt-artbox-wrapper wt-artbox-{{{scheme|noscheme}}}">
{{#if:{{{name|}}}|<div class="wt-artbox-header"><div class="wt-artbox-icon">{{{icon}}}</div><div class="wt-artbox-title">{{{name}}}</div><div class="wt-artbox-fill"></div></div>}}
{{#if:{{{name|}}}|<div class="wt-artbox-header">
<div class="wt-artbox-icon" >{{{icon}}}</div>
<div class="wt-artbox-title">{{{name}}}</div>
<div class="wt-artbox-fill"></div>
</div>
}}
{{#tag:syntaxhighlight|{{{code|{{{1|}}}}}}|lang="{{{lang|bash}}}"
{{#tag:syntaxhighlight|{{{code|{{{1|}}}}}}|lang="{{{lang|bash}}}"
|highlight="{{{highlight|}}}"
|highlight="{{{highlight|}}}"

Revision as of 09:35, 7 April 2026

Template documentation

This template augments a <syntaxhighlight> block with fancy colors and an optional title

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Titlename

Title (name) of this code sample. Often a filename

Stringsuggested
Programming languagelang

Name of lexer to use for highlighting

Default
text
Example
shell-session
Stringsuggested
Codecode 1

Code sample to render

Stringrequired
Highlighted lineshighlight

Line(s) in example to highlight. Comma separated list of line numbers

Stringoptional
Show line numbersline

Enable line numbers for sample

Booleanoptional
Starting line numberstart

Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.

Default
1
Numberoptional
Color schemescheme

Color scheme to use.

Default
dark
Stringoptional
Copy buttoncopy

Show a "copy" button to copy the code to the clipboard

Booleanoptional

Examples

{{ArtBox |echo "hello world!"}}
echo "hello world!"
{{ArtBox |echo "hello world!" |lang=text |scheme=light}}
echo "hello world!"
{{ArtBox |$ echo "hello world!" |lang=shell-session |scheme=dark}}
$ echo "hello world!"
{{ArtBox |code=<nowiki>{{ArtBox}}</nowiki> |lang=wikitext}}
{{ArtBox}}
{{ArtBox |name=ingress.yaml |lang=yaml 
|scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
{{{icon}}}
ingress.yaml
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
{{ArtBox |name=metadata |lang=yaml 
|scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
{{{icon}}}
metadata
name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
{{ArtBox |icon=Text-x-generic-attention.svg
|name=NBEXEC |lang=nbexec 
|scheme=light |line=1 
|start=5 |highlight=1,4 
|code=
!Comment lang="nbexec"
$SETS JOBNAME FPADTE1

!*************************************
!DESCRIPTION: Delete Files           *
!*************************************
! jjjj-mm-dd AUTHOR  AENDERUNGSGRUND *
! ---------- ------  --------------- *
! 2005-00-00 AV      Initial Version *
!*************************************

$SETS LISTVAR OFF
$SETS LISTBAT BATCH
$CHAIN $BATCH.TAKEOVER.GENV1
$LIST BATCH

$IF PROD $GOTO WORK010
$IF BACK $GOTO WORK010
$GOTO FINISH

! Global Settings --- Do not change
$SETS J-S-T   '#TODAY %d %m %Y %H:%M'
$SETS LOG-FIL $WORK1.ZDBASE.F'#TODAY %y%j'
$SETS CC 0
$SETS TI 0
$SETS D-F 0

:DELAY 1 minute
.SETCC
$SETS #CC 'CC'
$SETS #TI 'TI'
$SETS #BP 'BP'
.FINISH

}}
Text-x-generic-attention.svg
NBEXEC
!Comment lang="nbexec"
$SETS JOBNAME FPADTE1

!*************************************
!DESCRIPTION: Delete Files           *
!*************************************
! jjjj-mm-dd AUTHOR  AENDERUNGSGRUND *
! ---------- ------  --------------- *
! 2005-00-00 AV      Initial Version *
!*************************************

$SETS LISTVAR OFF
$SETS LISTBAT BATCH
$CHAIN $BATCH.TAKEOVER.GENV1
$LIST BATCH

$IF PROD $GOTO WORK010
$IF BACK $GOTO WORK010
$GOTO FINISH

! Global Settings --- Do not change
$SETS J-S-T   '#TODAY %d %m %Y %H:%M'
$SETS LOG-FIL $WORK1.ZDBASE.F'#TODAY %y%j'
$SETS CC 0
$SETS TI 0
$SETS D-F 0

:DELAY 1 minute
.SETCC
$SETS #CC 'CC'
$SETS #TI 'TI'
$SETS #BP 'BP'
.FINISH
{{ArtBox |echo "hello world!" |copy=}}
echo "hello world!"

Display File

https://www.flaticon.com/free-icons/script" title="script icons">Script icons created by kerismaker - Flaticon


Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also