Overview

Packages

  • None
  • Pastie

Classes

  • Pastie_Api
  • Pastie_Application
  • Pastie_Exception
  • Pastie_Highlighter
  • Pastie_Highlighter_LibGeshi
  • Pastie_Highlighter_TextHighlighter
  • Pastie_Test
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * 
  4:  * @package Pastie
  5:  */
  6: require_once 'geshi.php';
  7: 
  8: // This file is named LibGeshi to avoid recursive includes/requires.
  9: class Pastie_Highlighter_LibGeshi extends Pastie_Highlighter {
 10:     public static function output($text, $syntax = 'none') {
 11:         if ($syntax == 'none') {
 12:             return '<pre>' . $text . '</pre>';
 13:         } else {
 14:             // Since we may be coming from another syntax highlighter,
 15:             // we'll try downcasing the syntax name and hope we get lucky.
 16:             $syntax = strtolower($syntax);
 17:             $geshi = new GeSHi($text, $syntax);
 18:         }
 19:         $geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
 20:         $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
 21:         return $geshi->parse_code();
 22:     }
 23: 
 24:     public static function getSyntaxes()
 25:     {
 26:         return array(
 27:             "4cs",
 28:             "abap",
 29:             "actionscript",
 30:             "actionscript3",
 31:             "ada",
 32:             "apache",
 33:             "applescript",
 34:             "apt_sources",
 35:             "asm",
 36:             "asp",
 37:             "autohotkey",
 38:             "autoit",
 39:             "avisynth",
 40:             "awk",
 41:             "bash",
 42:             "basic4gl",
 43:             "bf",
 44:             "bibtex",
 45:             "blitzbasic",
 46:             "bnf",
 47:             "boo",
 48:             "c",
 49:             "c_mac",
 50:             "caddcl",
 51:             "cadlisp",
 52:             "cfdg",
 53:             "cfm",
 54:             "cil",
 55:             "clojure",
 56:             "cmake",
 57:             "cobol",
 58:             "cpp-qt",
 59:             "cpp",
 60:             "csharp",
 61:             "css",
 62:             "cuesheet",
 63:             "d",
 64:             "dcs",
 65:             "delphi",
 66:             "diff",
 67:             "div",
 68:             "dos",
 69:             "dot",
 70:             "eiffel",
 71:             "email",
 72:             "erlang",
 73:             "fo",
 74:             "fortran",
 75:             "freebasic",
 76:             "fsharp",
 77:             "gambas",
 78:             "gdb",
 79:             "genero",
 80:             "gettext",
 81:             "glsl",
 82:             "gml",
 83:             "gnuplot",
 84:             "groovy",
 85:             "haskell",
 86:             "hq9plus",
 87:             "html4strict",
 88:             "idl",
 89:             "ini",
 90:             "inno",
 91:             "intercal",
 92:             "io",
 93:             "java",
 94:             "java5",
 95:             "javascript",
 96:             "jquery",
 97:             "kixtart",
 98:             "klonec",
 99:             "klonecpp",
100:             "latex",
101:             "lisp",
102:             "locobasic",
103:             "logtalk",
104:             "lolcode",
105:             "lotusformulas",
106:             "lotusscript",
107:             "lscript",
108:             "lsl2",
109:             "lua",
110:             "m68k",
111:             "make",
112:             "mapbasic",
113:             "matlab",
114:             "mirc",
115:             "mmix",
116:             "modula3",
117:             "mpasm",
118:             "mxml",
119:             "mysql",
120:             "newlisp",
121:             "nsis",
122:             "oberon2",
123:             "objc",
124:             "ocaml-brief",
125:             "ocaml",
126:             "oobas",
127:             "oracle11",
128:             "oracle8",
129:             "pascal",
130:             "per",
131:             "perl",
132:             "perl6",
133:             "php-brief",
134:             "php",
135:             "pic16",
136:             "pike",
137:             "pixelbender",
138:             "plsql",
139:             "povray",
140:             "powerbuilder",
141:             "powershell",
142:             "progress",
143:             "prolog",
144:             "properties",
145:             "providex",
146:             "purebasic",
147:             "python",
148:             "qbasic",
149:             "rails",
150:             "rebol",
151:             "reg",
152:             "robots",
153:             "rsplus",
154:             "ruby",
155:             "sas",
156:             "scala",
157:             "scheme",
158:             "scilab",
159:             "sdlbasic",
160:             "smalltalk",
161:             "smarty",
162:             "sql",
163:             "systemverilog",
164:             "tcl",
165:             "teraterm",
166:             "text",
167:             "thinbasic",
168:             "tsql",
169:             "typoscript",
170:             "vb",
171:             "vbnet",
172:             "verilog",
173:             "vhdl",
174:             "vim",
175:             "visualfoxpro",
176:             "visualprolog",
177:             "whitespace",
178:             "whois",
179:             "winbatch",
180:             "xml",
181:             "xorg_conf",
182:             "xpp",
183:             "z80"
184:         );
185:     }
186: }
187: 
API documentation generated by ApiGen