diff options
author | Rasmus <rasmus@gmx.us> | 2015-08-04 15:52:47 +0200 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2015-08-04 17:55:37 +0200 |
commit | 6db0b0cd437a988e7513901d3458d586ee145d44 (patch) | |
tree | 58bac1aa3f41a8ec3f79293abdf366695761eb3a | |
parent | f63d76872c77b410f3c28afce5a2919dee2f9242 (diff) | |
download | org-mode-6db0b0cd437a988e7513901d3458d586ee145d44.tar.gz |
ox-html: Respect local values when formatting code
* ox-html.el (org-html-fontify-code): Use local value of
org-html-htmlize-output-type parent and org-html-htmlize-font-prefix
parent.
Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/99450>
-rw-r--r-- | lisp/ox-html.el | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index d454fab..e317e93 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2041,25 +2041,30 @@ is the language used for CODE, as a string, or nil." ;; Case 2: Default. Fontify code. (t ;; htmlize - (setq code (with-temp-buffer - ;; Switch to language-specific mode. - (funcall lang-mode) - (insert code) - ;; Fontify buffer. - (font-lock-ensure) - ;; Remove formatting on newline characters. - (save-excursion - (let ((beg (point-min)) - (end (point-max))) - (goto-char beg) - (while (progn (end-of-line) (< (point) end)) - (put-text-property (point) (1+ (point)) 'face nil) - (forward-char 1)))) - (org-src-mode) - (set-buffer-modified-p nil) - ;; Htmlize region. - (org-html-htmlize-region-for-paste - (point-min) (point-max)))) + (setq code + (let ((output-type org-html-htmlize-output-type) + (font-prefix orgb-html-htmlize-font-prefix)) + (with-temp-buffer + ;; Switch to language-specific mode. + (funcall lang-mode) + (insert code) + ;; Fontify buffer. + (font-lock-ensure) + ;; Remove formatting on newline characters. + (save-excursion + (let ((beg (point-min)) + (end (point-max))) + (goto-char beg) + (while (progn (end-of-line) (< (point) end)) + (put-text-property (point) (1+ (point)) 'face nil) + (forward-char 1)))) + (org-src-mode) + (set-buffer-modified-p nil) + ;; Htmlize region. + (let ((org-html-htmlize-output-type output-type) + (org-html-htmlize-font-prefix font-prefix)) + (org-html-htmlize-region-for-paste + (point-min) (point-max)))))) ;; Strip any enclosing <pre></pre> tags. (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0))) (end (and beg (string-match "</pre>\\'" code)))) |