@@ -38,7 +38,8 @@ import Text.Pandoc.Pretty (render)
38import Text.Pandoc.ImageSize
38import Text.Pandoc.ImageSize
39import Text.Pandoc.Templates (renderTemplate')
39import Text.Pandoc.Templates (renderTemplate')
40import Text.Pandoc.XML ( escapeStringForXML )
40import Text.Pandoc.XML ( escapeStringForXML )
41−import Data.List ( intersect, intercalate )
41+import Data.List ( intercalate )
42+import qualified Data.Set as Set
42import Network.URI ( isURI )
43import Network.URI ( isURI )
43import Control.Monad.Reader
44import Control.Monad.Reader
44import Control.Monad.State
45import Control.Monad.State
@@ -137,23 +138,15 @@ blockToMediaWiki (Header level _ inlines) = do
137 return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"
138 return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"
139blockToMediaWiki (CodeBlock (_,classes,_) str) = do
140blockToMediaWiki (CodeBlock (_,classes,_) str) = do
140− let at = classes `intersect` ["actionscript", "ada", "apache", "applescript", "asm", "asp",
141+ let at = Set.fromList classes `Set.intersection` highlightingLangs
141− "autoit", "bash", "blitzbasic", "bnf", "c", "c_mac", "caddcl", "cadlisp", "cfdg", "cfm",
142− "cpp", "cpp-qt", "csharp", "css", "d", "delphi", "diff", "div", "dos", "eiffel", "fortran",
143− "freebasic", "gml", "groovy", "html4strict", "idl", "ini", "inno", "io", "java", "java5",
144− "javascript", "latex", "lisp", "lua", "matlab", "mirc", "mpasm", "mysql", "nsis", "objc",
145− "ocaml", "ocaml-brief", "oobas", "oracle8", "pascal", "perl", "php", "php-brief", "plsql",
146− "python", "qbasic", "rails", "reg", "robots", "ruby", "sas", "scheme", "sdlbasic",
147− "smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl",
148− "visualfoxpro", "winbatch", "xml", "xpp", "z80"]
150− if null at
143+ case Set.toList at of
151− then "<pre" ++ (if null classes
144+ [] -> "<pre" ++ (if null classes
152− then ">"
145+ then ">"
153− else " class=\"" ++ unwords classes ++ "\">") ++
146+ else " class=\"" ++ unwords classes ++ "\">") ++
154− escapeString str ++ "</pre>"
147+ escapeString str ++ "</pre>"
155− else "<source lang=\"" ++ head at ++ "\">" ++ str ++ "</source>"
148+ (l:_) -> "<source lang=\"" ++ l ++ "\">" ++ str ++ "</source>"
156− -- note: no escape!
149+ -- note: no escape! even for <!
158blockToMediaWiki (BlockQuote blocks) = do
151blockToMediaWiki (BlockQuote blocks) = do
159 contents <- blockListToMediaWiki blocks
152 contents <- blockListToMediaWiki blocks
@@ -440,3 +433,634 @@ inlineToMediaWiki (Note contents) = do
440 modify (\s -> s { stNotes = True })
433 modify (\s -> s { stNotes = True })
441 return $ "<ref>" ++ contents' ++ "</ref>"
434 return $ "<ref>" ++ contents' ++ "</ref>"
442 -- note - may not work for notes with multiple blocks
435 -- note - may not work for notes with multiple blocks
437+highlightingLangs :: Set.Set String
438+highlightingLangs = Set.fromList [
455+ "antlr-actionscript",
708+ "javascript+cheetah",
709+ "javascript+django",
711+ "javascript+genshi",
712+ "javascript+genshitext",
716+ "javascript+mozpreproc",
717+ "javascript+myghty",
720+ "javascript+smarty",
721+ "javascript+spitfire",
810+ "mozpercentpreproc",
886+ "postgresql-console",
948+ "roboconf-instances",