summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-12-09 12:18:22 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-12-09 12:30:26 +0100
commit66c6642e68f77f222c4f3c7b13d07083823ef8fc (patch)
treed0055b3d9f21b724a9e46de3edb88df0cf29f5b3
parent2cdddb96c4f4cac10e4c9687b75dcef6b8c82616 (diff)
downloadorg-mode-66c6642e68f77f222c4f3c7b13d07083823ef8fc.tar.gz
org-e-html: Fix error when exporting an Org src block
* contrib/lisp/org-e-html.el (org-e-html-fontify-code): Expand everything in the buffer before calling htmlize. Remove an assert. Add docstring.
-rw-r--r--contrib/lisp/org-e-html.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index f2c3def..a026e20 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -1456,6 +1456,9 @@ INFO is a plist used as a communication channel."
;;;; Src Code
(defun org-e-html-fontify-code (code lang)
+ "Color CODE with htmlize library.
+CODE is a string representing the source code to colorize. LANG
+is the language used for CODE, as a string, or nil."
(when code
(cond
;; Case 1: No lang. Possibly an example block.
@@ -1484,6 +1487,9 @@ INFO is a plist used as a communication channel."
(insert code)
;; Switch to language-specific mode.
(funcall lang-mode)
+ ;; "Org" as language. Be sure to disclose
+ ;; everything when activating the major mode.
+ (when (eq lang-mode 'org-mode) (org-cycle '(64)))
;; Fontify buffer.
(font-lock-fontify-buffer)
;; Remove formatting on newline characters.
@@ -1520,7 +1526,6 @@ line of code."
(format "%%%ds: "
(length (number-to-string (+ code-length num-start))))))
(code (org-e-html-fontify-code code lang)))
- (assert (= code-length (length (org-split-string code "\n"))))
(org-export-format-code
code
(lambda (loc line-num ref)
@@ -2021,6 +2026,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(match-string 1 formula-link)))))
(t latex-frag))))
+
;;;; Line Break
(defun org-e-html-line-break (line-break contents info)
@@ -2660,6 +2666,7 @@ contextual information."
(funcall table-column-specs table info)
contents)))))
+
;;;; Target
(defun org-e-html-target (target contents info)
@@ -2726,7 +2733,6 @@ contextual information."
-
;;; Filter Functions
(defun org-e-html-final-function (contents backend info)
@@ -2738,6 +2744,7 @@ contextual information."
(buffer-substring-no-properties (point-min) (point-max)))))
+
;;; End-user functions
;;;###autoload