Template:Code

From OLPC
Revision as of 22:02, 1 August 2012 by Patrol (talk | contribs) (Created page with '<code>{{{1}}}</code><noinclude> ==Usage== {{Code|<nowiki>{{Code|code line}}</nowiki>}} {{Code|This is a long line of code that may have many words that continue for a long lon…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{{{1}}}

Usage

{{Code|code line}}

This is a long line of code that may have many words that continue for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long length.

Used to highlight code samples in an enlarged (through the site's main.css), monospace typeface that is easier to read than the default.

The template form is shorter and easier to enter while editing.

For code blocks

 <nowiki>
Start with a space in the first column,
(before the <nowiki>).

Then your block format will be
    maintained.
 
This is good for copying in code blocks:

def function():
    """documentation string"""

    if True:
        print True
    else:
        print False</nowiki>

Working Example (click edit to see wikicode)

def function():
    """documentation string"""

    if True:
        print True
    else:
        print False