From d2362eb1477641c6dc2b2b1cd8a6157a64a61c15 Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Sun, 12 Aug 2007 23:36:14 -0400 Subject: [PATCH] Fix bug with directives like #title leaking out of included regions * lisp/muse-publish.el (muse-publish-cite-tag): Don't let-bind muse-publishing-directives, because there is no need to do so. Fix code indentation. (muse-publish-markup-attribute): Avoid multiple evaluation of attrs argument, in case it is list value instead of a symbol. Use sexp instead of form in the edebug-form-spec. (muse-publish-include-tag): Make a full copy of muse-publishing-directives, since it can be modified with setcdr. This fixes a bug where #title and some other directives were leaking out of an included region. (muse-publish-mark-up-tag): Don't let-bind muse-publishing-directives, because there is no need to do so. --- ChangeLog | 19 +++++++++++++++++++ lisp/muse-publish.el | 27 +++++++++++++-------------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7880e36..962bf19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-08-12 Michael Olson + * lisp/muse-html.el (muse-html-strip-links): New function that + strips HTML links from a string. + (muse-html-insert-contents): Use it, instead of + muse-publish-strip-tags. This fixes a bug reported by Xin Shi + involving the use of in section titles. + * lisp/muse-project.el (muse-project-resolve-directory): New function that figures out the directory part of the path that provides a link to a page. @@ -18,6 +24,19 @@ * lisp/muse-publish.el (muse-publish-link-name) (muse-publish-link-file, muse-publish-link-page): Add docstrings so that I can remember what each of these things do. + (muse-publish-strip-tags): Remove, since it is no longer used. + (muse-publish-cite-tag): Don't let-bind + muse-publishing-directives, because there is no need to do so. + Fix code indentation. + (muse-publish-markup-attribute): Avoid multiple evaluation of + attrs argument, in case it is list value instead of a symbol. Use + sexp instead of form in the edebug-form-spec. + (muse-publish-include-tag): Make a full copy of + muse-publishing-directives, since it can be modified with setcdr. + This fixes a bug where #title and some other directives were + leaking out of an included region. + (muse-publish-mark-up-tag): Don't let-bind + muse-publishing-directives, because there is no need to do so. * lisp/muse.el (muse-page-name): Improve docstring. diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index 4265dc8..c867b1b 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -1794,14 +1794,12 @@ This is usually applied to explicit links." (defun muse-publish-cite-tag (beg end attrs) (let* ((type (muse-publish-get-and-delete-attr "type" attrs)) - (muse-publishing-directives muse-publishing-directives) - (citetag - (cond ((string-equal type "author") - 'begin-cite-author) - ((string-equal type "year") - 'begin-cite-year) - (t - 'begin-cite)))) + (citetag (cond ((string-equal type "author") + 'begin-cite-author) + ((string-equal type "year") + 'begin-cite-year) + (t + 'begin-cite)))) (goto-char beg) (insert (muse-markup-text citetag (muse-publishing-directive "bibsource"))) (goto-char end) @@ -1905,9 +1903,11 @@ narrowed region after evaluating BODY. The function should take the ATTRS parameter. BEG is modified to be the start of the published markup." - (let ((markup (make-symbol "markup")) + (let ((attrs-sym (make-symbol "attrs")) + (markup (make-symbol "markup")) (markup-function (make-symbol "markup-function"))) - `(let ((,markup (muse-publish-get-and-delete-attr "markup" ,attrs))) + `(let* ((,attrs-sym ,attrs) + (,markup (muse-publish-get-and-delete-attr "markup" ,attrs-sym))) (save-restriction (narrow-to-region ,beg ,end) (goto-char (point-min)) @@ -1928,13 +1928,13 @@ BEG is modified to be the start of the published markup." (error "Invalid markup function `%s'" ,markup)) (t nil)) (if ,markup-function - (funcall ,markup-function ,attrs) + (funcall ,markup-function ,attrs-sym) (muse-publish-mark-read-only (point-min) (point-max)) (goto-char (point-max))))))))) (put 'muse-publish-markup-attribute 'lisp-indent-function 4) (put 'muse-publish-markup-attribute 'edebug-form-spec - '(form form form form body)) + '(sexp sexp sexp sexp body)) (defun muse-publish-lisp-tag (beg end attrs) (muse-publish-markup-attribute beg end attrs nil @@ -2004,7 +2004,7 @@ The `markup' attribute controls how this file is marked up after being inserted. See `muse-publish-markup-attribute' for an explanation of how it works." (let ((filename (muse-publish-get-and-delete-attr "file" attrs)) - (muse-publishing-directives muse-publishing-directives)) + (muse-publishing-directives (copy-tree muse-publishing-directives))) (if filename (setq filename (expand-file-name filename @@ -2042,7 +2042,6 @@ current style is exactly this style." (and (not exactp) (muse-style-derived-p style))) (let* ((function (cdr (assoc "function" attrs))) (muse-publish-use-header-footer-tags nil) - (muse-publishing-directives muse-publishing-directives) (markup-function (and function (intern function)))) (if (and markup-function (functionp markup-function)) (save-restriction -- 2.11.4.GIT