begin
require 'pygments.rb'
rescue LoadError
end
module WikiCloth
class SourceExtension < Extension
VALID_LANGUAGES = [ 'as','applescript','arm','asp','asm','awk','bat','bibtex','bbcode','bison','lua',
'bms','boo','c','c++','cc','cpp','cxx','h','hh','hpp','hxx','clojure','cbl','cob','cobol','cfc','cfm',
'coldfusion','csharp','cs','css','d','diff','patch','erlang','erl','hrl','go','hs','haskell','html',
'htm','xml','xhtml','httpd','js','javascript','matlab','m','perl','cgi','pl','plex','plx','pm','php',
'php3','php4','php5','php6','python','py','ruby','rb' ]
#
', '').gsub!('', '') rescue => err error = "#{err.message}" end elsif File.exists?(highlight_path) begin IO.popen("#{highlight_path} #{highlight_options} -f --syntax #{buffer.element_attributes['lang'].downcase}", "r+") do |io| io.puts content io.close_write content = io.read end rescue => err error = "#{err.message}" end else content = content.gsub('<','<').gsub('>','>') end if error.nil? "
#{content}" else error end end end end