org-html.el (org-html-expand): Return nil if STRING is nil.

* org-html.el (org-html-expand): Prevent a nil value for
STRING to return an error, just return nil.
This commit is contained in:
Bastien Guerry 2011-10-29 15:00:52 +02:00
parent 25bd31ae36
commit 97d107d981
1 changed files with 13 additions and 11 deletions

View File

@ -2310,18 +2310,20 @@ Possible conversions are set in `org-export-html-protect-char-alist'."
(defun org-html-expand (string) (defun org-html-expand (string)
"Prepare STRING for HTML export. Apply all active conversions. "Prepare STRING for HTML export. Apply all active conversions.
If there are links in the string, don't modify these." If there are links in the string, don't modify these. If STRING
(let* ((re (concat org-bracket-link-regexp "\\|" is nil, return nil."
(org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) (when string
m s l res) (let* ((re (concat org-bracket-link-regexp "\\|"
(while (setq m (string-match re string)) (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")))
(setq s (substring string 0 m) m s l res)
l (match-string 0 string) (while (setq m (string-match re string))
string (substring string (match-end 0))) (setq s (substring string 0 m)
(push (org-html-do-expand s) res) l (match-string 0 string)
string (substring string (match-end 0)))
(push (org-html-do-expand s) res)
(push l res)) (push l res))
(push (org-html-do-expand string) res) (push (org-html-do-expand string) res)
(apply 'concat (nreverse res)))) (apply 'concat (nreverse res)))))
(defun org-html-do-expand (s) (defun org-html-do-expand (s)
"Apply all active conversions to translate special ASCII to HTML." "Apply all active conversions to translate special ASCII to HTML."