diff -U 3 muse-orig/lisp/muse-book.el muse/lisp/muse-book.el
--- muse-orig/lisp/muse-book.el Wed Dec 27 01:00:05 2006
+++ muse/lisp/muse-book.el Sat Apr 21 00:35:34 2007
@@ -73,7 +73,7 @@
:type 'string
:group 'muse-book)
-(defcustom muse-book-latex-footer "\n\\end{document}"
+(defcustom muse-book-latex-footer "(muse-latex-bibliography)\n\\end{document}"
"Footer used for publishing books to LaTeX. This may be text or a filename."
:type 'string
:group 'muse-book)
diff -U 3 muse-orig/lisp/muse-docbook.el muse/lisp/muse-docbook.el
--- muse-orig/lisp/muse-docbook.el Wed Dec 27 01:00:04 2006
+++ muse/lisp/muse-docbook.el Thu Apr 19 21:29:56 2007
@@ -52,7 +52,7 @@
"
(muse-docbook-encoding)\"?>
+ \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\"(muse-docbook-entities)>
(muse-publishing-directive \"title\")
@@ -68,7 +68,7 @@
(defcustom muse-docbook-footer "
-\n"
+(muse-docbook-bibliography)\n"
"Footer used for publishing DocBook XML files.
This may be text or a filename."
:type 'string
@@ -156,6 +156,10 @@
(end-center . "\n")
(begin-quote . "
\n")
(end-quote . "\n
")
+ (begin-cite . "")
+ (begin-cite-author . "A:")
+ (begin-cite-year . "Y:")
+ (end-cite . "")
(begin-quote-item . "")
(end-quote-item . "")
(begin-uli . "\n")
@@ -276,8 +280,53 @@
nil t)
(replace-match (upcase (match-string 1)) t t nil 1)))
+(defun muse-docbook-fixup-citations ()
+ ;; remove the role attribute if there is no role
+ (save-restriction)
+ (goto-char (point-min))
+ (while (re-search-forward "<\\(citation role=\"nil\"\\)>" nil t)
+ (replace-match "citation" t t nil 1)
+ )
+ ;; replace colons in multi-head citations with semicolons
+ (goto-char (point-min))
+ (while (re-search-forward "" nil t)
+ (let ((start (point))
+ (end (re-search-forward "")))
+ (narrow-to-region start end)
+ (goto-char start)
+ (while (re-search-forward "," nil t)
+ (replace-match ";"))
+ (widen)))
+ )
+
(defun muse-docbook-munge-buffer ()
- (muse-docbook-fixup-images))
+ (muse-docbook-fixup-images)
+ (muse-docbook-fixup-citations))
+
+(defun muse-docbook-entities ()
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (if (re-search-forward "\n]")
+ "")
+ )))
+
+(defun muse-docbook-bibliography ()
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (if (re-search-forward "")
(begin-literal . "")
(end-literal . "")
+ (begin-cite . "")
+ (begin-cite-author . "")
+ (begin-cite-year . "")
+ (end-cite . "")
(begin-emph . "")
(end-emph . "")
(begin-more-emph . "")
diff -U 3 muse-orig/lisp/muse-latex.el muse/lisp/muse-latex.el
--- muse-orig/lisp/muse-latex.el Wed Dec 27 01:00:05 2006
+++ muse/lisp/muse-latex.el Thu Apr 19 21:33:17 2007
@@ -79,7 +79,7 @@
:type 'string
:group 'muse-latex)
-(defcustom muse-latex-footer "\n\\end{document}\n"
+(defcustom muse-latex-footer "(muse-latex-bibliography)\n\\end{document}\n"
"Footer used for publishing LaTeX files. This may be text or a filename."
:type 'string
:group 'muse-latex)
@@ -200,6 +200,10 @@
(end-center . "\n\\end{center}")
(begin-quote . "\\begin{quote}\n")
(end-quote . "\n\\end{quote}")
+ (begin-cite . "\\cite{")
+ (begin-cite-author . "\\citet{")
+ (begin-cite-year . "\\citet{")
+ (end-cite . "}")
(begin-uli . "\\begin{itemize}\n")
(end-uli . "\n\\end{itemize}")
(begin-uli-item . "\\item ")
@@ -393,12 +397,40 @@
:type 'boolean
:group 'muse-latex)
+(defun muse-latex-fixup-citations ()
+ ;; replace semicolons in multi-head citations with colons
+ (save-restriction)
+ (goto-char (point-min))
+ (while (re-search-forward "\\\\cite.?{" nil t)
+ (let ((start (point))
+ (end (re-search-forward "}")))
+ (narrow-to-region start end)
+ (goto-char start)
+ (while (re-search-forward ";" nil t)
+ (replace-match ","))
+ (widen)))
+ )
+
(defun muse-latex-munge-buffer ()
(muse-latex-fixup-dquotes)
+ (muse-latex-fixup-citations)
(when (and muse-latex-permit-contents-tag
muse-publish-generate-contents)
(goto-char (car muse-publish-generate-contents))
(muse-insert-markup "\\tableofcontents")))
+
+(defun muse-latex-bibliography ()
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (if (re-search-forward "\\\\cite.?{" nil t)
+ (concat
+ "\\bibliography{"
+ (muse-publishing-directive "bibsource")
+ "}\n")
+ "")
+ )))
(defun muse-latex-pdf-browse-file (file)
(shell-command (concat "open " file)))
diff -U 3 muse-orig/lisp/muse-publish.el muse/lisp/muse-publish.el
--- muse-orig/lisp/muse-publish.el Thu Apr 12 16:30:11 2007
+++ muse/lisp/muse-publish.el Thu Apr 19 00:41:30 2007
@@ -264,7 +264,8 @@
("ruby" t t nil muse-publish-ruby-tag)
("comment" t nil nil muse-publish-comment-tag)
("include" nil t nil muse-publish-include-tag)
- ("markup" t t nil muse-publish-mark-up-tag))
+ ("markup" t t nil muse-publish-mark-up-tag)
+ ("cite" t t nil muse-publish-cite-tag))
"A list of tag specifications, for specially marking up text.
XML-style tags are the best way to add custom markup to Muse.
This is easily accomplished by customizing this list of markup tags.
@@ -1585,6 +1586,22 @@
(goto-char end)
(insert (muse-markup-text 'end-literal))
(muse-publish-mark-read-only beg (point)))
+
+(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))))
+ (goto-char beg)
+ (insert (muse-markup-text citetag (muse-publishing-directive "bibsource")))
+ (goto-char end)
+ (insert (muse-markup-text 'end-cite))
+ (muse-publish-mark-read-only beg (point))))
(defun muse-publish-src-tag (beg end attrs)
(muse-publish-example-tag beg end))
diff -U 3 muse-orig/lisp/muse-texinfo.el muse/lisp/muse-texinfo.el
--- muse-orig/lisp/muse-texinfo.el Wed Dec 27 01:00:05 2006
+++ muse/lisp/muse-texinfo.el Thu Apr 19 21:55:53 2007
@@ -161,6 +161,10 @@
(end-center . "\n@end quotation")
(begin-quote . "@quotation\n")
(end-quote . "\n@end quotation")
+ (begin-cite . "")
+ (begin-cite-author . "")
+ (begin-cite-year . "")
+ (end-cite . "")
(begin-uli . "@itemize @bullet\n")
(end-uli . "\n@end itemize")
(begin-uli-item . "@item\n")
diff -U 3 muse-orig/lisp/muse-xml.el muse/lisp/muse-xml.el
--- muse-orig/lisp/muse-xml.el Thu Apr 12 16:30:11 2007
+++ muse/lisp/muse-xml.el Thu Apr 19 21:58:34 2007
@@ -167,6 +167,10 @@
(end-center . "\n")
(begin-quote . "\n")
(end-quote . "\n
")
+ (begin-cite . "")
+ (begin-cite-author . "")
+ (begin-cite-year . "")
+ (end-cite . "")
(begin-quote-item . "")
(end-quote-item . "
")
(begin-uli . "\n")