From e07352d154770d4129ce4e0dd1c6feb076e57280 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sat, 3 Jun 2006 21:12:36 +0000 Subject: [PATCH] Provide some markup shortcuts for the tag. * lisp/muse-publish.el (muse-publish-examplify-buffer): New function that transforms the current buffer as if it were an region. (muse-publish-versify-buffer): Ditto, but for regions. (muse-publish-include-tag): Docfix. Support special cases for markup="example" and markup="verse". * muse.texi (Tag Summary): Update for new shortcuts. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-151 --- ChangeLog | 19 +++++++++++++++++++ lisp/muse-publish.el | 48 ++++++++++++++++++++++++++++++++++++------------ muse.texi | 24 ++++++++++++++++-------- 3 files changed, 71 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6129352..09b9466 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2006/muse--main--1.0 # +2006-06-03 21:12:36 GMT Michael Olson patch-151 + + Summary: + Provide some markup shortcuts for the tag. + Revision: + muse--main--1.0--patch-151 + + * lisp/muse-publish.el (muse-publish-examplify-buffer): New function that + transforms the current buffer as if it were an region. + (muse-publish-versify-buffer): Ditto, but for regions. + (muse-publish-include-tag): Docfix. Support special cases for + markup="example" and markup="verse". + + * muse.texi (Tag Summary): Update for new shortcuts. + + modified files: + ChangeLog lisp/muse-publish.el muse.texi + + 2006-06-01 04:14:45 GMT Michael Olson patch-150 Summary: diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index 485c7e7..0cabdeb 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -1475,23 +1475,41 @@ This is usually applied to extended links." (goto-char beg) (muse-insert-markup (muse-markup-text 'comment-begin)))) +(defun muse-publish-examplify-buffer () + "Transform the current buffer as if it were an region." + (let ((end (progn (goto-char (point-max)) (point-marker)))) + (muse-publish-example-tag (point-min) end))) + +(defun muse-publish-versify-buffer () + "Transform the current buffer as if it were a region." + (muse-publish-verse-tag (point-min) (point-max)) + (muse-publish-markup "" + `((100 ,(concat "^[" muse-regexp-blank "]*> ") 0 + muse-publish-markup-verse)))) + (defun muse-publish-include-tag (beg end attrs) "Include the named file at the current location during publishing. - + + +The `markup' attribute controls how this section is marked up. +If it is omitted, publish the included text with the normal Muse +rules. -Files are marked up according to the Muse publishing rules. If -you want no markup to be performed, either add -.. inside the source file or use the -following invocation. +If \"nil\", do not mark up the included text at all. - +If \"example\", treat the included text as if it was surrounded +by the tag. -The `markup' attribute controls how this section is marked up. If -non-nil, it should be the name of a function to call after +If \"verse\", treat the included text as if it was surrounded +by the tag, to preserve newlines. + +Otherwise, it should be the name of a function to call after inserting the file with the buffer narrowed to the section -inserted. Note that no further marking-up will be performed on -this region." +inserted. + +Note that no further marking-up will be performed on this +region." (let ((filename (cdr (assoc "file" attrs))) (markup (cdr (assoc "markup" attrs))) (muse-publishing-directives muse-publishing-directives)) @@ -1502,8 +1520,14 @@ this region." (error "No file attribute specified in tag")) (if markup (let ((markup-function (read markup))) - (if (and markup-function (not (functionp markup-function))) - (error "Invalid markup function `%s'" markup) + (cond ((eq markup-function 'example) + (setq markup-function #'muse-publish-examplify-buffer)) + ((eq markup-function 'verse) + (setq markup-function #'muse-publish-versify-buffer)) + ((and markup-function (not (functionp markup-function))) + (error "Invalid markup function `%s'" markup)) + (t nil)) + (when markup-function (save-restriction (narrow-to-region beg end) (insert-file-contents filename) diff --git a/muse.texi b/muse.texi index 97a902f..b2302b3 100644 --- a/muse.texi +++ b/muse.texi @@ -1007,14 +1007,22 @@ Publish the region in monospace, preserving the newlines in the region. This is useful for snippets of code. @item || -Include the named file at the current location during publishing. Files -are marked up according to the Muse publishing rules by default. If you -want to specify a command to be run instead of marking up the region, -use the ``markup'' argument with the name of the command. - -If you want no markup to be performed, either add -@verb{|..|} inside the source file or specify -markup="nil". +Include the named file at the current location during publishing. + +The ``markup'' attribute controls how this section is marked up. +If it is omitted, publish the included text with the normal Muse +rules. + +If "nil", do not mark up the included text at all. + +If "example", treat the included text as if it was surrounded by the +@verb{||} tag. + +If "verse", treat the included text as if it was surrounded by the +@verb{||} tag, to preserve newlines. + +Otherwise, it should be the name of a function to call after inserting +the file with the buffer narrowed to the section inserted. @item || Evaluate the Emacs Lisp expressions between the initial and ending tags. -- 2.11.4.GIT