Blocks: Code

    Change View to Source

    In general, it is easier to edit code blocks by looking at the source view.  Select "Source" from the "View" dropdown box as in the following image:

    View_Source.png

    The PRE Tag

    Source code is placed inside a PRE HTML tag.  For example, let's say we have the C++ class definition

    class MyClass

    {

    private:

        int m_SomeInt;

    };

    We can write the following in source view:

    <pre function="syntax.cpp" class="script">
    #define BIG_VALUE 7

    class MyClass
    {
    private:
        int m_SomeInt;

    public:
        bool IsSomeIntBig()
        {
            return (m_SomeInt >= BIG_VALUE);
        }
    };
    </pre>

    This will be rendered as:

    #define BIG_VALUE 7
    
    class MyClass
    {
    private:
        int m_SomeInt;
    
    public:
        bool IsSomeIntBig()
        {
            return (m_SomeInt >= BIG_VALUE);
        }
    };

    Language Support

    This wiki supports syntax highliting in many languages, simply by changing the function attribute in the PRE tag.  Supported languages are in the following table.

    Language function Attribute
    ActionScript 3 syntax.as3
    ColdFusion syntax.coldfusion
    C/C++ syntax.cpp
    C# syntax.csharp
    DekiScript syntax.dekiscript
    Delphi syntax.delphi
    Diff syntax.diff
    Erlang syntax.erlang
    Groovy syntax.groovy
    HTML syntax.HTML
    Java syntax.Java
    Java FX syntax.JavaFX
    JavaScript syntax.JavaScript
    Perl syntax.perl
    PHP syntax.php
    PowerShell syntax.powershell
    Python syntax.python
    Ruby syntax.ruby
    Scala syntax.scala
    Shell syntax.shell
    SQL syntax.sql
    Plain Text syntax.text
    Visual Basic syntax.vb
    XML syntax.xml
    Tag page (Edit tags)
    • No tags
    Pages that link here
    Page statistics
    1342 view(s), 8 edit(s) and 2948 character(s)

    Comments

    You must login to post a comment.

    Attach file

    Attachments