Introduce org-lparse-begin/end-list-item

* contrib/lisp/org-lparse.el (org-lparse-end-list-item):
Renamed to `org-lparse-end-list-item-1'.
(org-lparse-begin-list-item, org-lparse-end-list-item): New
functions.  Use these instead of doing (org-lparse-begin
'LIST-ITEM ...) or (org-lparse-end 'LIST-ITEM ...).
(org-lparse-export-list-line, org-lparse-begin-level)
(org-lparse-end-level): Propagate above changes.
* contrib/lisp/org-odt.el
(org-odt-begin-list-item, org-odt-end-list-item): ditto.
* contrib/lisp/org-xhtml.el (org-xhtml-format-toc-item)
(org-xhtml-begin-toc, org-xhtml-end-toc): ditto.
This commit is contained in:
Jambunathan K 2011-08-31 22:23:46 +05:30
parent 84226fe2b5
commit a0769aaebb
3 changed files with 25 additions and 19 deletions

View file

@ -1667,7 +1667,7 @@ the alist of previous items."
(type (funcall get-type first-item struct prevs)))
(org-lparse-end-paragraph)
;; Ending for every item
(org-lparse-end-list-item type)
(org-lparse-end-list-item-1 type)
;; We're ending last item of the list: end list.
(when lastp
(org-lparse-end-list type)
@ -1703,7 +1703,7 @@ the alist of previous items."
(let ((arg (cond ((equal type "d") desc-tag)
((equal type "o") counter))))
(org-lparse-begin 'LIST-ITEM type arg))
(org-lparse-begin-list-item type arg))
;; If line had a checkbox, some additional modification is required.
(when checkbox
@ -1808,10 +1808,10 @@ information."
(org-lparse-end 'PARAGRAPH)
(setq org-lparse-par-open nil)))
(defun org-lparse-end-list-item (&optional type)
(defun org-lparse-end-list-item-1 (&optional type)
"Close <li> if necessary."
(org-lparse-end-paragraph)
(org-lparse-end 'LIST-ITEM (or type "u")))
(org-lparse-end-list-item (or type "u")))
(defvar org-lparse-dyn-current-environment nil)
(defun org-lparse-begin-environment (style)
@ -2030,13 +2030,13 @@ When TITLE is nil, just close all open levels."
(if (> level umax)
(progn
(if (aref org-levels-open (1- level))
(org-lparse-end-list-item)
(org-lparse-end-list-item-1)
(aset org-levels-open (1- level) t)
(org-lparse-end-paragraph)
(org-lparse-begin-list 'unordered))
(org-lparse-begin
'LIST-ITEM 'unordered target
(org-lparse-format 'HEADLINE title extra-targets tags)))
(org-lparse-begin-list-item
'unordered target (org-lparse-format
'HEADLINE title extra-targets tags)))
(aset org-levels-open (1- level) t)
(setq snumber (org-section-number level))
(setq level1 (+ level (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1) -1))
@ -2053,7 +2053,7 @@ When TITLE is nil, just close all open levels."
;; Terminate one level in HTML export
(if (<= l umax)
(org-lparse-end-outline-text-or-outline)
(org-lparse-end-list-item)
(org-lparse-end-list-item-1)
(org-lparse-end-list 'unordered))
(aset org-levels-open (1- l) nil))))
@ -2091,6 +2091,12 @@ When TITLE is nil, just close all open levels."
(decf org-lparse-list-level)
(org-lparse-end 'LIST ltype))
(defun org-lparse-begin-list-item (ltype &optional arg headline)
(org-lparse-begin 'LIST-ITEM ltype arg headline))
(defun org-lparse-end-list-item (ltype)
(org-lparse-end 'LIST-ITEM ltype))
(defvar org-lparse-table-rowgrp-info)
(defun org-lparse-begin-table-rowgroup (&optional is-header-row)
(push (cons (1+ org-lparse-table-rownum) :start) org-lparse-table-rowgrp-info)

View file

@ -609,9 +609,9 @@ PUB-DIR is set, use this as the publishing directory."
(org-odt-format-tags
'("<text:list-item>" . "</text:list-item>")
(org-odt-format-stylized-paragraph 'definition-term term)))
(org-lparse-begin 'LIST-ITEM 'unordered)
(org-lparse-begin-list-item 'unordered)
(org-lparse-begin-list 'description)
(org-lparse-begin 'LIST-ITEM 'unordered)))
(org-lparse-begin-list-item 'unordered)))
(t (error "Unknown list type"))))
(defun org-odt-end-list-item (ltype)
@ -621,9 +621,9 @@ PUB-DIR is set, use this as the publishing directory."
((ordered unordered)
(org-lparse-insert-tag "</text:list-item>"))
(description
(org-lparse-end-list-item)
(org-lparse-end-list-item-1)
(org-lparse-end-list 'description)
(org-lparse-end-list-item))
(org-lparse-end-list-item-1))
(t (error "Unknown list type"))))
;; Following variables are let bound when table emission is in

View file

@ -1040,15 +1040,15 @@ that uses these same face definitions."
(let ((cnt (- level org-last-level)))
(while (>= (setq cnt (1- cnt)) 0)
(org-lparse-begin-list 'unordered)
(org-lparse-begin 'LIST-ITEM 'unordered))))
(org-lparse-begin-list-item 'unordered))))
(when (< level org-last-level)
(let ((cnt (- org-last-level level)))
(while (>= (setq cnt (1- cnt)) 0)
(org-lparse-end-list-item)
(org-lparse-end-list-item-1)
(org-lparse-end-list 'unordered))))
(org-lparse-end-list-item)
(org-lparse-begin 'LIST-ITEM 'unordered)
(org-lparse-end-list-item-1)
(org-lparse-begin-list-item 'unordered)
(insert toc-entry))
(defun org-xhtml-begin-toc (lang-specific-heading)
@ -1058,12 +1058,12 @@ that uses these same face definitions."
(or (org-lparse-get 'TOPLEVEL-HLEVEL) 1)))
(org-lparse-insert-tag "<div id=\"text-table-of-contents\">")
(org-lparse-begin-list 'unordered)
(org-lparse-begin 'LIST-ITEM 'unordered))
(org-lparse-begin-list-item 'unordered))
(defun org-xhtml-end-toc ()
(while (> org-last-level (1- org-min-level))
(setq org-last-level (1- org-last-level))
(org-lparse-end-list-item)
(org-lparse-end-list-item-1)
(org-lparse-end-list 'unordered))
(org-lparse-insert-tag "</div>")
(org-lparse-insert-tag "</div>")