From a0769aaebbb0f1b67c6406d182e65b1b83834815 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Wed, 31 Aug 2011 22:23:46 +0530 Subject: [PATCH] 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. --- contrib/lisp/org-lparse.el | 24 +++++++++++++++--------- contrib/lisp/org-odt.el | 8 ++++---- contrib/lisp/org-xhtml.el | 12 ++++++------ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/contrib/lisp/org-lparse.el b/contrib/lisp/org-lparse.el index fd0488b31..3240e7998 100755 --- a/contrib/lisp/org-lparse.el +++ b/contrib/lisp/org-lparse.el @@ -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
  • 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) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index a5b2d96ba..d7736ff14 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -609,9 +609,9 @@ PUB-DIR is set, use this as the publishing directory." (org-odt-format-tags '("" . "") (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 "")) (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 diff --git a/contrib/lisp/org-xhtml.el b/contrib/lisp/org-xhtml.el index 8a8f4ca62..279b94498 100644 --- a/contrib/lisp/org-xhtml.el +++ b/contrib/lisp/org-xhtml.el @@ -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 "
    ") (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 "
    ") (org-lparse-insert-tag "") -- 2.11.4.GIT