This is the template test cases page for the sandbox of Template:Code. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
<html> <head> <title>...</title> </head> <body>...</body> </html>
Most HTML elements are enclosed between a start tag and an end tag, such as <p>...</p>
. Some are not, such as <br>
.
<html> <head> <title>...</title> </head> <body>...</body> </html>
Most HTML elements are enclosed between a start tag and an end tag, such as <p>...</p>
. Some are not, such as <br>
.
Fontsize in FF:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<code>...</code>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
plain | ''ABC'' | <b>bold</b> | <b>bold</b> lang=html | ((mdash)) | ((PAGENAME)) | |
---|---|---|---|---|---|---|
((code)) | plain |
''ABC'' |
<b>bold</b> |
<b>bold</b> |
— |
Code/testcases
|
((code/sandbox)) | plain |
''ABC'' |
<b>bold</b> |
<b>bold</b> |
— |
Code/testcases
|
<syntaxhighlight inline> | plain |
''ABC'' |
<b>bold</b> |
<b>bold</b> |
((mdash)) |
((PAGENAME))
|
<code><nowiki> | plain |
''ABC'' |
<b>bold</b> |
<b>bold</b> |
((mdash)) |
((PAGENAME))
|
<code> | plain |
ABC |
bold |
bold |
— |
Code/testcases
|
– | – lang=something | |
---|---|---|
((code)) | –
|
–
|
((code/sandbox)) | –
|
–
|
<syntaxhighlight inline> | –
|
–
|
<code><nowiki> | –
|
–
|
<code> | –
|
–
|
fee fi fo fum
baz quux.<div id="quux" class="weasel-razor">blah blah blah</div>
baz quux.! !
! !Spaces between proportional and monospaced segments are (depending on browser) precisely or very close to precisely the same as the spaces between characters inside the monospaced segment (which are necessarily larger than those between characters in the proportional segments).
fee fi fo fum
baz quux.<div id="quux" class="weasel-razor">blah blah blah</div>
baz quux.! !
! !Spaces between proportional and monospaced segments are (depending on browser) farcically smaller than the spaces between characters inside the monospaced segment, making the content weird-looking and hard to parse.
Blow up your font size to twice normal or so, and get out a ruler.
((kbd))
(intentionally wider padding to match wider monospacing)((kbd|spacing=n))
((samp))
! !
! ! ((code/sandbox))
! !
! ! ((code))
! !
! ! <code>
For cases where the padding left or right is undesirable, use |l=n
or |r=n
(or any other value, like 'no" or "0", with either parameter:
! !
! ! ((code/sandbox|l=n))
! !
! ! ((code/sandbox|r=n))
! !
! ! ((code/sandbox|l=n|r=n))
! !
! ! ((code/sandbox))
! !
! ! ((code|l=n))
! !
! ! ((code|r=n))
! !
! ! ((code|l=n|r=n))
! !
! ! ((code))
The declaration ((code |lang=cpp |int foo(const std::string& bar, const std::vector<long double*>& baz);)) is the prototype for a function defined later.
If the code contains an [[equals sign]], such as ((code |lang=javascript |code=var img = document.getElementsByTagName("img");))...
The following is an example of a main method in Java: ((code | public static void main(string[] args){ System.out.println("Hello world!"); } | java))
int foo(const std::string& bar, const std::vector<long double*>& baz);
is the prototype for a function defined later.var img = document.getElementsByTagName("img");
...public static void main(string[] args){ System.out.println("Hello world!"); }
int foo(const std::string& bar, const std::vector<long double*>& baz);
is the prototype for a function defined later.var img = document.getElementsByTagName("img");
...public static void main(string[] args){ System.out.println("Hello world!"); }