From c0c3f11916bae6731eec26e4743402bf3aa83d2f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 21 Nov 2010 12:01:59 +0100 Subject: [PATCH 1/2] Do not interpret lists in verse environments upon exporting * lisp/org-html.el (org-export-as-html): skip list interpretation when inside a verse block This change isn't needed in DocBook exporter, which treats VERSE as QUOTE environment. --- lisp/org-html.el | 6 ++++-- lisp/org-latex.el | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index d1fe06d..1a3e673 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1549,13 +1549,15 @@ lang=\"%s\" xml:lang=\"%s\"> (insert (org-format-table-html table-buffer table-orig-buffer)))) (t ;; Normal lines - (when (string-match + (when (and + (not inverse) + (string-match (cond ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) - line) + line)) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 91bf380..75d9ce2 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2214,14 +2214,23 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (org-replace-match-keep-properties "\\begin{verse}" t t) (beginning-of-line 2) (while (and (not (looking-at "[ \t]*ORG-VERSE-END.*")) (not (eobp))) + ;; Replace leading white spaces. (when (looking-at "\\([ \t]+\\)\\([^ \t\n]\\)") (goto-char (match-end 1)) (org-replace-match-keep-properties (org-export-latex-protect-string (concat "\\hspace*{1cm}" (match-string 2))) t t) (beginning-of-line 1)) + ;; When at a list item, protect its bullet to avoid later + ;; interpretation. This is only needed for items at the same + ;; column as block header. + (when (looking-at org-item-beginning-re) + (add-text-properties + (match-beginning 1) (match-end 1) '(org-protected t))) + ;; Replace empty lines. (if (looking-at "[ \t]*$") (insert (org-export-latex-protect-string "\\vspace*{1em}")) + ;; Add \\ to the end of line if necessary. (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") (end-of-line 1) (insert "\\\\"))) -- 1.7.3.2