                             :static-brushes (:brush amap)
                             :verbose? (:verbose amap)}
                 *single-comment* (:comment amap)
-                *language* (or (:language amap) *language*)]
+                *language* (canonical-lang (or (:language amap) *language*))]
 
 ; When no output file is given, the program renders to standard-out.
         (if (= 1 (count tail))

(def languages
  "A map of language names to a pairs of comment syntax and SyntaxHighlighter
  brush file names."
  {"clojure" [";" "shBrushClojure.js"]
   "clj" [";" "shBrushClojure.js"]
   "cljs" [";" "shBrushClojure.js"]
   "applescript" ["--" "shBrushAppleScript.js"]
   "actionscript3" ["//" "shBrushAS3.js"]
   "as3" ["//" "shBrushAS3.js"]
   "bash" ["#" "shBrushBash.js"]
   "shell" ["#" "shBrushBash.js"]
   "sh" ["#" "shBrushBash.js"]
   ;"coldfusion" "shBrushColdFusion.js"
   "cpp" ["//" "shBrushCpp.js"]
   "c++" ["//" "shBrushCpp.js"]
   "cxx" ["//" "shBrushCpp.js"]
   "c" ["//" "shBrushCpp.js"]
   "c#" ["//" "shBrushCSharp.js"]
   "c-sharp" ["//" "shBrushCSharp.js"]
   "csharp" ["//" "shBrushCSharp.js"]
   "delphi" ["//" "shBrushDelphi.js"]
   "pascal" ["//" "shBrushDelphi.js"]
   ;"diff" "shBrushDiff.js"
   ;"patch" "shBrushDiff.js"
   "erlang" ["%" "shBrushErlang.js"]
   "erl" ["%" "shBrushErlang.js"]
   "groovy" ["//" "shBrushGroovy.js"]
   "java" ["//" "shBrushJava.js"]
   "javafx" ["//" "shBrushJavaFX.js"]
   "jfx" ["//" "shBrushJavaFX.js"]
   "javascript" ["//" "shBrushJScript.js"]
   "js" ["//" "shBrushJScript.js"]
   "perl" ["#" "shBrushPerl.js"]
   "pl" ["#" "shBrushPerl.js"]
   "php" ["#" "shBrushPhp.js"]
   ;"text" "shBrushPlain.js"
   ;"txt" "shBrushPlain.js"
   ;"plain" "shBrushPlain.js"
   "python" ["#" "shBrushPython.js"]
   "py" ["#" "shBrushPython.js"]
   "ruby" ["#" "shBrushRuby.js"]
   "rb" ["#" "shBrushRuby.js"]
   "sass" ["//" "shBrushSass.js"]
   "scss" ["//" "shBrushSass.js"]
   "scala" ["//" "shBrushScala.js"]
   "sql" ["--" "shBrushSql.js"]
   "vim" ["\"" "shBrushVimscript.js"]
   "vimscript" ["\"" "shBrushVimscript.js"]
   "vb" ["'" "shBrushVb.js"]
   "vbnet" ["'" "shBrushVb.js"]
   ;"xml" "shBrushXml.js"
   ;"xhtml" "shBrushXml.js"
   ;"xslt" "shBrushXml.js"
   ;"html" "shBrushXml.js"
   })


; ### Pegdown instances

; SyntaxHighlighter brushes are associated with files if the language is
; supplied or can be worked out from the file suffix.
(defn maybe-associate-brush [path lang]
  (when-let [b (and lang (lang-brush lang))]
    (when-not (@*brushes* b)
      (message "Associating "path " with brush " b)
      (swap! *brushes* conj b))))
