Allow white spaces between the counter and the check-box in an item

* lisp/org-list.el (org-list-full-item-re): allow counter and
  check-box to be separated by white spaces.
(org-list-struct-apply-struct): reflect changes made to
`org-list-full-item-re'.
* lisp/org-html.el (org-html-export-list-line): recognize spaces
  between counter and check-boxes as valid.
* lisp/org-docbook.el (org-export-docbook-list-line): ditto.
This commit is contained in:
Nicolas Goaziou 2011-06-30 22:55:05 +02:00
parent e070ebe6b0
commit 934aae8812
3 changed files with 11 additions and 9 deletions

View File

@ -1398,7 +1398,7 @@ the alist of previous items."
;; At an item: insert appropriate tags in export buffer. ;; At an item: insert appropriate tags in export buffer.
((assq pos struct) ((assq pos struct)
(string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)" (string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)"
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?" "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\][ \t]*\\)?"
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?" "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
"\\(.*\\)") "\\(.*\\)")

View File

@ -2531,7 +2531,7 @@ the alist of previous items."
((assq pos struct) ((assq pos struct)
(string-match (string-match
(concat "[ \t]*\\(\\S-+[ \t]*\\)" (concat "[ \t]*\\(\\S-+[ \t]*\\)"
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?" "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?" "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"
"\\(.*\\)") line) "\\(.*\\)") line)

View File

@ -370,8 +370,8 @@ specifically, type `block' is determined by the variable
It depends on `org-empty-line-terminates-plain-lists'.") It depends on `org-empty-line-terminates-plain-lists'.")
(defconst org-list-full-item-re (defconst org-list-full-item-re
(concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]*\\)" (concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\\)"
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?" "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?") "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?")
"Matches a list item and puts everything into groups: "Matches a list item and puts everything into groups:
@ -1647,11 +1647,13 @@ Initial position of cursor is restored after the changes."
((and (match-string 3) new-box) ((and (match-string 3) new-box)
(replace-match new-box nil nil nil 3)) (replace-match new-box nil nil nil 3))
((match-string 3) ((match-string 3)
(goto-char (or (match-end 2) (match-end 1))) ;; (goto-char (or (match-end 2) (match-end 1)))
(looking-at "\\[[ X-]\\][ \t]+") ;; (skip-chars-backward " \t")
(replace-match "")) (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)")
(t (goto-char (or (match-end 2) (match-end 1))) (replace-match "" nil nil nil 1))
(insert (concat new-box " ")))) (t (let ((counterp (match-end 2)))
(goto-char (if counterp (1+ counterp) (match-end 1)))
(insert (concat new-box (unless counterp " "))))))
;; c. Indent item to appropriate column. ;; c. Indent item to appropriate column.
(unless (= new-ind old-ind) (unless (= new-ind old-ind)
(delete-region (goto-char (point-at-bol)) (delete-region (goto-char (point-at-bol))