Mercurial > emacs
comparison lisp/org/org-list.el @ 100458:ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
* Fix typos in comments and docstrings throughout Org-mode.
* org.el (org-get-outline-path): Fix bug if level is not given.
* org-agenda.el (org-finalize-agenda): Fix typo with variable
name.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Wed, 17 Dec 2008 12:34:50 +0000 |
parents | cea079b68b76 |
children | 0d3c634e0bd9 |
comparison
equal
deleted
inserted
replaced
100457:022a6a6d35ab | 100458:ba23e35d3eaf |
---|---|
1 ;;; org-list.el --- Plain lists for Org-mode | 1 ;;; org-list.el --- Plain lists for Org-mode |
2 ;; | 2 ;; |
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
4 ;; | 4 ;; |
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 ;; Author: Carsten Dominik <carsten at orgmode dot org> |
6 ;; Bastien Guerry <bzg AT altern DOT org> | 6 ;; Bastien Guerry <bzg AT altern DOT org> |
7 ;; Keywords: outlines, hypermedia, calendar, wp | 7 ;; Keywords: outlines, hypermedia, calendar, wp |
8 ;; Homepage: http://orgmode.org | 8 ;; Homepage: http://orgmode.org |
9 ;; Version: 6.15a | 9 ;; Version: 6.15d |
10 ;; | 10 ;; |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 ;; | 12 ;; |
13 ;; GNU Emacs is free software: you can redistribute it and/or modify | 13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | 14 ;; it under the terms of the GNU General Public License as published by |
15 ;; the Free Software Foundation, either version 3 of the License, or | 15 ;; the Free Software Foundation, either version 3 of the License, or |
16 ;; (at your option) any later version. | 16 ;; (at your option) any later version. |
17 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | 18 ;; GNU Emacs is distributed in the hope that it will be useful, |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 ;; GNU General Public License for more details. | 21 ;; GNU General Public License for more details. |
22 | 22 |
23 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
55 (defcustom org-cycle-include-plain-lists nil | 55 (defcustom org-cycle-include-plain-lists nil |
56 "Non-nil means, include plain lists into visibility cycling. | 56 "Non-nil means, include plain lists into visibility cycling. |
57 This means that during cycling, plain list items will *temporarily* be | 57 This means that during cycling, plain list items will *temporarily* be |
58 interpreted as outline headlines with a level given by 1000+i where i is the | 58 interpreted as outline headlines with a level given by 1000+i where i is the |
59 indentation of the bullet. In all other operations, plain list items are | 59 indentation of the bullet. In all other operations, plain list items are |
60 not seen as headlines. For example, you cannot assign a TODO keyword to | 60 not seen as headlines. For example, you cannot assign a TODO keyword to |
61 such an item." | 61 such an item." |
62 :group 'org-plain-lists | 62 :group 'org-plain-lists |
63 :type 'boolean) | 63 :type 'boolean) |
64 | 64 |
65 (defcustom org-plain-list-ordered-item-terminator t | 65 (defcustom org-plain-list-ordered-item-terminator t |
74 (const :tab "both" t))) | 74 (const :tab "both" t))) |
75 | 75 |
76 (defcustom org-list-two-spaces-after-bullet-regexp nil | 76 (defcustom org-list-two-spaces-after-bullet-regexp nil |
77 "A regular expression matching bullets that should have 2 spaces after them. | 77 "A regular expression matching bullets that should have 2 spaces after them. |
78 When nil, no bullet will have two spaces after them. | 78 When nil, no bullet will have two spaces after them. |
79 When a string, it will be used as a regular expression. When the bullet | 79 When a string, it will be used as a regular expression. When the bullet |
80 type of a list is changed, the new bullet type will be matched against this | 80 type of a list is changed, the new bullet type will be matched against this |
81 regexp. If it matches, there will be two spaces instead of one after | 81 regexp. If it matches, there will be two spaces instead of one after |
82 the bullet in each item of he list." | 82 the bullet in each item of he list." |
83 :group 'org-plain-list | 83 :group 'org-plain-list |
84 :type '(choice | 84 :type '(choice |
85 (const :tag "never" nil) | 85 (const :tag "never" nil) |
86 (regexp))) | 86 (regexp))) |
285 (progn (outline-next-heading) (point)))) | 285 (progn (outline-next-heading) (point)))) |
286 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") | 286 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") |
287 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)") | 287 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)") |
288 (re-find (concat re "\\|" re-box)) | 288 (re-find (concat re "\\|" re-box)) |
289 beg-cookie end-cookie is-percent c-on c-off lim | 289 beg-cookie end-cookie is-percent c-on c-off lim |
290 eline curr-ind next-ind continue-from startsearch | 290 eline curr-ind next-ind continue-from startsearch |
291 (cstat 0) | 291 (cstat 0) |
292 ) | 292 ) |
293 (when all | 293 (when all |
294 (goto-char (point-min)) | 294 (goto-char (point-min)) |
295 (outline-next-heading) | 295 (outline-next-heading) |
296 (setq beg (point) end (point-max))) | 296 (setq beg (point) end (point-max))) |
297 (goto-char end) | 297 (goto-char end) |
298 ;; find each statistic cookie | 298 ;; find each statistic cookie |
299 (while (re-search-backward re-find beg t) | 299 (while (re-search-backward re-find beg t) |
300 (setq beg-cookie (match-beginning 1) | 300 (setq beg-cookie (match-beginning 1) |
301 end-cookie (match-end 1) | 301 end-cookie (match-end 1) |
302 cstat (+ cstat (if end-cookie 1 0)) | 302 cstat (+ cstat (if end-cookie 1 0)) |
303 startsearch (point-at-eol) | 303 startsearch (point-at-eol) |
304 continue-from (point-at-bol) | 304 continue-from (point-at-bol) |
305 is-percent (match-beginning 2) | 305 is-percent (match-beginning 2) |
306 lim (cond | 306 lim (cond |
307 ((org-on-heading-p) (outline-next-heading) (point)) | 307 ((org-on-heading-p) (outline-next-heading) (point)) |
308 ((org-at-item-p) (org-end-of-item) (point)) | 308 ((org-at-item-p) (org-end-of-item) (point)) |
309 (t nil)) | 309 (t nil)) |
310 c-on 0 | 310 c-on 0 |
311 c-off 0) | 311 c-off 0) |
312 (when lim | 312 (when lim |
313 ;; find first checkbox for this cookie and gather | 313 ;; find first checkbox for this cookie and gather |
314 ;; statistics from all that are at this indentation level | 314 ;; statistics from all that are at this indentation level |
315 (goto-char startsearch) | 315 (goto-char startsearch) |
316 (if (re-search-forward re-box lim t) | 316 (if (re-search-forward re-box lim t) |
317 (progn | 317 (progn |
318 (org-beginning-of-item) | 318 (org-beginning-of-item) |
319 (setq curr-ind (org-get-indentation)) | 319 (setq curr-ind (org-get-indentation)) |
320 (setq next-ind curr-ind) | 320 (setq next-ind curr-ind) |
321 (while (and (bolp) (org-at-item-p) (= curr-ind next-ind)) | 321 (while (and (bolp) (org-at-item-p) (= curr-ind next-ind)) |
322 (save-excursion (end-of-line) (setq eline (point))) | 322 (save-excursion (end-of-line) (setq eline (point))) |
323 (if (re-search-forward re-box eline t) | 323 (if (re-search-forward re-box eline t) |
324 (if (member (match-string 2) '("[ ]" "[-]")) | 324 (if (member (match-string 2) '("[ ]" "[-]")) |
325 (setq c-off (1+ c-off)) | 325 (setq c-off (1+ c-off)) |
326 (setq c-on (1+ c-on)) | 326 (setq c-on (1+ c-on)) |
327 ) | 327 ) |
328 ) | 328 ) |
329 (org-end-of-item) | 329 (org-end-of-item) |
330 (setq next-ind (org-get-indentation)) | 330 (setq next-ind (org-get-indentation)) |
331 ))) | 331 ))) |
332 (goto-char continue-from) | 332 (goto-char continue-from) |
333 ;; update cookie | 333 ;; update cookie |
334 (when end-cookie | 334 (when end-cookie |
335 (delete-region beg-cookie end-cookie) | 335 (delete-region beg-cookie end-cookie) |
336 (goto-char beg-cookie) | 336 (goto-char beg-cookie) |
337 (insert | 337 (insert |
338 (if is-percent | 338 (if is-percent |
339 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off)))) | 339 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off)))) |
340 (format "[%d/%d]" c-on (+ c-on c-off))))) | 340 (format "[%d/%d]" c-on (+ c-on c-off))))) |
341 ;; update items checkbox if it has one | 341 ;; update items checkbox if it has one |
342 (when (org-at-item-p) | 342 (when (org-at-item-p) |
343 (org-beginning-of-item) | 343 (org-beginning-of-item) |
344 (when (and (> (+ c-on c-off) 0) | 344 (when (and (> (+ c-on c-off) 0) |
345 (re-search-forward re-box (point-at-eol) t)) | 345 (re-search-forward re-box (point-at-eol) t)) |
346 (setq beg-cookie (match-beginning 2) | 346 (setq beg-cookie (match-beginning 2) |
347 end-cookie (match-end 2)) | 347 end-cookie (match-end 2)) |
348 (delete-region beg-cookie end-cookie) | 348 (delete-region beg-cookie end-cookie) |
349 (goto-char beg-cookie) | 349 (goto-char beg-cookie) |
350 (cond ((= c-off 0) (insert "[X]")) | 350 (cond ((= c-off 0) (insert "[X]")) |
351 ((= c-on 0) (insert "[ ]")) | 351 ((= c-on 0) (insert "[ ]")) |
352 (t (insert "[-]"))) | 352 (t (insert "[-]"))) |
353 ))) | 353 ))) |
354 (goto-char continue-from)) | 354 (goto-char continue-from)) |
355 (when (interactive-p) | 355 (when (interactive-p) |
356 (message "Checkbox satistics updated %s (%d places)" | 356 (message "Checkbox statistics updated %s (%d places)" |
357 (if all "in entire file" "in current outline entry") cstat))))) | 357 (if all "in entire file" "in current outline entry") cstat))))) |
358 | 358 |
359 (defun org-get-checkbox-statistics-face () | 359 (defun org-get-checkbox-statistics-face () |
360 "Select the face for checkbox statistics. | 360 "Select the face for checkbox statistics. |
361 The face will be `org-done' when all relevant boxes are checked. Otherwise | 361 The face will be `org-done' when all relevant boxes are checked. Otherwise |
596 | 596 |
597 (defun org-cycle-list-bullet (&optional which) | 597 (defun org-cycle-list-bullet (&optional which) |
598 "Cycle through the different itemize/enumerate bullets. | 598 "Cycle through the different itemize/enumerate bullets. |
599 This cycle the entire list level through the sequence: | 599 This cycle the entire list level through the sequence: |
600 | 600 |
601 `-' -> `+' -> `*' -> `1.' -> `1)' | 601 `-' -> `+' -> `*' -> `1.' -> `1)' |
602 | 602 |
603 If WHICH is a string, use that as the new bullet. If WHICH is an integer, | 603 If WHICH is a string, use that as the new bullet. If WHICH is an integer, |
604 0 meand `-', 1 means `+' etc." | 604 0 means `-', 1 means `+' etc." |
605 (interactive "P") | 605 (interactive "P") |
606 (org-preserve-lc | 606 (org-preserve-lc |
607 (org-beginning-of-item-list) | 607 (org-beginning-of-item-list) |
608 (org-at-item-p) | 608 (org-at-item-p) |
609 (beginning-of-line 1) | 609 (beginning-of-line 1) |
739 "Go to the beginning of the current item list. | 739 "Go to the beginning of the current item list. |
740 I.e. to the first item in this list." | 740 I.e. to the first item in this list." |
741 (interactive) | 741 (interactive) |
742 (org-beginning-of-item) | 742 (org-beginning-of-item) |
743 (let ((pos (point-at-bol)) | 743 (let ((pos (point-at-bol)) |
744 (ind (org-get-indentation)) | 744 (ind (org-get-indentation)) |
745 ind1) | 745 ind1) |
746 ;; find where this list begins | 746 ;; find where this list begins |
747 (catch 'exit | 747 (catch 'exit |
748 (while t | 748 (while t |
749 (catch 'next | 749 (catch 'next |
765 "Go to the end of the current item list. | 765 "Go to the end of the current item list. |
766 I.e. to the text after the last item." | 766 I.e. to the text after the last item." |
767 (interactive) | 767 (interactive) |
768 (org-beginning-of-item) | 768 (org-beginning-of-item) |
769 (let ((pos (point-at-bol)) | 769 (let ((pos (point-at-bol)) |
770 (ind (org-get-indentation)) | 770 (ind (org-get-indentation)) |
771 ind1) | 771 ind1) |
772 ;; find where this list begins | 772 ;; find where this list begins |
773 (catch 'exit | 773 (catch 'exit |
774 (while t | 774 (while t |
775 (catch 'next | 775 (catch 'next |
831 (condition-case nil (org-beginning-of-item) (error nil)) | 831 (condition-case nil (org-beginning-of-item) (error nil)) |
832 (org-maybe-renumber-ordered-list-safe))) | 832 (org-maybe-renumber-ordered-list-safe))) |
833 | 833 |
834 (defun org-item-indent-positions () | 834 (defun org-item-indent-positions () |
835 "Return indentation for plain list items. | 835 "Return indentation for plain list items. |
836 This returns a list with three values: The current indentation, the | 836 This returns a list with three values: The current indentation, the |
837 parent indentation and the indentation a child should habe. | 837 parent indentation and the indentation a child should have. |
838 Assumes cursor in item line." | 838 Assumes cursor in item line." |
839 (let* ((bolpos (point-at-bol)) | 839 (let* ((bolpos (point-at-bol)) |
840 (ind (org-get-indentation)) | 840 (ind (org-get-indentation)) |
841 ind-down ind-up pos) | 841 ind-down ind-up pos) |
842 (save-excursion | 842 (save-excursion |
866 (defun org-list-parse-list (&optional delete) | 866 (defun org-list-parse-list (&optional delete) |
867 "Parse the list at point and maybe DELETE it. | 867 "Parse the list at point and maybe DELETE it. |
868 Return a list containing first level items as strings and | 868 Return a list containing first level items as strings and |
869 sublevels as a list of strings." | 869 sublevels as a list of strings." |
870 (let* ((item-beginning (org-list-item-beginning)) | 870 (let* ((item-beginning (org-list-item-beginning)) |
871 (start (car item-beginning)) | 871 (start (car item-beginning)) |
872 (end (org-list-end (cdr item-beginning))) | 872 (end (org-list-end (cdr item-beginning))) |
873 output itemsep ltype) | 873 output itemsep ltype) |
874 (while (re-search-forward org-list-beginning-re end t) | 874 (while (re-search-forward org-list-beginning-re end t) |
875 (goto-char (match-beginning 3)) | 875 (goto-char (match-beginning 3)) |
876 (save-match-data | 876 (save-match-data |
877 (cond ((string-match "[0-9]" (match-string 2)) | 877 (cond ((string-match "[0-9]" (match-string 2)) |
878 (setq itemsep "[0-9]+\\(?:\\.\\|)\\)" | 878 (setq itemsep "[0-9]+\\(?:\\.\\|)\\)" |
879 ltype 'ordered)) | 879 ltype 'ordered)) |
880 ((string-match "^.*::" (match-string 0)) | 880 ((string-match "^.*::" (match-string 0)) |
881 (setq itemsep "[-+]" ltype 'descriptive)) | 881 (setq itemsep "[-+]" ltype 'descriptive)) |
882 (t (setq itemsep "[-+]" ltype 'unordered)))) | 882 (t (setq itemsep "[-+]" ltype 'unordered)))) |
883 (let* ((indent1 (match-string 1)) | 883 (let* ((indent1 (match-string 1)) |
884 (nextitem (save-excursion | 884 (nextitem (save-excursion |
885 (save-match-data | 885 (save-match-data |
886 (or (and (re-search-forward | 886 (or (and (re-search-forward |
887 (concat "^" indent1 itemsep " *?") end t) | 887 (concat "^" indent1 itemsep " *?") end t) |
957 (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?") | 957 (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?") |
958 (if maybe | 958 (if maybe |
959 (throw 'exit nil) | 959 (throw 'exit nil) |
960 (error "Don't know how to transform this list")))) | 960 (error "Don't know how to transform this list")))) |
961 (let* ((name (match-string 1)) | 961 (let* ((name (match-string 1)) |
962 (item-beginning (org-list-item-beginning)) | 962 (item-beginning (org-list-item-beginning)) |
963 (transform (intern (match-string 2))) | 963 (transform (intern (match-string 2))) |
964 (txt (buffer-substring-no-properties | 964 (txt (buffer-substring-no-properties |
965 (car item-beginning) | 965 (car item-beginning) |
966 (org-list-end (cdr item-beginning)))) | 966 (org-list-end (cdr item-beginning)))) |
967 (list (org-list-parse-list)) | 967 (list (org-list-parse-list)) |
968 beg) | 968 beg) |
969 (unless (fboundp transform) | 969 (unless (fboundp transform) |
970 (error "No such transformation function %s" transform)) | 970 (error "No such transformation function %s" transform)) |
971 (setq txt (funcall transform list)) | 971 (setq txt (funcall transform list)) |
972 ;; Find the insertion place | 972 ;; Find the insertion place |
973 (save-excursion | 973 (save-excursion |
989 (defun org-list-to-generic (list params) | 989 (defun org-list-to-generic (list params) |
990 "Convert a LIST parsed through `org-list-parse-list' to other formats. | 990 "Convert a LIST parsed through `org-list-parse-list' to other formats. |
991 | 991 |
992 Valid parameters PARAMS are | 992 Valid parameters PARAMS are |
993 | 993 |
994 :ustart String to start an unordered list | 994 :ustart String to start an unordered list |
995 :uend String to end an unordered list | 995 :uend String to end an unordered list |
996 | 996 |
997 :ostart String to start an ordered list | 997 :ostart String to start an ordered list |
998 :oend String to end an ordered list | 998 :oend String to end an ordered list |
999 | 999 |
1000 :dstart String to start a descriptive list | 1000 :dstart String to start a descriptive list |
1001 :dend String to end a descriptive list | 1001 :dend String to end a descriptive list |
1002 :dtstart String to start a descriptive term | 1002 :dtstart String to start a descriptive term |
1003 :dtend String to end a descriptive term | 1003 :dtend String to end a descriptive term |
1004 :ddstart String to start a description | 1004 :ddstart String to start a description |
1005 :ddend String to end a description | 1005 :ddend String to end a description |
1006 | 1006 |
1007 :splice When set to t, return only list body lines, don't wrap | 1007 :splice When set to t, return only list body lines, don't wrap |
1008 them into :[u/o]start and :[u/o]end. Default is nil. | 1008 them into :[u/o]start and :[u/o]end. Default is nil. |
1009 | 1009 |
1010 :istart String to start a list item | 1010 :istart String to start a list item |
1011 :iend String to end a list item | 1011 :iend String to end a list item |
1012 :isep String to separate items | 1012 :isep String to separate items |
1013 :lsep String to separate sublists" | 1013 :lsep String to separate sublists" |
1014 (interactive) | 1014 (interactive) |
1015 (let* ((p params) sublist | 1015 (let* ((p params) sublist |
1016 (splicep (plist-get p :splice)) | 1016 (splicep (plist-get p :splice)) |
1017 (ostart (plist-get p :ostart)) | 1017 (ostart (plist-get p :ostart)) |
1018 (oend (plist-get p :oend)) | 1018 (oend (plist-get p :oend)) |
1019 (ustart (plist-get p :ustart)) | 1019 (ustart (plist-get p :ustart)) |
1020 (uend (plist-get p :uend)) | 1020 (uend (plist-get p :uend)) |
1021 (dstart (plist-get p :dstart)) | 1021 (dstart (plist-get p :dstart)) |
1022 (dend (plist-get p :dend)) | 1022 (dend (plist-get p :dend)) |
1023 (dtstart (plist-get p :dtstart)) | 1023 (dtstart (plist-get p :dtstart)) |
1024 (dtend (plist-get p :dtend)) | 1024 (dtend (plist-get p :dtend)) |
1025 (ddstart (plist-get p :ddstart)) | 1025 (ddstart (plist-get p :ddstart)) |
1026 (ddend (plist-get p :ddend)) | 1026 (ddend (plist-get p :ddend)) |
1027 (istart (plist-get p :istart)) | 1027 (istart (plist-get p :istart)) |
1028 (iend (plist-get p :iend)) | 1028 (iend (plist-get p :iend)) |
1029 (isep (plist-get p :isep)) | 1029 (isep (plist-get p :isep)) |
1030 (lsep (plist-get p :lsep))) | 1030 (lsep (plist-get p :lsep))) |
1031 (let ((wrapper | 1031 (let ((wrapper |
1032 (cond ((eq (car list) 'ordered) | 1032 (cond ((eq (car list) 'ordered) |
1033 (concat ostart "\n%s" oend "\n")) | 1033 (concat ostart "\n%s" oend "\n")) |
1034 ((eq (car list) 'unordered) | 1034 ((eq (car list) 'unordered) |
1035 (concat ustart "\n%s" uend "\n")) | 1035 (concat ustart "\n%s" uend "\n")) |
1037 (concat dstart "\n%s" dend "\n")))) | 1037 (concat dstart "\n%s" dend "\n")))) |
1038 rtn term defstart defend) | 1038 rtn term defstart defend) |
1039 (while (setq sublist (pop list)) | 1039 (while (setq sublist (pop list)) |
1040 (cond ((symbolp sublist) nil) | 1040 (cond ((symbolp sublist) nil) |
1041 ((stringp sublist) | 1041 ((stringp sublist) |
1042 (when (string-match "^\\(.*\\) ::" sublist) | 1042 (when (string-match "^\\(.*\\) ::" sublist) |
1043 (setq term (org-trim (format (concat dtstart "%s" dtend) | 1043 (setq term (org-trim (format (concat dtstart "%s" dtend) |
1044 (match-string 1 sublist)))) | 1044 (match-string 1 sublist)))) |
1045 (setq sublist (substring sublist (1+ (length term))))) | 1045 (setq sublist (substring sublist (1+ (length term))))) |
1046 (setq rtn (concat rtn istart term ddstart | 1046 (setq rtn (concat rtn istart term ddstart |
1047 sublist ddend iend isep))) | 1047 sublist ddend iend isep))) |
1048 (t (setq rtn (concat rtn ;; previous list | 1048 (t (setq rtn (concat rtn ;; previous list |
1049 lsep ;; list separator | 1049 lsep ;; list separator |
1050 (org-list-to-generic sublist p) | 1050 (org-list-to-generic sublist p) |
1051 lsep ;; list separator | 1051 lsep ;; list separator |
1052 ))))) | 1052 ))))) |
1053 (format wrapper rtn)))) | 1053 (format wrapper rtn)))) |
1054 | 1054 |
1055 (defun org-list-to-latex (list) | 1055 (defun org-list-to-latex (list) |
1056 "Convert LIST into a LaTeX list." | 1056 "Convert LIST into a LaTeX list." |
1057 (org-list-to-generic | 1057 (org-list-to-generic |
1058 list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}" | 1058 list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}" |
1059 :ustart "\\begin{itemize}" :uend "\\end{itemize}" | 1059 :ustart "\\begin{itemize}" :uend "\\end{itemize}" |
1060 :dstart "\\begin{description}" :dend "\\end{description}" | 1060 :dstart "\\begin{description}" :dend "\\end{description}" |
1061 :dtstart "[" :dtend "]" | 1061 :dtstart "[" :dtend "]" |
1062 :ddstart "" :ddend "" | 1062 :ddstart "" :ddend "" |
1063 :istart "\\item " :iend "" | 1063 :istart "\\item " :iend "" |
1064 :isep "\n" :lsep "\n"))) | 1064 :isep "\n" :lsep "\n"))) |
1065 | 1065 |
1066 (defun org-list-to-html (list) | 1066 (defun org-list-to-html (list) |
1067 "Convert LIST into a HTML list." | 1067 "Convert LIST into a HTML list." |
1068 (org-list-to-generic | 1068 (org-list-to-generic |
1069 list '(:splicep nil :ostart "<ol>" :oend "</ol>" | 1069 list '(:splicep nil :ostart "<ol>" :oend "</ol>" |
1070 :ustart "<ul>" :uend "</ul>" | 1070 :ustart "<ul>" :uend "</ul>" |
1071 :dstart "<dl>" :dend "</dl>" | 1071 :dstart "<dl>" :dend "</dl>" |
1072 :dtstart "<dt>" :dtend "</dt>" | 1072 :dtstart "<dt>" :dtend "</dt>" |
1073 :ddstart "<dd>" :ddend "</dd>" | 1073 :ddstart "<dd>" :ddend "</dd>" |
1074 :istart "<li>" :iend "</li>" | 1074 :istart "<li>" :iend "</li>" |
1075 :isep "\n" :lsep "\n"))) | 1075 :isep "\n" :lsep "\n"))) |
1076 | 1076 |
1077 (defun org-list-to-texinfo (list) | 1077 (defun org-list-to-texinfo (list) |
1078 "Convert LIST into a Texinfo list." | 1078 "Convert LIST into a Texinfo list." |
1079 (org-list-to-generic | 1079 (org-list-to-generic |
1080 list '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize" | 1080 list '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize" |
1081 :ustart "@enumerate" :uend "@end enumerate" | 1081 :ustart "@enumerate" :uend "@end enumerate" |
1082 :dstart "@table" :dend "@end table" | 1082 :dstart "@table" :dend "@end table" |
1083 :dtstart "@item " :dtend "\n" | 1083 :dtstart "@item " :dtend "\n" |
1084 :ddstart "" :ddend "" | 1084 :ddstart "" :ddend "" |
1085 :istart "@item\n" :iend "" | 1085 :istart "@item\n" :iend "" |
1086 :isep "\n" :lsep "\n"))) | 1086 :isep "\n" :lsep "\n"))) |
1087 | 1087 |
1088 (provide 'org-list) | 1088 (provide 'org-list) |
1089 | 1089 |
1090 ;; arch-tag: 73cf50c1-200f-4d1d-8a53-4e842a5b11c8 | 1090 ;; arch-tag: 73cf50c1-200f-4d1d-8a53-4e842a5b11c8 |
1091 ;;; org-list.el ends here | 1091 ;;; org-list.el ends here |