summaryrefslogtreecommitdiff
path: root/lisp/org-docbook.el
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-01-13 23:25:55 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2011-02-18 12:45:10 +0100
commit781228183a0e009b8c6c68aafb51681768744d9e (patch)
tree11727b616c8b4a15f9522b0b8387dd1d62b48858 /lisp/org-docbook.el
parente5293ba34746e4b926a5375323098b54252b19d3 (diff)
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.
Diffstat (limited to 'lisp/org-docbook.el')
-rw-r--r--lisp/org-docbook.el39
1 files changed, 28 insertions, 11 deletions
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 "<orderedlist numeration=\"" order-type "\">\n")
+ (format "<%slist>\n" type))))
(insert (cond
((equal type "variable")
(format "<varlistentry><term>%s</term><listitem>" desc-tag))