No, we really did need the auto-mode-alist part at top-level
[muse-el.git] / lisp / muse-journal.el
blob569a413553f61e6eb80ac7facba6bab0470806c4
1 ;;; muse-journal.el --- keep and publish a journal
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
5 ;; This file is part of Emacs Muse. It is not part of GNU Emacs.
7 ;; Emacs Muse is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; Emacs Muse is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with Emacs Muse; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
22 ;;; Commentary:
24 ;; The module facilitates the keeping and publication of a journal.
25 ;; When publishing to HTML, it assumes the form of a web log, or blog.
27 ;; The input format for each entry is as follows:
29 ;; * 20040317: Title of entry
31 ;; Text for the entry.
33 ;; <qotd>
34 ;; "You know who you are. It comes down to a simple gut check: You
35 ;; either love what you do or you don't. Period." -- P. Bronson
36 ;; </qotd>
38 ;; The "qotd", or Quote of the Day, is entirely optional. When
39 ;; generated to HTML, this entry is rendered as:
41 ;; <div class="entry">
42 ;; <div class="entry-qotd">
43 ;; <h3>Quote of the Day:</h3>
44 ;; <p>"You know who you are. It comes down to a simple gut
45 ;; check: You either love what you do or you don't. Period."
46 ;; -- P. Bronson</p>
47 ;; </div>
48 ;; <div class="entry-body">
49 ;; <div class="entry-head">
50 ;; <div class="entry-date">
51 ;; <span class="date">March 17, 2004</span>
52 ;; </div>
53 ;; <div class="entry-title">
54 ;; <h2>Title of entry</h2>
55 ;; </div>
56 ;; </div>
57 ;; <div class="entry-text">
58 ;; <p>Text for the entry.</p>
59 ;; </div>
60 ;; </div>
61 ;; </div>
63 ;; The plurality of "div" tags makes it possible to display the
64 ;; entries in any form you wish, using a CSS style.
66 ;; Also, an .RDF file can be generated from your journal by publishing
67 ;; it with the "rdf" style. It uses the first two sentences of the
68 ;; first paragraph of each entry as its "description", and
69 ;; autogenerates tags for linking to the various entries.
71 ;;; Contributors:
73 ;; René Stadler (mail AT renestadler DOT de) provided a patch that
74 ;; causes dates in RSS feeds to be generated in a format that RSS
75 ;; readers can parse.
77 ;;; Code:
79 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
81 ;; Muse Journal Publishing
83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
85 (require 'muse-publish)
86 (require 'muse-html)
87 (require 'muse-latex)
88 (require 'muse-book)
90 (defgroup muse-journal nil
91 "Rules for transforming a journal into its final form."
92 :group 'muse-publish)
94 (defcustom muse-journal-heading-regexp
95 "\\(?:\\([0-9]+\\)\\(?:: \\)?\\)?\\(.+?\\)?"
96 "A regexp that matches a journal heading.
97 Paren group 1 is the ISO date, group 2 is the optional category,
98 and group 3 is the optional heading for the entry."
99 :type 'regexp
100 :group 'muse-journal)
102 (defcustom muse-journal-date-format "%a, %e %b %Y"
103 "Date format to use for journal entries."
104 :type 'string
105 :group 'muse-journal)
107 (defcustom muse-journal-html-heading-regexp
108 (concat "^<h2[^>\n]*>" muse-journal-heading-regexp "</h2>$")
109 "A regexp that matches a journal heading from an HTML document.
110 Paren group 1 is the ISO date, group 2 is the optional category,
111 and group 3 is the optional heading for the entry."
112 :type 'regexp
113 :group 'muse-journal)
115 (defcustom muse-journal-rss-heading-regexp
116 (concat "^\\* " muse-journal-heading-regexp "$")
117 "A regexp that matches a journal heading from an HTML document.
118 Paren group 1 is the ISO date, group 2 is the optional category,
119 and group 3 is the optional heading for the entry."
120 :type 'regexp
121 :group 'muse-journal)
123 (defcustom muse-journal-html-entry-template
124 "<div class=\"entry\">
125 <a name=\"%anchor%\" style=\"text-decoration: none\">&nbsp;</a>
126 <div class=\"entry-body\">
127 <div class=\"entry-head\">
128 <div class=\"entry-date\">
129 <span class=\"date\">%date%</span>
130 </div>
131 <div class=\"entry-title\">
132 <h2>%title%</h2>
133 </div>
134 </div>
135 <div class=\"entry-text\">
136 <div class=\"entry-qotd\">
137 <p>%qotd%</p>
138 </div>
139 %text%
140 </div>
141 </div>
142 </div>\n\n"
143 "Template used to publish individual journal entries as HTML."
144 :type 'string
145 :group 'muse-journal)
147 (defcustom muse-journal-latex-section
148 "\\section*{%title% \\hfill {\\normalsize %date%}}
149 \\addcontentsline{toc}{chapter}{%title%}"
150 "Template used to publish a LaTeX section."
151 :type 'string
152 :group 'muse-journal)
154 (defcustom muse-journal-latex-subsection
155 "\\subsection*{%title%}
156 \\addcontentsline{toc}{section}{%title%}"
157 "Template used to publish a LaTeX subsection."
158 :type 'string
159 :group 'muse-journal)
161 (defcustom muse-journal-latex-markup-tags
162 '(("qotd" t nil nil muse-journal-latex-qotd-tag))
163 "A list of tag specifications, for specially marking up LaTeX.
164 See `muse-publish-markup-tags' for more info."
165 :type '(repeat (list (string :tag "Markup tag")
166 (boolean :tag "Expect closing tag" :value t)
167 (boolean :tag "Parse attributes" :value nil)
168 (boolean :tag "Nestable" :value nil)
169 function))
170 :group 'muse-journal)
172 ;; FIXME: This doesn't appear to be used.
173 (defun muse-journal-generate-pages ()
174 (let ((output-dir (muse-style-element :path)))
175 (goto-char (point-min))
176 (while (re-search-forward muse-journal-heading-regexp nil t)
177 (let* ((date (match-string 1))
178 (category (match-string 1))
179 (category-file (concat output-dir category "/index.html"))
180 (heading (match-string 1)))
181 t))))
183 (defcustom muse-journal-rdf-extension ".rdf"
184 "Default file extension for publishing RDF (RSS 1.0) files."
185 :type 'string
186 :group 'muse-journal)
188 (defcustom muse-journal-rdf-base-url ""
189 "The base URL of the website referenced by the RDF file."
190 :type 'string
191 :group 'muse-journal)
193 (defcustom muse-journal-rdf-header
194 "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
195 xmlns=\"http://purl.org/rss/1.0/\"
196 xmlns:dc=\"http://purl.org/dc/elements/1.1/\">
197 <channel rdf:about=\"<lisp>(concat (muse-style-element :base-url)
198 (muse-publish-link-name))</lisp>\">
199 <title><lisp>(muse-publishing-directive \"title\")</lisp></title>
200 <link><lisp>(concat (muse-style-element :base-url)
201 (concat (muse-page-name)
202 muse-html-extension))</lisp></link>
203 <description><lisp>(muse-publishing-directive \"desc\")</lisp></description>
204 <items>
205 <rdf:Seq>
206 <rdf:li resource=\"<lisp>
207 (concat (muse-style-element :base-url)
208 (concat (muse-page-name)
209 muse-html-extension))</lisp>\"/>
210 </rdf:Seq>
211 </items>
212 </channel>\n"
213 "Header used for publishing RDF (RSS 1.0) files.
214 This may be text or a filename."
215 :type 'string
216 :group 'muse-journal)
218 (defcustom muse-journal-rdf-footer
219 "</rdf:RDF>\n"
220 "Footer used for publishing RDF (RSS 1.0) files.
221 This may be text or a filename."
222 :type 'string
223 :group 'muse-journal)
225 (defcustom muse-journal-rdf-date-format
226 "%Y-%m-%dT%H:%M:%S"
227 "Date format to use for RDF entries."
228 :type 'string
229 :group 'muse-journal)
231 (defcustom muse-journal-rdf-entry-template
232 " <item rdf:about=\"%link%#%anchor%\">
233 <title>%title%</title>
234 <description>
235 %desc%
236 </description>
237 <link>%link%#%anchor%</link>
238 <dc:date>%date%</dc:date>
239 <dc:creator>%maintainer%</dc:creator>
240 </item>\n"
241 "Template used to publish individual journal entries as RDF."
242 :type 'string
243 :group 'muse-journal)
245 (defcustom muse-journal-rdf-summarize-entries t
246 "If non-nil, include only summaries in the RDF file, not the full data."
247 :type 'boolean
248 :group 'muse-journal)
250 (defcustom muse-journal-rss-extension ".xml"
251 "Default file extension for publishing RSS 2.0 files."
252 :type 'string
253 :group 'muse-journal)
255 (defcustom muse-journal-rss-base-url ""
256 "The base URL of the website referenced by the RSS file."
257 :type 'string
258 :group 'muse-journal)
260 (defcustom muse-journal-rss-header
261 "<\?xml version=\"1.0\" encoding=\"<lisp>
262 (muse-html-encoding)</lisp>\"?>
263 <rss version=\"2.0\">
264 <channel>
265 <title><lisp>(muse-publishing-directive \"title\")</lisp></title>
266 <link><lisp>(concat (muse-style-element :base-url)
267 (concat (muse-page-name)
268 muse-html-extension))</lisp></link>
269 <description><lisp>(muse-publishing-directive \"desc\")</lisp></description>
270 <language>en-us</language>
271 <generator>Emacs Muse</generator>"
272 "Header used for publishing RSS 2.0 files. This may be text or a filename."
273 :type 'string
274 :group 'muse-journal)
276 (defcustom muse-journal-rss-footer
277 " </channel>
278 </rss>\n"
279 "Footer used for publishing RSS 2.0 files. This may be text or a filename."
280 :type 'string
281 :group 'muse-journal)
283 (defcustom muse-journal-rss-date-format
284 "%a, %d %b %Y %H:%M:%S %Z"
285 "Date format to use for RSS 2.0 entries."
286 :type 'string
287 :group 'muse-journal)
289 (defcustom muse-journal-rss-entry-template
290 " <item>
291 <title>%title%</title>
292 <link>%link%#%anchor%</link>
293 <description>%desc%</description>
294 <author><lisp>(muse-publishing-directive \"author\")</lisp></author>
295 <pubDate>%date%</pubDate>
296 <guid>%link%#%anchor%</guid>
297 %enclosure%
298 </item>\n"
299 "Template used to publish individual journal entries as RSS 2.0."
300 :type 'string
301 :group 'muse-journal)
303 (defcustom muse-journal-rss-enclosure-types-alist
304 '(("mp3" . "audio/mpeg"))
305 "File types that are accepted as RSS enclosures.
306 This is an alist that maps file extension to content type.
307 Useful for podcasting."
308 :type '(alist :key-type string :value-type string)
309 :group 'muse-journal)
311 (defcustom muse-journal-rss-summarize-entries nil
312 "If non-nil, include only summaries in the RSS file, not the full data.
313 Many RSS subscribers find this annoying."
314 :type 'boolean
315 :group 'muse-journal)
317 (defcustom muse-journal-rss-markup-regexps
318 '((10000 muse-explicit-link-regexp 0 "\\2"))
319 "List of markup rules for publishing a Muse journal page to RSS 2.0.
320 For more information on the structure of this list, see
321 `muse-publish-markup-regexps'."
322 :type '(repeat (choice
323 (list :tag "Markup rule"
324 integer
325 (choice regexp symbol)
326 integer
327 (choice string function symbol))
328 function))
329 :group 'muse-journal)
331 (defcustom muse-journal-rss-markup-functions
332 '((email . ignore)
333 (link . ignore)
334 (url . ignore))
335 "An alist of style types to custom functions for that kind of text.
336 For more on the structure of this list, see
337 `muse-publish-markup-functions'."
338 :type '(alist :key-type symbol :value-type function)
339 :group 'muse-journal)
341 (defun muse-journal-anchorize-title (title)
342 (save-match-data
343 (if (string-match "(" title)
344 (setq title (substring title 0 (match-beginning 0))))
345 (if (string-match "<[^>]+>" title)
346 (setq title (replace-match "" nil nil title)))
347 (downcase (muse-replace-regexp-in-string "[^a-zA-Z0-9_]" "" title))))
349 (defun muse-journal-sort-entries (&optional direction)
350 (interactive "P")
351 (sort-subr
352 direction
353 (function
354 (lambda ()
355 (if (re-search-forward "^\\* [0-9]+" nil t)
356 (goto-char (match-beginning 0))
357 (goto-char (point-max)))))
358 (function
359 (lambda ()
360 (if (re-search-forward "^\\* [0-9]+" nil t)
361 (goto-char (1- (match-beginning 0)))
362 (goto-char (point-max)))))
363 (function
364 (lambda ()
365 (forward-char 2)))
366 (function
367 (lambda ()
368 (end-of-line)))))
370 (defun muse-journal-html-munge-buffer ()
371 (goto-char (point-min))
372 (let ((heading-regexp muse-journal-html-heading-regexp)
373 (inhibit-read-only t))
374 (while (re-search-forward heading-regexp nil t)
375 (let* ((date (match-string 1))
376 (orig-date date)
377 (title (match-string 2))
378 (clean-title title)
379 datestamp qotd text)
380 (delete-region (match-beginning 0) (match-end 0))
381 (if clean-title
382 (save-match-data
383 (while (string-match "\\(^<[^>]+>\\|<[^>]+>$\\)" clean-title)
384 (setq clean-title (replace-match "" nil nil clean-title)))))
385 (save-match-data
386 (when (and date
387 (string-match
388 (concat "\\`\\([1-9][0-9][0-9][0-9]\\)[./]?"
389 "\\([0-1][0-9]\\)[./]?\\([0-3][0-9]\\)") date))
390 (setq datestamp
391 (encode-time
392 0 0 0
393 (string-to-number (match-string 3 date))
394 (string-to-number (match-string 2 date))
395 (string-to-number (match-string 1 date))
396 (current-time-zone))
397 date (concat (format-time-string
398 muse-journal-date-format datestamp)
399 (substring date (match-end 0))))))
400 (save-restriction
401 (narrow-to-region
402 (point) (if (re-search-forward
403 (concat "\\(^<hr>$\\|"
404 heading-regexp "\\)") nil t)
405 (match-beginning 0)
406 (point-max)))
407 (goto-char (point-max))
408 (while (and (not (bobp))
409 (eq ?\ (char-syntax (char-before))))
410 (delete-char -1))
411 (goto-char (point-min))
412 (while (and (not (eobp))
413 (eq ?\ (char-syntax (char-after))))
414 (delete-char 1))
415 (save-excursion
416 (when (search-forward "<qotd>" nil t)
417 (let ((tag-beg (match-beginning 0))
418 (beg (match-end 0)))
419 (re-search-forward "</qotd>\n*")
420 (setq qotd (buffer-substring-no-properties
421 beg (match-beginning 0)))
422 (delete-region tag-beg (match-end 0)))))
423 (setq text (buffer-string))
424 (delete-region (point-min) (point-max))
425 (let ((entry muse-journal-html-entry-template))
426 (muse-insert-markup entry)
427 (goto-char (point-min))
428 (while (search-forward "%date%" nil t)
429 (replace-match (or date "") nil t))
430 (goto-char (point-min))
431 (while (search-forward "%title%" nil t)
432 (replace-match (or title "&nbsp;") nil t))
433 (goto-char (point-min))
434 (while (search-forward "%anchor%" nil t)
435 (replace-match (muse-journal-anchorize-title
436 (or clean-title orig-date))
437 nil t))
438 (goto-char (point-min))
439 (while (search-forward "%qotd%" nil t)
440 (save-restriction
441 (narrow-to-region (match-beginning 0) (match-end 0))
442 (delete-region (point-min) (point-max))
443 (when qotd (muse-insert-markup qotd))))
444 (goto-char (point-min))
445 (while (search-forward "%text%" nil t)
446 (replace-match text nil t))
447 (when (null qotd)
448 (goto-char (point-min))
449 (when (search-forward "<div class=\"entry-qotd\">" nil t)
450 (let ((beg (match-beginning 0)))
451 (re-search-forward "</div>\n*" nil t)
452 (delete-region beg (point))))))))))
453 ;; indicate that we are to continue the :before-end processing
454 nil)
456 (defun muse-journal-latex-munge-buffer ()
457 (goto-char (point-min))
458 (let ((heading-regexp
459 (concat "^" (regexp-quote (muse-markup-text 'section))
460 muse-journal-heading-regexp
461 (regexp-quote (muse-markup-text 'section-end)) "$"))
462 (inhibit-read-only t))
463 (when (re-search-forward heading-regexp nil t)
464 (goto-char (match-beginning 0))
465 (sort-subr nil
466 (function
467 (lambda ()
468 (if (re-search-forward heading-regexp nil t)
469 (goto-char (match-beginning 0))
470 (goto-char (point-max)))))
471 (function
472 (lambda ()
473 (if (re-search-forward heading-regexp nil t)
474 (goto-char (1- (match-beginning 0)))
475 (goto-char (point-max)))))
476 (function
477 (lambda ()
478 (forward-char 2)))
479 (function
480 (lambda ()
481 (end-of-line)))))
482 (while (re-search-forward heading-regexp nil t)
483 (let ((date (match-string 1))
484 (title (match-string 2))
485 ;; FIXME: Nothing is done with qotd
486 qotd section)
487 (save-match-data
488 (when (and date
489 (string-match
490 (concat "\\([1-9][0-9][0-9][0-9]\\)[./]?"
491 "\\([0-1][0-9]\\)[./]?\\([0-3][0-9]\\)") date))
492 (setq date (encode-time
493 0 0 0
494 (string-to-number (match-string 3 date))
495 (string-to-number (match-string 2 date))
496 (string-to-number (match-string 1 date))
497 (current-time-zone))
498 date (format-time-string
499 muse-journal-date-format date))))
500 (save-restriction
501 (narrow-to-region (match-beginning 0) (match-end 0))
502 (delete-region (point-min) (point-max))
503 (muse-insert-markup muse-journal-latex-section)
504 (goto-char (point-min))
505 (while (search-forward "%title%" nil t)
506 (replace-match (or title "Untitled") nil t))
507 (goto-char (point-min))
508 (while (search-forward "%date%" nil t)
509 (replace-match (or date "") nil t))))))
510 (goto-char (point-min))
511 (let ((subheading-regexp
512 (concat "^" (regexp-quote (muse-markup-text 'subsection))
513 "\\([^\n}]+\\)"
514 (regexp-quote (muse-markup-text 'subsection-end)) "$"))
515 (inhibit-read-only t))
516 (while (re-search-forward subheading-regexp nil t)
517 (let ((title (match-string 1)))
518 (save-restriction
519 (narrow-to-region (match-beginning 0) (match-end 0))
520 (delete-region (point-min) (point-max))
521 (muse-insert-markup muse-journal-latex-subsection)
522 (goto-char (point-min))
523 (while (search-forward "%title%" nil t)
524 (replace-match title nil t))))))
525 ;; indicate that we are to continue the :before-end processing
526 nil)
528 (defun muse-journal-latex-qotd-tag (beg end)
529 (muse-publish-ensure-block beg)
530 (muse-insert-markup (muse-markup-text 'begin-quote))
531 (goto-char end)
532 (muse-insert-markup (muse-markup-text 'end-quote)))
534 (defun muse-journal-rss-munge-buffer ()
535 (goto-char (point-min))
536 (let ((heading-regexp muse-journal-rss-heading-regexp)
537 (inhibit-read-only t))
538 (while (re-search-forward heading-regexp nil t)
539 (let* ((date (match-string 1))
540 (orig-date date)
541 (title (match-string 2))
542 ;; FIXME: Nothing is done with qotd
543 enclosure qotd desc)
544 (if title
545 (save-match-data
546 (if (string-match muse-explicit-link-regexp title)
547 (setq enclosure (muse-get-link title)
548 title (muse-get-link-desc title)))))
549 (save-match-data
550 (when (and date
551 (string-match
552 (concat "\\([1-9][0-9][0-9][0-9]\\)[./]?"
553 "\\([0-1][0-9]\\)[./]?\\([0-3][0-9]\\)") date))
554 (setq date (encode-time 0 0 0
555 (string-to-number (match-string 3 date))
556 (string-to-number (match-string 2 date))
557 (string-to-number (match-string 1 date))
558 (current-time-zone))
559 ;; make sure that date is in a format that RSS
560 ;; readers can handle
561 date (let ((system-time-locale "C"))
562 (format-time-string
563 (muse-style-element :date-format) date)))))
564 (save-restriction
565 (narrow-to-region
566 (match-beginning 0)
567 (if (re-search-forward heading-regexp nil t)
568 (match-beginning 0)
569 (if (re-search-forward "^Footnotes:" nil t)
570 (match-beginning 0)
571 (point-max))))
572 (goto-char (point-min))
573 (delete-region (point) (muse-line-end-position))
574 (re-search-forward "</qotd>\n+" nil t)
575 (while (and (char-after)
576 (eq ?\ (char-syntax (char-after))))
577 (delete-char 1))
578 (let ((beg (point)))
579 (if (muse-style-element :summarize)
580 (progn
581 (forward-sentence 2)
582 (setq desc (concat (buffer-substring beg (point)) "...")))
583 (save-restriction
584 (muse-publish-markup-buffer "rss-entry" "html")
585 (goto-char (point-min))
586 (if (re-search-forward "Page published by Emacs Muse" nil t)
587 (goto-char (muse-line-end-position))
588 (muse-display-warning
589 (concat
590 "Cannot find 'Page published by Emacs Muse begins here'.\n"
591 "You will probably need this text in your header."))
592 (goto-char (point-min)))
593 (setq beg (point))
594 (if (re-search-forward "Page published by Emacs Muse" nil t)
595 (goto-char (muse-line-beginning-position))
596 (muse-display-warning
597 (concat
598 "Cannot find 'Page published by Emacs Muse ends here'.\n"
599 "You will probably need this text in your footer."))
600 (goto-char (point-max)))
601 (setq desc (concat "<![CDATA[" (buffer-substring beg (point))
602 "]]>")))))
603 (delete-region (point-min) (point-max))
604 (let ((entry (muse-style-element :entry-template)))
605 (muse-insert-markup entry)
606 (goto-char (point-min))
607 (while (search-forward "%date%" nil t)
608 (replace-match (or date "") nil t))
609 (goto-char (point-min))
610 (while (search-forward "%title%" nil t)
611 (replace-match (or title "Untitled") nil t))
612 (goto-char (point-min))
613 (while (search-forward "%desc%" nil t)
614 (replace-match desc nil t))
615 (goto-char (point-min))
616 (while (search-forward "%enclosure%" nil t)
617 (replace-match
618 (if (null enclosure)
620 (save-match-data
621 (format
622 "<enclosure url=\"%s\" %stype=\"%s\"/>"
623 (if (string-match "//" enclosure)
624 enclosure
625 (concat (muse-style-element :base-url)
626 enclosure))
627 (let ((file
628 (expand-file-name enclosure
629 (muse-style-element :path))))
630 (if (file-readable-p file)
631 (format "length=\"%d\" "
632 (nth 7 (file-attributes file)))
633 ""))
634 (if (string-match "\\.\\([^.]+\\)$" enclosure)
635 (let* ((ext (match-string 1 enclosure))
636 (type
637 (assoc
638 ext muse-journal-rss-enclosure-types-alist)))
639 (if type
640 (cdr type)
641 "application/octet-stream"))))))
642 nil t))
643 (goto-char (point-min))
644 (while (search-forward "%link%" nil t)
645 (replace-match
646 (concat (muse-style-element :base-url)
647 (concat (muse-page-name)
648 muse-html-extension))
649 nil t))
650 (goto-char (point-min))
651 (while (search-forward "%anchor%" nil t)
652 (replace-match
653 (muse-journal-anchorize-title (or title orig-date))
654 nil t))
655 (goto-char (point-min))
656 (while (search-forward "%maintainer%" nil t)
657 (replace-match
658 (or (muse-style-element :maintainer)
659 (concat "webmaster@" (system-name)))
660 nil t))))))
661 (unless (eobp)
662 (delete-region (point) (point-max))))
663 ;; indicate that we are to continue the :before-end processing
664 nil)
667 ;;; Register the Muse Journal Publishers
669 (muse-derive-style "journal-html" "html"
670 :before-end 'muse-journal-html-munge-buffer)
672 (muse-derive-style "journal-xhtml" "xhtml"
673 :before-end 'muse-journal-html-munge-buffer)
675 (muse-derive-style "journal-latex" "latex"
676 :tags 'muse-journal-latex-markup-tags
677 :before-end 'muse-journal-latex-munge-buffer)
679 (muse-derive-style "journal-pdf" "pdf"
680 :tags 'muse-journal-latex-markup-tags
681 :before-end 'muse-journal-latex-munge-buffer)
683 (muse-derive-style "journal-book-latex" "book-latex"
684 ;;:nochapters
685 :tags 'muse-journal-latex-markup-tags
686 :before-end 'muse-journal-latex-munge-buffer)
688 (muse-derive-style "journal-book-pdf" "book-pdf"
689 ;;:nochapters
690 :tags 'muse-journal-latex-markup-tags
691 :before-end 'muse-journal-latex-munge-buffer)
693 (muse-define-style "journal-rdf"
694 :suffix 'muse-journal-rdf-extension
695 :regexps 'muse-journal-rss-markup-regexps
696 :functions 'muse-journal-rss-markup-functions
697 :before 'muse-journal-rss-munge-buffer
698 :header 'muse-journal-rdf-header
699 :footer 'muse-journal-rdf-footer
700 :date-format 'muse-journal-rdf-date-format
701 :entry-template 'muse-journal-rdf-entry-template
702 :base-url 'muse-journal-rdf-base-url
703 :summarize 'muse-journal-rdf-summarize-entries)
705 (muse-define-style "journal-rss"
706 :suffix 'muse-journal-rss-extension
707 :regexps 'muse-journal-rss-markup-regexps
708 :functions 'muse-journal-rss-markup-functions
709 :before 'muse-journal-rss-munge-buffer
710 :header 'muse-journal-rss-header
711 :footer 'muse-journal-rss-footer
712 :date-format 'muse-journal-rss-date-format
713 :entry-template 'muse-journal-rss-entry-template
714 :base-url 'muse-journal-rss-base-url
715 :summarize 'muse-journal-rss-summarize-entries)
717 (provide 'muse-journal)
719 ;;; muse-journal.el ends here