ox-html.el: New option `org-html-indent' to indent the HTML output

* ox-html.el (org-html-indent): New option.
(org-html-use-unicode-chars): New option.
(org-html-pretty-output): Delete.
(org-html-final-function): Use the new options.
This commit is contained in:
Bastien Guerry 2013-03-15 15:02:18 +01:00
parent d660979a0e
commit e8742b78e0

View file

@ -511,8 +511,15 @@ returned as-is."
:value-type (string :tag "Format string")) :value-type (string :tag "Format string"))
:options '(bold code italic strike-through underline verbatim)) :options '(bold code italic strike-through underline verbatim))
(defcustom org-html-pretty-output nil (defcustom org-html-indent t
"Enable this to generate pretty HTML." "Non-nil means to indent the generated HTML."
:group 'org-export-html
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
(defcustom org-html-use-unicode-chars nil
"Non-nil means to use unicode characters instead of HTML entities."
:group 'org-export-html :group 'org-export-html
:version "24.4" :version "24.4"
:package-version '(Org . "8.0") :package-version '(Org . "8.0")
@ -3117,14 +3124,16 @@ contextual information."
;;; Filter Functions ;;; Filter Functions
(defun org-html-final-function (contents backend info) (defun org-html-final-function (contents backend info)
"Filter to prettify the HTML output. "Filter to indent the HTML and convert HTML entities."
Prettifying happens if `org-html-pretty-output' is t."
(if (not org-html-pretty-output) contents
(with-temp-buffer (with-temp-buffer
(html-mode)
(insert contents) (insert contents)
(indent-region (point-min) (point-max)) (set-auto-mode t)
(buffer-substring-no-properties (point-min) (point-max))))) (if org-html-indent
(indent-region (point-min) (point-max)))
(when org-html-use-unicode-chars
(require 'mm-url)
(mm-url-decode-entities))
(buffer-substring-no-properties (point-min) (point-max))))
;;; End-user functions ;;; End-user functions