summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Kaufmann <rlndkfmn+orgmode@gmail.com>2011-05-12 00:41:20 +0000
committerCarsten Dominik <carsten.dominik@gmail.com>2011-05-25 09:39:47 +0200
commit33bae13aeba921218b614a5a0c0b12bf7d911c4f (patch)
treecaf2ebcb80bdd39a1527ca944293ee09f960ba60
parent34fa86edf5fff3c52337de9bdb1769ec53a74b32 (diff)
downloadorg-mode-33bae13aeba921218b614a5a0c0b12bf7d911c4f.tar.gz
Fix markup problems when using references in source fragments
* lisp/org-exp.el (org-remove-formatting-on-newlines-in-region): New function. (org-export-format-source-code-or-example): Call `org-remove-formatting-on-newlines-in-region'. TINYCHANGE
-rw-r--r--lisp/org-exp.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index e188d49..5812c34 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2446,6 +2446,15 @@ in the list) and remove property and value from the list in LISTVAR."
(defvar org-export-latex-listings-options) ;; defined in org-latex.el
(defvar org-export-latex-minted-options) ;; defined in org-latex.el
+(defun org-remove-formatting-on-newlines-in-region (beg end)
+ "Remove formatting on newline characters"
+ (interactive "r")
+ (save-excursion
+ (goto-char beg)
+ (while (progn (end-of-line) (< (point) end))
+ (put-text-property (point) (1+ (point)) 'face nil)
+ (forward-char 1))))
+
(defun org-export-format-source-code-or-example
(lang code &optional opts indent caption)
"Format CODE from language LANG and return it formatted for export.
@@ -2532,6 +2541,8 @@ INDENT was the original indentation of the block."
(funcall mode)
(fundamental-mode))
(font-lock-fontify-buffer)
+ ;; markup each line separately
+ (org-remove-formatting-on-newlines-in-region (point-min) (point-max))
(org-src-mode)
(set-buffer-modified-p nil)
(org-export-htmlize-region-for-paste