Template:Code/doc

From Legacy Roblox Wiki
Jump to navigationJump to search

Documentation subpage icon

This is a documentation subpage for Template:Code.
It contains usage information, categories and other content that is not part of the original template page.

This template allows you to have syntax highlighting and a tab width of 4 (can be edited by providing a different size argument) to present code. The default language is Lua.

Usage

{{code|[=]code[|lang=language][|tabwidth=width][|linenumbers=true]}} Note: text between brackets ([ and ]) is optional, text in bold represents a certain value (something you must replace) and the rest represents things that must be present as-is.

Parameters

[empty or 1]
The code itself.
lang
The language of the code. Must be one of the supported languages.
tabwidth
The width of the tabs. Should only be changed if absolutely necessary.
linenumbers
Whether line numbers should be shown.

Notes

  • Only change the tab size if you absolutely need to. If changing the tab size is not absolutely necessary, please keep it to the default tab size, so this wiki can remain consistent.

Examples

Example 1

Code 1

{{code|lang=javascript
|alert("Hello World!");
}}

Result 1

alert("Hello World!");

Example 2

Code 2

{{code|=
for i = 1, 5 do
	print("Hello World!")
end
|linenumbers=true}}

Result 2

for i = 1, 5 do
	print("Hello World!")
end

Supported languages

The lang argument accepts any of the following languages:

  • klonecpp
  • delphi
  • powerbuilder
  • rails
  • scheme
  • teraterm
  • io
  • cfm
  • abap
  • reg
  • bnf
  • oobas
  • bibtex
  • boo
  • sdlbasic
  • typoscript
  • asm
  • locobasic
  • inno
  • oracle11
  • bash
  • awk
  • erlang
  • dos
  • pic16
  • ada
  • klonec
  • verilog
  • email
  • php
  • lscript
  • csharp
  • mapbasic
  • 4cs
  • smalltalk
  • bf
  • visualfoxpro
  • perl
  • genero
  • freebasic
  • whitespace
  • ini
  • xpp
  • java5
  • smarty
  • apache
  • autohotkey
  • kixtart
  • oracle8
  • cpp-qt
  • sql
  • z80
  • make
  • actionscript3
  • vhdl
  • visualprolog
  • idl
  • clojure
  • modula3
  • xorg_conf
  • progress
  • povray
  • vbnet
  • xml
  • jquery
  • objc
  • text
  • gnuplot
  • sas
  • eiffel
  • css
  • c
  • gambas
  • matlab
  • php-brief
  • mmix
  • haskell
  • lua
  • autoit
  • avisynth
  • c_mac
  • fortran
  • latex
  • fsharp
  • powershell
  • java
  • mpasm
  • robots
  • vim
  • dcs
  • winbatch
  • cil
  • fo
  • cuesheet
  • actionscript
  • applescript
  • cpp
  • lotusformulas
  • div
  • lisp
  • gdb
  • ocaml-brief
  • caddcl
  • pascal
  • thinbasic
  • mysql
  • providex
  • mxml
  • newlisp
  • per
  • basic4gl
  • gml
  • lolcode
  • pixelbender
  • m68k
  • gettext
  • ruby
  • systemverilog
  • vb
  • apt_sources
  • lotusscript
  • glsl
  • lsl2
  • scilab
  • d
  • html4strict
  • oberon2
  • javascript
  • blitzbasic
  • dot
  • cadlisp
  • nsis
  • diff
  • rsplus
  • cfdg
  • purebasic
  • plsql
  • scala
  • cobol
  • tcl
  • hq9plus
  • rebol
  • python
  • ocaml
  • cmake
  • prolog
  • asp
  • mirc
  • perl6
  • qbasic
  • properties
  • pike
  • logtalk
  • whois
  • intercal
  • tsql
  • groovy