Note: You are viewing an old version of this page. View the current version.

Plugin RawHtml disabled. Raw HTML is only allowed in locked pages.
<?plugin RawHtml

<pre class="brush: c-sharp;">
function test() : String
{
        return 10;
}
</pre>

?>
This is sum verbatim shiz.
[even wiki links don't work|see]
<a href="blah">blah</a>

Naked:

This is a test
[wiki|link]

Ruby:

class Blah
  def meow
    puts arf
  end
end
[wiki|link]

C:

#include <blah.h>

int main (int argc, char **argv) {
  return 0
}

Longopt:

class Block_code extends Block_pre
{
    var $_re = '<code';

    var $brushes = Array(
        "bash", "shell", "c-sharp", "csharp",
        "cpp", "c", "css", "delphi", "pas",
        "pascal", "diff", "patch", "groovy",
        "js", "jscript", "javascript", "java",
        "perl", "pl", "php", "plain", "text",
        "py", "python", "rails", "ror", "ruby",
        "scala", "sql", "vb", "vbnet", "xml",
        "xhtml", "xslt", "html", "xhtml");

    function _match (&$input, $m) {
        $endtag = '</code>';
        $text = array();
        $pos = $input->getPos();

        $brush = strtolower(trim(rtrim($m->postmatch, ">")));
        $pat = "/^brush=[\"']{0,1}(.*?)[\"']{0,1}$/";
        $mat = preg_match($pat, $brush, $match);

        echo "<pre>";
        printf("Mat: %s\n", print_r($mat, true));
        printf("Pat: %s\n", print_r($pat, true));
        printf("Brush: %s\n", print_r($brush, true));
        printf("Match: %s\n", print_r($match, true));
        printf("In: %s\n", print_r(in_array($match[1], $this->brushes), true));
        echo "</pre>";

        if (0 > preg_match($pat, $brush, $match) && $brush = trim($match[1]) && in_array($brush, $this->brushes))
            $brush = $brush;
        else if (in_array($brush, $this->brushes))
            $brush = $brush;
        else
            $brush = "plain";

        printf("Brush: %s<br>\n", print_r($brush, true));

        $line = $input->nextLine();
        while (ltrim($line) != $endtag) {
            $text[] = $line;
            if (($line = $input->nextLine()) === false) {
                $input->setPos($pos);
                return false;
            }
        }
        $input->advance();

        $text = join("\n", $text);

        $this->_element = new Block_HtmlElement('pre', array('class' => sprintf('brush: %s;', $brush)), $text);
        return true;
    }
}

Long without quotes:

<blah>
  <foo>
   <bar />
  </foo>
</blah>