Docbook export: Respect example indentation when parsing plain lists

Examples and source code blocks that are not sufficiently indented
will now terminate plain lists.
This commit is contained in:
Carsten Dominik 2009-06-07 08:45:56 +02:00
parent 75117098f0
commit 21eb0b8b65
2 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2009-06-07 Carsten Dominik <carsten.dominik@gmail.com> 2009-06-07 Carsten Dominik <carsten.dominik@gmail.com>
* org-docbook.el (org-export-docbook-close-lists-maybe): New function.
(org-export-as-docbook): Close lists when original indentation
mandates it.
* org-html.el (org-export-html-close-lists-maybe): New function. * org-html.el (org-export-html-close-lists-maybe): New function.
(org-export-as-html): Close lists when original indentation (org-export-as-html): Close lists when original indentation
mandates it. mandates it.

View File

@ -644,6 +644,7 @@ publishing directory."
;; Protected HTML ;; Protected HTML
(when (get-text-property 0 'org-protected line) (when (get-text-property 0 'org-protected line)
(org-export-docbook-close-lists-maybe line)
(let (par) (let (par)
(when (re-search-backward (when (re-search-backward
"\\(<para>\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t) "\\(<para>\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t)
@ -1144,6 +1145,27 @@ publishing directory."
(insert "</listitem></varlistentry>\n") (insert "</listitem></varlistentry>\n")
(insert "</listitem>\n"))) (insert "</listitem>\n")))
(defvar in-local-list)
(defvar local-list-indent)
(defun org-export-docbook-close-lists-maybe (line)
(let ((ind (get-text-property 0 'original-indentation line))
didclose)
(when ind
(while (and in-local-list
(or (and (= ind (car local-list-indent))
(not starter))
(< ind (car local-list-indent))))
(setq didclose t)
(let ((listtype (car local-list-type)))
(org-export-docbook-close-li listtype)
(insert (cond
((equal listtype "o") "</orderedlist>\n")
((equal listtype "u") "</itemizedlist>\n")
((equal listtype "d") "</variablelist>\n"))))
(pop local-list-type) (pop local-list-indent)
(setq in-local-list local-list-indent))
(and didclose (org-export-docbook-open-para)))))
(defun org-export-docbook-level-start (level title) (defun org-export-docbook-level-start (level title)
"Insert a new level in DocBook export. "Insert a new level in DocBook export.
When TITLE is nil, just close all open levels." When TITLE is nil, just close all open levels."