From 781228183a0e009b8c6c68aafb51681768744d9e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 13 Jan 2011 23:25:55 +0100 Subject: org-list: implement alphabetical lists * lisp/org-list.el (org-alphabetical-lists): new variable (org-item-re, org-list-full-item, org-cycle-list-bullet, org-list-struct-fix-bul, org-list-inc-bullet-maybe): reflect introduction of the new variable. (org-item-beginning-re): changed into a function, so any modification of `org-alphabetical-lists' will not require reloading Org. (org-at-item-p, org-toggle-checkbox, org-update-checkbox-count, org-list-parse-list, org-list-send-list): reflect changes to `org-item-beginning-re'. (org-list-use-alpha-bul-p): new function. * lisp/org.el (org-check-for-hidden): reflect changes to `org-item-beginning-re'. * lisp/org-capture.el (org-capture-place-item): reflect changes to `org-item-beginning-re'. * lisp/org-docbook.el (org-export-docbook-list-line): handle new type of items. * lisp/org-exp.el (org-export-mark-list-end, org-export-mark-list-properties): reflect changes to `org-item-beginning-re'. * lisp/org-html.el (org-html-export-list-line): handle new type of items. * lisp/org-latex.el (org-export-latex-lists): handle new type of items and reflect changes to `org-item-beginning-re'. * lisp/org-ascii.el (org-export-ascii-preprocess): handle new counters. Modified from a patch by Nathaniel Flath. --- lisp/org-docbook.el | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'lisp/org-docbook.el') diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 740a68cb0..8190fff39 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1341,7 +1341,7 @@ the alist of previous items." ;; "ordered", "variable" or "itemized". (lambda (pos) (cond - ((string-match "[0-9]" (org-list-get-bullet pos struct)) + ((string-match "[[:alnum:]]" (org-list-get-bullet pos struct)) "ordered") ((org-list-get-tag pos struct) "variable") (t "itemized"))))) @@ -1376,25 +1376,42 @@ the alist of previous items." (cond ;; At an item: insert appropriate tags in export buffer. ((assq pos struct) - (string-match - (concat "[ \t]*\\(\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\)" - "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\)\\]\\)?" - "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" - "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?" - "\\(.*\\)") line) - (let* ((counter (match-string 2 line)) - (checkbox (match-string 3 line)) + (string-match (concat "[ \t]*\\(\\S-+[ \t]+\\)" + "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?" + "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" + "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?" + "\\(.*\\)") + line) + (let* ((checkbox (match-string 3 line)) (desc-tag (or (match-string 4 line) "???")) (body (match-string 5 line)) (list-beg (org-list-get-list-begin pos struct prevs)) (firstp (= list-beg pos)) ;; Always refer to first item to determine list type, in ;; case list is ill-formed. - (type (funcall get-type list-beg))) + (type (funcall get-type list-beg)) + ;; Special variables for ordered lists. + (order-type (let ((bullet (org-list-get-bullet list-beg struct))) + (cond + ((not (equal type "ordered")) nil) + ((string-match "[a-z]" bullet) "loweralpha") + ((string-match "[A-Z]" bullet) "upperalpha") + (t "arabic")))) + (counter (let ((count-tmp (org-list-get-counter pos struct))) + (cond + ((not count-tmp) nil) + ((and (member order-type '("loweralpha" "upperalpha")) + (string-match "[A-Za-z]" count-tmp)) + count-tmp) + ((and (equal order-type "arabic") + (string-match "[0-9]+" count-tmp)) + count-tmp))))) ;; When FIRSTP, a new list or sub-list is starting. (when firstp (org-export-docbook-close-para-maybe) - (insert (format "<%slist>\n" type))) + (insert (if (equal type "ordered") + (concat "\n") + (format "<%slist>\n" type)))) (insert (cond ((equal type "variable") (format "%s" desc-tag)) -- cgit v1.2.3-70-g09d2