4
(require 'muse-project)
9
(require 'muse-texinfo)
11
(require 'muse-journal)
13
(require 'muse-message)
17
;;(require 'muse-arabic)
18
;;(require 'muse-cite)
20
(eval-after-load "whitespace"
21
'(add-to-list 'whitespace-modes 'muse-mode))
23
(defun muse-maybe-convert-poem ()
24
(if (string-match "/poems/" muse-publishing-current-file)
25
(muse-poem-prepare-buffer)))
27
(defun muse-insert-reset-chapter ()
28
(insert "\n\\setcounter{chapter}{1}\n"))
30
(defun muse-insert-all-poems-header ()
31
(insert "\n\\renewcommand{\\poemtoc}{chapter}
32
\\settocdepth{chapter}\n"))
34
;; I use my own sectioning commands in conjunction with memoir.cls
35
(setcdr (assq 'chapter muse-latex-markup-strings) "\\mychapter{")
36
(setcdr (assq 'section muse-latex-markup-strings) "\\mysection{")
37
(setcdr (assq 'subsection muse-latex-markup-strings) "\\mysubsection{")
38
(setcdr (assq 'subsubsection muse-latex-markup-strings) "\\mysubsubsection{")
40
;; Relocate the images directory
41
;(setcdr (assq 'image-with-desc muse-latex-markup-strings)
42
; "\\includegraphics[width=\\textwidth]{../%s}")
43
(setcdr (assq 'image-with-desc muse-latex-markup-strings)
44
"\\includegraphics[scale=0.6]{../%s}")
45
(setcdr (assq 'image-link muse-latex-markup-strings)
46
"\\includegraphics[scale=0.6]{../%s}")
47
(setcdr (assq 'url-with-image muse-latex-markup-strings)
48
"%% %s\n\\includegraphics[scale=0.6]{../%s}")
50
(unless (assoc "site-html" muse-publishing-styles)
51
(muse-derive-style "site-html" "html"
52
:maintainer "jwiegley@hotmail.com"
53
:before 'muse-maybe-convert-poem
54
:after 'muse-my-html-finalize-buffer
55
:final 'muse-site-html-set-mode
56
:header "~/Documents/site/header.html"
57
:footer "~/Documents/site/footer.html")
58
(muse-derive-style "site-journal-html" "journal-html"
59
:maintainer "jwiegley@hotmail.com"
60
:before 'muse-my-journal-find-entries
61
:after 'muse-my-journal-insert-contents
62
:final 'muse-site-html-set-mode
63
:header "~/Documents/site/header.html"
64
:footer "~/Documents/site/footer.html")
65
(muse-derive-style "newartisans-html" "html"
66
:maintainer "johnw@newartisans.com"
67
:header "~/Sites/newartisans/header.html"
68
:footer "~/Sites/newartisans/footer.html")
69
(muse-derive-style "newartisans-journal-html" "journal-html"
70
:maintainer "johnw@newartisans.com"
71
:header "~/Sites/newartisans/header.html"
72
:footer "~/Sites/newartisans/footer.html"))
77
(("website" ; my various writings
79
:book-funcall muse-insert-reset-chapter
82
:book-funcall muse-insert-reset-chapter
85
:book-style "journal-book-pdf"
86
:book-funcall muse-insert-reset-chapter
87
"~/Documents/journal/early"
88
"~/Documents/journal/summer2003"
89
"~/Documents/journal/j2003"
90
"~/Documents/journal/j2004"
91
"~/Documents/journal/j2005"
92
"~/Documents/journal/journal"
93
"~/Documents/journal/pending"
95
:book-style "chapbook-pdf"
96
:book-funcall muse-insert-all-poems-header
97
:book-funcall muse-insert-reset-chapter
98
:nochapters t ; do automatically add chapters
99
:book-chapter "Mystical"
100
"~/Documents/poems/mystical"
101
:book-chapter "Romance"
102
"~/Documents/poems/romantic"
103
:book-chapter "Nature"
104
"~/Documents/poems/natural"
105
:book-chapter "Melancholoy"
106
"~/Documents/poems/melancholy"
107
:book-chapter "Commentary"
108
"~/Documents/poems/commentary"
110
"~/Documents/contents"
114
(:base "site-html" :path "~/Sites/johnw"
115
:include "/contents/recent")
116
(:base "pdf" :path "~/Sites/johnw/pdf"
117
:include "/\\(essays\\|stories\\)/")
118
(:base "poem-pdf" :path "~/Sites/johnw/pdf"
120
(:base "site-html" :path "~/Sites/johnw"
121
:exclude "/journal/")
122
(:base "journal-pdf" :path "~/Sites/johnw/pdf"
123
:include "/journal/")
124
(:base "site-journal-html" :path "~/Sites/johnw"
125
:include "/journal/")
126
(:base "journal-rdf" :path "~/Sites/johnw"
127
:include "/journal/journal"
128
:base-url "http://johnwiegley.com/")
129
(:base "journal-rss" :path "~/Sites/johnw"
130
:include "/journal/journal"
131
:base-url "http://johnwiegley.com/")
132
(:base "journal-rss" :path "~/Sites/johnw"
133
:include "/journal/pending"
134
:base-url "http://johnwiegley.com/"))
135
("thoughts" ; collected writings
137
"~/Documents/thoughts/thoughts"
139
(:base "journal-pdf" :path "~/Sites/johnw/pdf")
140
(:base "site-journal-html" :path "~/Sites/johnw"))
141
("newartisans" ; my company
142
("~/Documents/newartisans"
144
(:base "newartisans-html" :path "~/Sites/newartisans"
146
(:base "newartisans-journal-html" :path "~/Sites/newartisans"
148
("planner" ; my company
151
:major-mode planner-mode)))))
152
'(muse-mode-highlight-p t nil (muse-colors))
153
'(muse-mode-auto-p t nil (muse-project))
154
'(muse-latex-header "~/Documents/site/header.tex")
155
'(muse-latex-footer "~/Documents/site/footer.tex")
156
'(muse-book-latex-header "~/Documents/site/book-header.tex")
157
'(muse-poem-latex-header "~/Documents/site/poem-header.tex")
158
'(muse-poem-latex-footer "~/Documents/site/poem-footer.tex")
159
'(muse-chapbook-latex-header "~/Documents/site/chapbook-header.tex")
160
;;'(muse-before-publish-hook (quote (muse-cite-munge-footnotes)))
161
'(muse-mode-hook (quote (list footnote-mode turn-on-auto-fill flyspell-mode))))
163
(defun muse-publish-my-books (&optional force)
165
(muse-book-publish-project
166
'("essays" ("~/Documents/essays"))
167
"essays" "Collected Essays" "book-pdf" "~/Sites/johnw/pdf" force)
168
(muse-book-publish-project
169
'("stories" ("~/Documents/stories"))
170
"stories" "Collected Stories" "book-pdf" "~/Sites/johnw/pdf" force)
171
(muse-book-publish-project
173
("~/Documents/journal/early"
174
"~/Documents/journal/summer2003"
175
"~/Documents/journal/j2003"
176
"~/Documents/journal/j2004"
177
"~/Documents/journal/j2005"
178
"~/Documents/journal/journal"
180
"~/Documents/poems/mystical"
181
"~/Documents/poems/romantic"
182
"~/Documents/poems/natural"
183
"~/Documents/poems/melancholy"
184
"~/Documents/poems/commentary"))
185
"myjournal" "Thought Journal" "journal-book-pdf" "~/Sites/johnw/pdf" force)
186
(muse-book-publish-project
188
(:nochapters t ; do automatically add chapters
189
:book-chapter "Mystical"
190
"~/Documents/poems/mystical"
191
:book-chapter "Romance"
192
"~/Documents/poems/romantic"
193
:book-chapter "Nature"
194
"~/Documents/poems/natural"
195
:book-chapter "Melancholoy"
196
"~/Documents/poems/melancholy"
197
:book-chapter "Commentary"
198
"~/Documents/poems/commentary"))
199
"poems" "Collected Poems" "chapbook-pdf" "~/Sites/johnw/pdf" force)
200
(muse-book-publish-project
201
"website" "writings" "Collected Writings" "book-pdf"
202
"~/Sites/johnw/pdf" force))
204
(defun modules-get-version-and-date (module)
207
(insert-file-contents-literally module nil 0 1000)
208
(if (re-search-forward "Version:\\s-+\\(.*\\)" nil t)
209
(setq version (match-string 1))))
210
(setq date (format-time-string "%Y-%m-%d"
211
(nth 5 (file-attributes module))))
212
(concat (and muse-publishing-p "<span class=\"version\">")
214
(format "%s (%s)" date version)
216
(and muse-publishing-p "</span>"))))
218
(defun muse-blog-add-entry ()
220
(muse-project-find-file "journal" "website")
221
(goto-char (point-min))
223
(insert "* " (format-time-string "%Y%m%d: ")
224
(read-string "Journal entry title: ")
228
(defun muse-my-html-insert-contents (&optional ignore)
232
(goto-char (point-min))
233
(search-forward "Page published by Emacs Muse begins here" nil t)
235
(while (re-search-forward "^<h\\([0-9]+\\)>\\(.+?\\)</h\\1>" nil t)
236
(unless (get-text-property (point) 'read-only)
237
(setq l (1- (string-to-number (match-string 1))))
243
(setq contents (cons (cons l (muse-match-string-no-properties 2))
245
(goto-char (match-beginning 2))
246
(muse-html-insert-anchor (concat "sec" (int-to-string index)))
247
(setq index (1+ index)))))))
248
(setq index 1 contents (reverse contents))
249
(when (> (length contents) 0)
250
(goto-char (point-min))
251
(or (search-forward "<h2>Archives</h2>" nil t)
252
(search-forward "#include virtual=\"/sidebar.html\"" nil t))
254
(insert "<h2>Contents</h2>\n\n<ul>\n")
255
(dolist (item contents)
256
(insert "<li><a href=\"" (muse-publish-output-name)
257
"#sec" (int-to-string index) "\">"
258
(muse-publish-strip-tags (cdr item))
260
(setq index (1+ index)))
261
(insert "</ul>\n"))))
263
(defun muse-my-html-finalize-buffer ()
264
(when muse-publish-generate-contents
265
(muse-my-html-insert-contents (cdr muse-publish-generate-contents))
266
(setq muse-publish-generate-contents nil))
267
(when (string= (muse-publish-output-name) "recent.html")
268
(goto-char (point-min))
269
(search-forward "Page published by Emacs Muse")
271
(delete-region (point-min) (point))
272
(search-forward "Page published by Emacs Muse")
274
(delete-region (point) (point-max))))
276
(defun muse-site-html-set-mode (file output-path final-target)
277
(set-file-modes output-path ?\755))
279
(defvar muse-my-journal-entries nil)
280
(defvar muse-my-journal-nested t)
282
(defun muse-my-journal-find-entries ()
283
(goto-char (point-min))
284
(let ((heading-regexp (concat "^\\* " muse-journal-heading-regexp "$"))
285
(inhibit-read-only t)
287
(while (re-search-forward heading-regexp nil t)
288
(let ((begin (match-beginning 0))
289
(date (match-string 1))
290
(title (muse-match-string-no-properties 2))
294
(if (string-match muse-explicit-link-regexp title)
295
(setq enclosure (match-string 1 title)
296
title (match-string 2 title)))))
300
(concat "\\([1-9][0-9][0-9][0-9]\\)[./]?"
301
"\\([0-1][0-9]\\)[./]?\\([0-3][0-9]\\)") date))
302
(setq date (encode-time 0 0 0
303
(string-to-number (match-string 3 date))
304
(string-to-number (match-string 2 date))
305
(string-to-number (match-string 1 date))
306
(current-time-zone)))))
307
(while (string-match "\\*" title)
308
(setq title (replace-match "" nil nil title)))
309
(unless muse-my-journal-nested
310
(let* ((path (muse-style-element :path))
312
(concat (expand-file-name (format-time-string "%Y/%m")
314
"/" (muse-journal-anchorize-title title)))
317
(if (re-search-forward heading-regexp nil t)
319
(if (re-search-forward "^Footnotes:" nil t)
322
(data (buffer-substring begin end))
325
(if (re-search-forward "^Footnotes:" nil t)
326
(buffer-substring (match-beginning 0) (point-max)))))
327
(project (muse-project)))
329
(unless (file-directory-p (file-name-directory item-path))
330
(make-directory (file-name-directory item-path) t))
331
(find-file item-path)
333
(insert "#title " title ?\n)
334
(insert "#date " (format-time-string "%B %e, %Y" date) ?\n)
340
(delete-region begin (point))
341
(goto-char (point-max))
343
(insert ?\n footnotes))
345
(kill-buffer (current-buffer))
346
(let ((muse-my-journal-nested t)
347
(muse-current-project project))
348
(muse-publish-file item-path "journal-pdf"
349
(file-name-directory item-path))
350
(muse-publish-file item-path "site-journal-html"
351
(file-name-directory item-path)))
352
(delete-file item-path))))
353
(set (make-local-variable 'muse-my-journal-entries)
354
(cons (cons title date)
355
muse-my-journal-entries))))))
357
(defun muse-my-journal-insert-contents ()
358
(goto-char (point-min))
359
(or (search-forward "<h2>Archives</h2>" nil t)
360
(search-forward "#include virtual=\"/sidebar.html\"" nil t))
362
(if (string= "journal" (muse-page-name))
363
(insert "<h2>Recent Entries</h2>\n\n<ul>\n")
364
(insert "<h2>Contents</h2>\n\n<ul>\n"))
365
(dolist (entry (nreverse muse-my-journal-entries))
366
;;(setq date (format-time-string "%m/%d" date))
367
;;(if (= ?0 (aref date 0))
368
;; (setq date (substring date 1)))
369
(insert (format "<li><a href=\"%s#%s\">%s</a></li>\n"
370
(muse-publish-output-name)
371
(muse-journal-anchorize-title (car entry))
374
;; jww (2005-04-17): a hack to rewrite MP3 titles
375
(goto-char (point-min))
376
(let ((inhibit-read-only t))
377
(while (re-search-forward "<h2><a href=\"\\([^\"]+\\)\">\\(.+?\\)</a></h2>" nil t)
378
(replace-match "<h2><a href=\"\\1\"><img src=\"images/speak.png\"></img></a> \\2</h2>"))))
380
;; (eval-when-compile
381
;; (defvar muse-current-project))
383
;; (defvar muse-ref-tag '("ref" nil t muse-ref-markup-tag))
385
;; (defun muse-ref-markup-tag (beg end attrs)
386
;; "This markup tag allows a poem to be included from another project page.
387
;; The form of usage is:
388
;; <ref title=\"page.name[#subtitle]\">"
389
;; (let ((page (cdr (assoc (cdr (assoc "title" attrs))
390
;; (muse-project-file-alist))))
391
;; beg start end text)
393
;; (insert " *Reference to\n unknown page \""
394
;; (cdr (assoc "title" attrs)) "\".*\n")
395
;; (setq beg (point))
397
;; (if (string-match "html" muse-publishing-current-style)
401
;; (insert-file-contents page)
402
;; (goto-char (point-min))
403
;; (forward-paragraph)
405
;; (buffer-substring-no-properties (point) (point-max)))))))))
407
;; (add-to-list 'muse-publish-markup-tags muse-ref-tag)
409
(when (and window-system (load "httpd" t))
411
;;(add-hook 'after-init-hook 'httpd-start)
412
(setq httpd-document-root (expand-file-name "~/Sites/johnw")))
418
;; "http://bahai-library.com/?file=bahaullah_kitab_iqan.html"
419
;; "http://bahai-library.com/?file=bahaullah_kitab_iqan.html#%d"))
421
;; ("Promulgation of Universal Peace"
422
;; "http://bahai-library.com/?file=abdulbaha_promulgation_universal_peace.html"
423
;; "http://www.bahai-library.com/writings/abdulbaha/pup/pup.html#%d"))))