auf.kante
Gunnar macht sich selbststaendig und fliegt auf
die Schnauze
wird erfolgreich. Wer mag darf zuschauen.
Gunnar is starting his business. He will certainly
fail succeed. You may watch.
auf.kante
Website sections
Home
Emacs Muse Mode
Last changed: 2006-02-11 [16:28]
Content:

How to manage a website with tools available for emacs
 
Back to Personal Wiki
Table of contents
Markup
Code snippets for the Muse Mode
Links

Markup

Muse Test Page

Code snippets for the Muse Mode

Backlinks

In order to be able to use backlinks on the top and bottom of each page I added a #backto directive. It allows to specify one or several backlinks:

#backto index|Projects,second_backlink|More Information

Backlinks are separated using a comma. Each backlink has a link and a description component joined by a separator (|). The following lisp code can be used to convert this directive to a set of links:

(let ((backto  (muse-publishing-directive \"backto\")))
  (when backto
    (let ((primary (split-string backto \",\"))
      backlink)
      (dolist
        (secondary primary backlink)
        (setq tmp (split-string secondary \"|\"))
        (setq backlink
          (concat backlink (concat \"<div class='backlink'><img src='../base/images/list_item.gif' /> Back to <a href=\"
	                           (pop tmp)
                                   \".html>\"
                                   (pop tmp)
                                   \"</a></div>\")
          )
        )
      )
      backlink
    )
  )
)

If this code is embedded in &lt;lisp&gt; tags inside the muse page it will be replaced with the backlinks.

del.icio.us API

See EmacsDeliciousAPI.

Last change

I am using an additional variable on my muse pages to indicate when the page has been modified the last time. In the header of the page I add this type of statement:

 #lastchange 2005-09-09 [11:12]

The following functions can be used to automatically update the time stamp:

(defun format-time-last-changed ()
  (format-time-string "%Y-%m-%d [%H:%M]"))

(defun insert-last-changed ()
  (insert (format-time-last-changed)))

(defun update-last-changed ()
  (save-excursion
    (goto-char (point-min))
    (when (re-search-forward "^#lastchange\\s +[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\s \\[[0-9]\\{2\\}:[0-9]\\{2\\}\\]" nil t)
      (delete-region (match-beginning 0) (match-end 0))
      (insert "#lastchange ")
      (insert-last-changed))))

In order to automatically update the variable on saving a muse page the update-last-change function can be added to the write-contents-hook:

(defun record-last-changed ()
  (setq write-contents-hooks 'update-last-changed))

(setq muse-mode-hook (quote (flyspell-mode highlight-changes-mode record-last-changed)))

The time stamp can be retrieved using a statement similar to this:

<div class=\"lastchange\">
  Last changed: <lisp>(muse-publishing-directive \"lastchange\")</lisp>
</div>

Page status

In order to display a small note about the status of the page I use the following piece of code:

(defun muse-publish-status ()
  (let ((status  (muse-publishing-directive "status")))
    (when status
      (let ((tmp (split-string status "|")))
	(concat "<div class='status"
		(pop tmp)
		"'>Status: "
		(pop tmp)
		"</div>")))))

You can the use the #status directive to add the status comment on a page:

#status ok|Completed.

Finally you can use it like this to include the status note on a page:

<div class=\"status\">
  <lisp>(muse-publish-status)</lisp>
</div>

Links

Same section in del.icio.us
  • Emacs Muse Mode
  • Emacs Wiki - Emacs Muse Mode
  • Muse Mode Documentation
  • Emacs Muse Mode - Project site
Back to Personal Wiki
Creative Commons-Lizenzvertrag
The content of this site is licensed under a Creative Commons 2.5 License [attribution, share-alike]