   (if (org-export-read-attribute :attr_html src-block :textarea)
       (org-html--textarea-block src-block)
     (let ((lang (org-element-property :language src-block))
-	  (code (org-html-format-code src-block info)))
+          (code (org-element-property :value src-block))
+          (code-html (org-html-format-code src-block info)))
       (if nikola-use-pygments
-          (pygmentize lang (org-html-decode-plain-text code))
-        code))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+          (pygmentize (downcase lang) (org-html-decode-plain-text code))
+        code-html))))
 
 ;; Export function used by Nikola.
 (defun nikola-html-export (infile outfile)
   "Export the body only of the input file and write it to
 specified location."
-
   (with-current-buffer (find-file infile)
     (org-macro-replace-all nikola-macro-templates)
     (org-html-export-as-html nil nil t t)

    ("sh" . "sh")
    ("sql" . "sql")
    ("sqlite" . "sqlite3")
    ("tcl" . "tcl")
    )
  "Alist between org-babel languages and Pygments lexers.

See: http://orgmode.org/worg/org-contrib/babel/languages.html and
http://pygments.org/docs/lexers/ for adding new languages to the
mapping. ")

;; Override the html export function to use pygments
(defun org-html-src-block (src-block contents info)

    ("perl" . "perl")
    ("picolisp" . "scheme")
    ("python" . "python")
    ("r" . "r")
    ("ruby" . "ruby")
    ("sass" . "sass")
    ("scala" . "scala")
