From cdd4f2c65a179995e35daad8069bd4e70e34a6ef Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 1 Jan 2006 05:04:36 +0000 Subject: [PATCH] Fix a few more list markup issues. * lisp/muse-publish.el (muse-publish-surround-dl): Begin this function for definition list markup, but it's not useful yet. (muse-publish-surround-text): Accept post-indent argument, and use it to strip extra space from indented lists, hopefully in a smart way. (muse-forward-list-item): Don't explicitly move the point unless another list item of the same type is encountered. (muse-publish-markup-list): Calculate post-indent correctly, and make use of it. git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-334 --- ChangeLog | 20 ++++++++++++++++++++ lisp/muse-publish.el | 35 ++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45fda09..2f9863a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,26 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2006-01-01 05:04:36 GMT Michael Olson patch-334 + + Summary: + Fix a few more list markup issues. + Revision: + muse--main--1.0--patch-334 + + * lisp/muse-publish.el (muse-publish-surround-dl): Begin this function + for definition list markup, but it's not useful yet. + (muse-publish-surround-text): Accept post-indent argument, and use it + to strip extra space from indented lists, hopefully in a smart way. + (muse-forward-list-item): Don't explicitly move the point unless + another list item of the same type is encountered. + (muse-publish-markup-list): Calculate post-indent correctly, and make + use of it. + + modified files: + ChangeLog lisp/muse-publish.el + + 2005-12-30 23:22:45 GMT Michael Olson patch-333 Summary: diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index e0e1d3e..8d82bb4 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -924,10 +924,11 @@ The following contexts exist in Muse. (delete-region (match-beginning 0) (match-end 0)) (muse-insert-markup (muse-markup-text 'fn-sep))) -(defun muse-publish-surround-text (beg-tag end-tag move-func &optional indent) +(defun muse-publish-surround-dl (move-func &optional indent) (unless indent (setq indent (concat "[" muse-regexp-blank "]+"))) (let ((continue t) + (beg-dde (muse-markup-text 'begin-dde)) beg) (while continue (muse-insert-markup beg-tag) @@ -945,6 +946,29 @@ The following contexts exist in Muse. (when continue (goto-char (point-max))))))) +(defun muse-publish-surround-text (beg-tag end-tag move-func &optional indent post-indent) + (unless indent + (setq indent (concat "[" muse-regexp-blank "]+"))) + (when post-indent + (setq post-indent (concat " \\{0," (number-to-string post-indent) "\\}"))) + (let ((continue t) + beg) + (while continue + (muse-insert-markup beg-tag) + (setq beg (point) + continue (funcall move-func)) + (save-restriction + (narrow-to-region beg (point)) + (goto-char (point-min)) + (while (< (point) (point-max)) + (when (looking-at (concat indent post-indent)) + (replace-match "")) + (forward-line 1)) + (skip-chars-backward (concat muse-regexp-blank "\n")) + (muse-insert-markup end-tag) + (when continue + (goto-char (point-max))))))) + (defun muse-list-item-type (str) "Determine the type of list given STR. Returns either 'ul, 'ol, or 'dl." @@ -975,7 +999,6 @@ The beginning indentation is given by INDENT." (unless (eq type 'dl) (replace-match "" t t nil 3)) (goto-char (match-beginning 2))) - (goto-char (match-beginning 0)) nil))) (defun muse-publish-markup-list () @@ -986,9 +1009,7 @@ like read-only from being inadvertently deleted." (type (muse-list-item-type str)) (indent (buffer-substring (muse-line-beginning-position) (match-beginning 1))) - (post-indent (length (save-match-data - (when (string-match "\\s-+\\'" str) - (match-string 0 str))))) + (post-indent (length str)) (last (match-beginning 0))) (cond ((eq type 'ul) @@ -1001,7 +1022,7 @@ like read-only from being inadvertently deleted." (muse-markup-text 'end-uli-item) (function (lambda () (muse-forward-list-item type indent))) - indent) + indent post-indent) (muse-insert-markup (muse-markup-text 'end-uli))) (forward-line 1))) ((eq type 'ol) @@ -1013,7 +1034,7 @@ like read-only from being inadvertently deleted." (muse-markup-text 'end-oli-item) (function (lambda () (muse-forward-list-item type indent))) - indent) + indent post-indent) (muse-insert-markup (muse-markup-text 'end-oli))) (forward-line 1)) (t -- 2.11.4.GIT