From a3846ce252451ddccd6ff6f89f9284814728e987 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 10 Jul 2005 22:19:26 +0000 Subject: [PATCH] muse-docbook: Merge several other types of tags if necessary. * lisp/muse-docbook.el (muse-docbook-fixup-tags): Renamed from `muse-docbook-fixup-sections'. For each TAG in `muse-docbook-merged-tags', if consecutive groupings of TAG exist, merge them together. Thanks to Dale P. Smith for the suggestion. (muse-docbook-merged-tags): Customizable list of tags that need merging. git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-123 --- ChangeLog | 17 +++++++++++++++++ lisp/muse-docbook.el | 28 ++++++++++++++++++---------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b932af..fea58ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-07-10 22:19:26 GMT Michael Olson patch-123 + + Summary: + muse-docbook: Merge several other types of tags if necessary. + Revision: + muse--main--1.0--patch-123 + + * lisp/muse-docbook.el (muse-docbook-fixup-tags): Renamed from + `muse-docbook-fixup-sections'. For each TAG in + `muse-docbook-merged-tags', if consecutive groupings of TAG exist, + merge them together. Thanks to Dale P. Smith for the suggestion. + (muse-docbook-merged-tags): Customizable list of tags that need merging. + + modified files: + ChangeLog lisp/muse-docbook.el + + 2005-07-10 22:04:50 GMT Michael Olson patch-122 Summary: diff --git a/lisp/muse-docbook.el b/lisp/muse-docbook.el index 8071458..10b9c87 100644 --- a/lisp/muse-docbook.el +++ b/lisp/muse-docbook.el @@ -239,16 +239,24 @@ match is found, `muse-docbook-charset-default' is used instead." "\n" "\n" "\n" "\n"))) -(defun muse-docbook-fixup-sections () - (goto-char (point-min)) - (let (last) - (while (re-search-forward "\n*
" nil t) +(defcustom muse-docbook-merged-tags + '("itemizedlist" "orderedlist" "section" "variablelist") + "Tags which need to be merged together if they are consecutive." + :type '(repeat (string :tag "Tag")) + :group 'muse-docbook) + +(defun muse-docbook-fixup-tags () + "Merge multiple sections of TAG together." + (dolist (tag muse-docbook-merged-tags) + (goto-char (point-min)) + (let (last) + (while (re-search-forward (concat "\n*<" tag ">") nil t) + (when last + (replace-match (concat "\n\n\n<" tag ">"))) + (setq last (match-beginning 0))) (when last - (replace-match "\n
\n\n
")) - (setq last (match-beginning 0))) - (when last - (goto-char (point-max)) - (insert "
")))) + (goto-char (point-max)) + (insert ""))))) (defun muse-docbook-finalize-buffer () (when (memq buffer-file-coding-system '(no-conversion undecided-unix)) @@ -264,7 +272,7 @@ match is found, `muse-docbook-charset-default' is used instead." :functions 'muse-docbook-markup-functions :strings 'muse-docbook-markup-strings :specials 'muse-docbook-markup-specials - :before-end 'muse-docbook-fixup-sections + :before-end 'muse-docbook-fixup-tags :after 'muse-docbook-finalize-buffer :header 'muse-docbook-header :footer 'muse-docbook-footer -- 2.11.4.GIT