Hello,

I'm having a little problem when I want to insert a code block inside
a list. Here is an example:

=====
1. Drawing is following:
   
   #+BEGIN_SRC asymptote :file drawing.pdf
   unitsize(5cm);
   draw(unitcircle);
   #+END_SRC

   Now find its center with compass only.

2. Another item.
=====

Upon exporting this, as the code is removed, the blank lines
surrounding it join together, creating a 2-blank-lines combo very bad
for the list processing taking place a few lines later. Indeed, when
`org-export-preprocess-string' proceeds marking list endings in the
export string, it sees there two separates lists instead of one.

So, the following patch moves `org-export-blocks-preprocess' out of
its hook (now babel is in Org core this isn't needed anymore), and
make it called somewhat later, after list processing (and after
removing excluded and archived trees).

Regards,

--
Nicolas

>From f280a3ef4c8bc54eb0a299a66d42a4ac47622730 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaz...@gmail.com>
Date: Fri, 12 Nov 2010 03:08:09 +0100
Subject: [PATCH] babel: delay call to `org-export-blocks-preprocess' in export

* lisp/org-exp.el (org-export-preprocess-string): delaying code block
  processing a bit to allow correct list parsing in the export string
---
 lisp/org-exp-blocks.el |    3 ---
 lisp/org-exp.el        |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
index 3751e68..a469afc 100644
--- a/lisp/org-exp-blocks.el
+++ b/lisp/org-exp-blocks.el
@@ -201,9 +201,6 @@ which defaults to the value of `org-export-blocks-witheld'."
        (interblock start (point-max))
        (run-hooks 'org-export-blocks-postblock-hook)))))
 
-(add-hook 'org-export-preprocess-after-include-files-hook
-         'org-export-blocks-preprocess)
-
 
;;================================================================================
 ;; type specific functions
 
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 9004dd5..820c179 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1080,6 +1080,9 @@ on this string to produce the exported version."
       ;; Mark end of lists
       (org-export-mark-list-ending backend)
 
+      ;; Export code blocks
+      (org-export-blocks-preprocess)
+
       ;; Handle source code snippets
       (org-export-replace-src-segments-and-examples backend)
 
-- 
1.7.3.2

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to