1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-26 10:49:38 +00:00

Implement offsets for ordered lists

1. [@start:12] will star a lit a number 12
This commit is contained in:
Carsten Dominik 2010-04-26 12:25:08 +02:00
parent 35204940d2
commit b82652d90c
3 changed files with 33 additions and 9 deletions

View File

@ -1,5 +1,11 @@
2010-04-26 Carsten Dominik <carsten.dominik@gmail.com> 2010-04-26 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-lists): Accept ordered list
item offset cookie.
* org-html.el (org-export-as-html): Accept ordered list
item offset cookie.
* org-indent.el (org-indent-mode): Turn off `indent-tabs-mode' * org-indent.el (org-indent-mode): Turn off `indent-tabs-mode'
which messes up alignment of tags. which messes up alignment of tags.

View File

@ -710,7 +710,7 @@ PUB-DIR is set, use this as the publishing directory."
table-buffer table-orig-buffer table-buffer table-orig-buffer
ind item-type starter didclose ind item-type starter didclose
rpl path attr desc descp desc1 desc2 link rpl path attr desc descp desc1 desc2 link
snumber fnc item-tag snumber fnc item-tag initial-number
footnotes footref-seen footnotes footref-seen
id-file href id-file href
) )
@ -1284,7 +1284,11 @@ lang=\"%s\" xml:lang=\"%s\">
starter (if (match-beginning 2) starter (if (match-beginning 2)
(substring (match-string 2 line) 0 -1)) (substring (match-string 2 line) 0 -1))
line (substring line (match-beginning 5)) line (substring line (match-beginning 5))
initial-number nil
item-tag nil) item-tag nil)
(if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
(setq initial-number (match-string 1 line)
line (replace-match "" t t line)))
(if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
(setq item-type "d" (setq item-type "d"
item-tag (match-string 1 line) item-tag (match-string 1 line)
@ -1309,11 +1313,15 @@ lang=\"%s\" xml:lang=\"%s\">
((and starter ((and starter
(or (not in-local-list) (or (not in-local-list)
(> ind (car local-list-indent)))) (> ind (car local-list-indent))))
;; check for a specified start number
;; Start new (level of) list ;; Start new (level of) list
(org-close-par-maybe) (org-close-par-maybe)
(insert (cond (insert (cond
((equal item-type "u") "<ul>\n<li>\n") ((equal item-type "u") "<ul>\n<li>\n")
((equal item-type "o") "<ol>\n<li>\n") ((equal item-type "o")
(if initial-number
(format "<ol start=%s>\n<li>\n" initial-number)
"<ol>\n<li>\n"))
((equal item-type "d") ((equal item-type "d")
(format "<dl>\n<dt>%s</dt><dd>\n" item-tag)))) (format "<dl>\n<dt>%s</dt><dd>\n" item-tag))))
(push item-type local-list-type) (push item-type local-list-type)

View File

@ -2166,13 +2166,23 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(defun org-export-latex-lists () (defun org-export-latex-lists ()
"Convert plain text lists in current buffer into LaTeX lists." "Convert plain text lists in current buffer into LaTeX lists."
(goto-char (point-min)) (let (res)
(while (re-search-forward org-list-beginning-re nil t) (goto-char (point-min))
(org-if-unprotected (while (re-search-forward org-list-beginning-re nil t)
(beginning-of-line) (org-if-unprotected
(insert (org-list-to-latex (org-list-parse-list t) (beginning-of-line)
org-export-latex-list-parameters)) (setq res (org-list-to-latex (org-list-parse-list t)
"\n"))) org-export-latex-list-parameters))
(while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]"
res)
(setq res (replace-match
(concat (format "\\setcounter{enumi}{%d}"
(1- (string-to-number
(match-string 2 res))))
"\n"
(match-string 1 res))
t t res)))
(insert res "\n")))))
(defconst org-latex-entities (defconst org-latex-entities
'("\\!" '("\\!"