From ebd14ac42726bb25874295615cb5928bd5748c50 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 20 Mar 2005 19:40:10 +0000 Subject: [PATCH] Apply latest journal-related updates from johnw git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-16 --- ChangeLog | 12 +++++ examples/muse-johnw.el | 81 +++++++++++++++++++----------- muse-journal.el | 133 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 176 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8b79b8..5a0ceb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,18 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-03-20 19:40:10 GMT Michael Olson patch-16 + + Summary: + Apply latest journal-related updates from johnw + Revision: + muse--main--1.0--patch-16 + + + modified files: + ChangeLog examples/muse-johnw.el muse-journal.el + + 2005-03-01 02:58:29 GMT Michael Olson patch-15 Summary: diff --git a/examples/muse-johnw.el b/examples/muse-johnw.el index 40bdb2d..4556274 100644 --- a/examples/muse-johnw.el +++ b/examples/muse-johnw.el @@ -59,7 +59,15 @@ :before 'muse-my-journal-find-entries :after 'muse-my-journal-insert-contents :header "~/Documents/site/header.html" - :footer "~/Documents/site/footer.html")) + :footer "~/Documents/site/footer.html") + (muse-derive-style "newartisans-html" "html" + :maintainer "johnw@newartisans.com" + :header "~/Sites/newartisans/header.html" + :footer "~/Sites/newartisans/footer.html") + (muse-derive-style "newartisans-journal-html" "journal-html" + :maintainer "johnw@newartisans.com" + :header "~/Sites/newartisans/header.html" + :footer "~/Sites/newartisans/footer.html")) (custom-set-variables '(muse-project-alist @@ -111,7 +119,18 @@ (:base "site-journal-html" :path "~/Sites/johnw" :include "/journal/") (:base "journal-rdf" :path "~/Sites/johnw" - :include "/journal/journal"))))) + :include "/journal/journal" + :base-url "http://www.newartisans.com/johnw/") + (:base "journal-rss" :path "~/Sites/johnw" + :include "/journal/journal" + :base-url "http://www.newartisans.com/johnw/")) + ("newartisans" ; my company + ("~/Documents/newartisans" + :default "index") + (:base "newartisans-html" :path "~/Sites/newartisans" + :exclude "/news") + (:base "newartisans-journal-html" :path "~/Sites/newartisans" + :include "/news"))))) '(muse-mode-highlight-p t nil (muse-colors)) '(muse-mode-auto-p t nil (muse-project)) '(muse-latex-header "~/Documents/site/header.tex") @@ -120,7 +139,6 @@ '(muse-poem-latex-header "~/Documents/site/poem-header.tex") '(muse-poem-latex-footer "~/Documents/site/poem-footer.tex") '(muse-chapbook-latex-header "~/Documents/site/chapbook-header.tex") - '(muse-journal-rdf-base-url "http://www.newartisans.com/johnw/") ;;'(muse-before-publish-hook (quote (muse-cite-munge-footnotes))) '(muse-mode-hook (quote (list footnote-mode turn-on-auto-fill flyspell-mode)))) @@ -211,7 +229,7 @@ (setq index 1 contents (reverse contents)) (when (> (length contents) 0) (goto-char (point-min)) - (search-forward "

Recent Work

") + (search-forward "

Archives

") (beginning-of-line) (insert "

Contents

\n\n
    \n") (dolist (item contents) @@ -257,7 +275,7 @@ (defun muse-my-journal-insert-contents () (goto-char (point-min)) - (search-forward "

    Recent Work

    ") + (search-forward "

    Archives

    ") (beginning-of-line) (if (string= "journal" (muse-page-name)) (insert "

    Recent Entries

    \n\n
      \n") @@ -272,31 +290,34 @@ (car entry)))) (insert "
    \n\n")) -(eval-when-compile - (defvar muse-current-project)) - -(defvar muse-essay-tag '("essay" nil t muse-essay-markup-tag)) - -(defun muse-essay-markup-tag (beg end attrs) - "This markup tag allows a poem to be included from another project page. -The form of usage is: - " - (let ((page (cdr (assoc (cdr (assoc "title" attrs)) - (muse-project-file-alist)))) - beg start end text) - (if (null page) - (insert " *Reference to\n unknown essay \"" - (cdr (assoc "title" attrs)) "\".*\n") - (setq beg (point)) - (insert - (with-temp-buffer - (insert-file-contents page) - (goto-char (point-min)) - (forward-paragraph) - (forward-line) - (buffer-substring-no-properties (point) (point-max))))))) - -(add-to-list 'muse-publish-markup-tags muse-essay-tag) +;; (eval-when-compile +;; (defvar muse-current-project)) +;; +;; (defvar muse-ref-tag '("ref" nil t muse-ref-markup-tag)) +;; +;; (defun muse-ref-markup-tag (beg end attrs) +;; "This markup tag allows a poem to be included from another project page. +;; The form of usage is: +;; " +;; (let ((page (cdr (assoc (cdr (assoc "title" attrs)) +;; (muse-project-file-alist)))) +;; beg start end text) +;; (if (null page) +;; (insert " *Reference to\n unknown page \"" +;; (cdr (assoc "title" attrs)) "\".*\n") +;; (setq beg (point)) +;; (let (title) +;; (if (string-match "html" muse-publishing-current-style) +;; t +;; (insert +;; (with-temp-buffer +;; (insert-file-contents page) +;; (goto-char (point-min)) +;; (forward-paragraph) +;; (forward-line) +;; (buffer-substring-no-properties (point) (point-max))))))))) +;; +;; (add-to-list 'muse-publish-markup-tags muse-ref-tag) (when (and window-system (load "httpd" t)) (require 'muse-http) diff --git a/muse-journal.el b/muse-journal.el index c37d22c..cc83032 100644 --- a/muse-journal.el +++ b/muse-journal.el @@ -152,17 +152,17 @@ and group 3 is the optional heading for the entry." " - (concat muse-journal-rdf-base-url + (concat (muse-style-element :base-url) (muse-publish-output-name))\"> <lisp>(muse-publishing-directive \"title\")</lisp> - (concat muse-journal-rdf-base-url + (concat (muse-style-element :base-url) (concat (muse-page-name) muse-html-extension)) - A Journal + (muse-publishing-directive \"desc\") - (concat muse-journal-rdf-base-url + (concat (muse-style-element :base-url) (concat (muse-page-name) muse-html-extension))\"/> @@ -198,7 +198,68 @@ and group 3 is the optional heading for the entry." :type 'string :group 'muse-journal) -(defcustom muse-journal-rdf-markup-regexps +(defcustom muse-journal-rdf-summarize-entries t + "If non-nil, include only summaries in the RDF file, not the full data." + :type 'boolean + :group 'muse-journal) + +(defcustom muse-journal-rss-extension ".xml" + "" + :type 'string + :group 'muse-journal) + +(defcustom muse-journal-rss-base-url "" + "The base URL of the website reference by the RSS file." + :type 'string + :group 'muse-journal) + +(defcustom muse-journal-rss-header + "<\?xml version=\"1.0\" encoding=\"iso-8859-1\"\?> + + + <lisp>(muse-publishing-directive \"title\")</lisp> + (concat (muse-style-element :base-url) + (concat (muse-page-name) + muse-html-extension)) + (muse-publishing-directive \"desc\") + en-us + Emacs Muse" + "" + :type '(choice string file) + :group 'muse-journal) + +(defcustom muse-journal-rss-footer + " +\n" + "" + :type '(choice string file) + :group 'muse-journal) + +(defcustom muse-journal-rss-date-format + "%a, %d %b %Y %H:%M:%S %Z" + "" + :type 'string + :group 'muse-journal) + +(defcustom muse-journal-rss-entry-template + " + %title% + %link%#%anchor% + %desc% + (muse-publishing-directive \"author\") + %date% + %link%#%anchor% + \n" + "" + :type 'string + :group 'muse-journal) + +(defcustom muse-journal-rss-summarize-entries nil + "If non-nil, include only summaries in the RSS file, not the full data." + :type 'boolean + :group 'muse-journal) + +(defcustom muse-journal-rss-markup-regexps '((10000 muse-link-regexp 0 "\\2")) "List of markup rules for publishing a Muse journal page to RDF. For more on the structure of this list, see `muse-publish-markup-regexps'." @@ -211,7 +272,7 @@ For more on the structure of this list, see `muse-publish-markup-regexps'." function)) :group 'muse-journal) -(defcustom muse-journal-rdf-markup-functions +(defcustom muse-journal-rss-markup-functions '((email . ignore) (link . ignore) (url . ignore)) @@ -399,7 +460,7 @@ For more on the structure of this list, see (goto-char end) (insert (muse-markup-text 'end-quote))) -(defun muse-journal-rdf-munge-buffer () +(defun muse-journal-rss-munge-buffer () (goto-char (point-min)) (let ((heading-regexp (concat "^\\* " muse-journal-heading-regexp "$")) (inhibit-read-only t)) @@ -419,13 +480,15 @@ For more on the structure of this list, see (string-to-int (match-string 1 date)) (current-time-zone)) date (format-time-string - muse-journal-rdf-date-format date)))) + (muse-style-element :date-format) date)))) (save-restriction (narrow-to-region (match-beginning 0) (if (re-search-forward heading-regexp nil t) (match-beginning 0) - (point-max))) + (if (re-search-forward "^Footnotes:" nil t) + (match-beginning 0) + (point-max)))) (goto-char (point-min)) (delete-region (point) (line-end-position)) (re-search-forward "\n+" nil t) @@ -433,10 +496,22 @@ For more on the structure of this list, see (eq ?\ (char-syntax (char-after)))) (delete-char 1)) (let ((beg (point))) - (forward-sentence 2) - (setq desc (buffer-substring beg (point)))) + (if (muse-style-element :summarize) + (progn + (forward-sentence 2) + (setq desc (concat (buffer-substring beg (point)) "..."))) + (save-restriction + (muse-publish-markup-buffer "rss-entry" "html") + (goto-char (point-min)) + (re-search-forward "Page published by Emacs Muse") + (goto-char (line-end-position)) + (setq beg (point)) + (re-search-forward "Page published by Emacs Muse") + (goto-char (line-beginning-position)) + (setq desc (concat ""))))) (delete-region (point-min) (point-max)) - (let ((entry muse-journal-rdf-entry-template)) + (let ((entry (muse-style-element :entry-template))) (while (string-match "%date%" entry) (setq entry (replace-match (or date "") nil t entry))) (while (string-match "%title%" entry) @@ -445,7 +520,7 @@ For more on the structure of this list, see (setq entry (replace-match desc nil t entry))) (while (string-match "%link%" entry) (setq entry (replace-match - (concat muse-journal-rdf-base-url + (concat (muse-style-element :base-url) (concat (muse-page-name) muse-html-extension)) nil t entry))) @@ -458,7 +533,9 @@ For more on the structure of this list, see (or (muse-style-element :maintainer) (concat "webmaster@" (system-name))) nil t entry))) - (insert entry))))))) + (insert entry))))) + (unless (eobp) + (delete-region (point) (point-max))))) (unless (assoc "journal-html" muse-publishing-styles) (muse-derive-style "journal-html" "html" @@ -483,12 +560,28 @@ For more on the structure of this list, see :before-end 'muse-journal-latex-munge-buffer) (muse-define-style "journal-rdf" - :suffix 'muse-journal-rdf-extension - :regexps 'muse-journal-rdf-markup-regexps - :functions 'muse-journal-rdf-markup-functions - :before 'muse-journal-rdf-munge-buffer - :header 'muse-journal-rdf-header - :footer 'muse-journal-rdf-footer)) + :suffix 'muse-journal-rdf-extension + :regexps 'muse-journal-rss-markup-regexps + :functions 'muse-journal-rss-markup-functions + :before 'muse-journal-rss-munge-buffer + :header 'muse-journal-rdf-header + :footer 'muse-journal-rdf-footer + :date-format 'muse-journal-rdf-date-format + :entry-template 'muse-journal-rdf-entry-template + :base-url 'muse-journal-rdf-base-url + :summarize 'muse-journal-rdf-summarize-entries) + + (muse-define-style "journal-rss" + :suffix 'muse-journal-rss-extension + :regexps 'muse-journal-rss-markup-regexps + :functions 'muse-journal-rss-markup-functions + :before 'muse-journal-rss-munge-buffer + :header 'muse-journal-rss-header + :footer 'muse-journal-rss-footer + :date-format 'muse-journal-rss-date-format + :entry-template 'muse-journal-rss-entry-template + :base-url 'muse-journal-rss-base-url + :summarize 'muse-journal-rss-summarize-entries)) (provide 'muse-journal) -- 2.11.4.GIT