summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-06-23 14:12:23 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-06-23 14:12:23 +0200
commit52af11ac17a35707449eac4088268e2a8560ffe5 (patch)
treeb6574981ffb6651779eb9ee8ea95335657594a4b
parent4cf967cceb55aff2c1332b0d0ab3f685118155fe (diff)
downloadorg-mode-52af11ac17a35707449eac4088268e2a8560ffe5.tar.gz
Fix bug with including org-file during export.
Stefan Vollmar writes: > taking up a nice suggestion from Sebastian Rose, I want to > present some org source with proper syntax highlighting. However, > there is a problem when using "BEGIN_SRC" blocks it seems. > > If one puts this org contents into a file "test.org": > > * One Headline > Some Text > #+BEGIN_SRC python > print "some output" > #+END_SRC > * Another headline > More text > > and renders it from another org-file with: > > #+INCLUDE: "./test.org" src org > > everything will be fine (beautiful, infact) up to and including > the print-line - the rest of the org file is not rendered as > source but interpreted.
-rwxr-xr-xlisp/ChangeLog4
-rw-r--r--lisp/org-exp.el8
2 files changed, 11 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4856fcf..efe1abe 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2009-06-23 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-exp.el (org-get-file-contents): Protect org-like lines in
+ included files.
+ (org-export-format-source-code-or-example): Remove newlines.
+
* org-latex.el (org-export-latex-links): Check for no-description
marking.
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index e4a4241..5d6e070 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2099,6 +2099,12 @@ is a string, prepend it to the first line instead of PREFIX."
(insert (or prefix1 prefix))
(setq prefix1 nil)
(beginning-of-line 2)))
+ (buffer-string)
+ (goto-char (point-min))
+ (while (re-search-forward "^\\(\\*\\|[ \t]*#\\)" nil t)
+ (goto-char (match-beginning 0))
+ (insert ",")
+ (end-of-line 1))
(buffer-string)))
(defun org-get-and-remove-property (listvar prop)
@@ -2230,7 +2236,7 @@ INDENT was the original indentation of the block."
(set-buffer-modified-p nil)
(org-export-htmlize-region-for-paste
(point-min) (point-max))))
- (if (string-match "<pre\\([^>]*\\)>\n?" rtn)
+ (if (string-match "<pre\\([^>]*\\)>\n*" rtn)
(setq rtn (replace-match
(format "<pre class=\"src src-%s\">" lang)
t t rtn))))