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>
This commit is contained in:
Rasmus 2015-08-04 15:52:47 +02:00
parent f63d76872c
commit 6db0b0cd43
1 changed files with 24 additions and 19 deletions

View File

@ -2041,7 +2041,10 @@ is the language used for CODE, as a string, or nil."
;; Case 2: Default. Fontify code. ;; Case 2: Default. Fontify code.
(t (t
;; htmlize ;; htmlize
(setq code (with-temp-buffer (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. ;; Switch to language-specific mode.
(funcall lang-mode) (funcall lang-mode)
(insert code) (insert code)
@ -2058,8 +2061,10 @@ is the language used for CODE, as a string, or nil."
(org-src-mode) (org-src-mode)
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
;; Htmlize region. ;; Htmlize region.
(let ((org-html-htmlize-output-type output-type)
(org-html-htmlize-font-prefix font-prefix))
(org-html-htmlize-region-for-paste (org-html-htmlize-region-for-paste
(point-min) (point-max)))) (point-min) (point-max))))))
;; Strip any enclosing <pre></pre> tags. ;; Strip any enclosing <pre></pre> tags.
(let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0))) (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
(end (and beg (string-match "</pre>\\'" code)))) (end (and beg (string-match "</pre>\\'" code))))