From 75117098f0bb360e9b9070dc3656521d1826f1ab Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 7 Jun 2009 08:44:50 +0200 Subject: [PATCH] HTML export: Respect example indentation when parsing plain lists Examples and source code blocks that are not sufficiently indented will now terminate plain lists. --- lisp/ChangeLog | 4 ++++ lisp/org-html.el | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c36b7466f..9048e6463 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-06-07 Carsten Dominik + * org-html.el (org-export-html-close-lists-maybe): New function. + (org-export-as-html): Close lists when original indentation + mandates it. + * org-list.el (org-list-end): Respect the stored "original" indentation when determining the end of the list. diff --git a/lisp/org-html.el b/lisp/org-html.el index b543d67e4..350d44e51 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -841,6 +841,7 @@ lang=\"%s\" xml:lang=\"%s\"> ;; Protected HTML (when (get-text-property 0 'org-protected line) + (org-export-html-close-lists-maybe line) (let (par) (when (re-search-backward "\\(

\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t) @@ -1865,6 +1866,22 @@ If there are links in the string, don't modify these." (org-close-par-maybe) (insert (if (equal type "d") "\n" "\n"))) +(defvar in-local-list) +(defvar local-list-indent) +(defun org-export-html-close-lists-maybe (line) + (let ((ind (get-text-property 0 'original-indentation line)) + didclose) + (when ind + (while (and in-local-list + (or (= ind (car local-list-indent)) + (< ind (car local-list-indent)))) + (setq didclose t) + (org-close-li (car local-list-type)) + (insert (format "\n" (car local-list-type))) + (pop local-list-type) (pop local-list-indent) + (setq in-local-list local-list-indent)) + (and didclose (org-open-par))))) + (defvar body-only) ; dynamically scoped into this. (defun org-html-level-start (level title umax with-toc head-count) "Insert a new level in HTML export.