rst2html + git == personal wiki

This Makefile:

RSTOPTS=--time --link-stylesheet --stylesheet=style.css

SOURCES=$(wildcard *.rst)
HTML=$(foreach file,$(SOURCES),_build/$(basename $(file)).html)

all: html

_build/%.html: %.rst
        rst2html.py $(RSTOPTS) $^ > $@

html: $(HTML)

clean:
        rm -f $(HTML)

plus make html in .git/post-{commit.update} + python and docutils + a stylesheet in _build (all paths relative to your repository) is the perfect cross platform wiki :-)

Notice: my blog kills the tabs, copy/paste from the pastebin

9 Responses to “rst2html + git == personal wiki”

  1. Cool, my boss pointed me to something really nice integrating hg + rst in a similar fashion but without a manual build step, check it out here http://getschevo.org/slipper, we’re loving it.

    Comment by michele — Saturday, May 3rd, 2008 @ 12:48 am
  2. No ikiwiki?

    Comment by Kelly Clowers — Saturday, May 3rd, 2008 @ 4:52 am
  3. @michele: You don’t have to build manually, on commit and update it automatically builds the changed files.

    Comment by Armin Ronacher — Saturday, May 3rd, 2008 @ 7:04 am
  4. I considered doing something like this, but I found creating new pages and linking them to eachother to be un-wiki-like. How do you handle linking between pages? RST links to the html version of the rst file? Or is there some smarter way? Would make it kind of a pita to follow the links while editing, wouldn’t it?

    I just settled on using emacs-muse-mode on svn + svk. Not that I’ve figured out how to get muse-mode to actually publish to HTML. But it is, after all, a *personal* wiki and I spend half my time in emacs anyway so I don’t actually need it as HTML since links and images work fine from within emacs.

    Comment by Ben Smith — Saturday, May 3rd, 2008 @ 7:17 am
  5. There are smarter ways. One could use a sphinx extension + custom templates for a better solution. That would support links between documents and multiple output formats, but quite frankly i was too lazy :-)

    For me it’s a simple way to jot down notes and sync them between my mac and ubuntu box.

    Comment by Armin Ronacher — Saturday, May 3rd, 2008 @ 7:43 am
  6. Ops, sorry Armin I’ve totally missed the post-commit hook! :-(

    Comment by michele — Saturday, May 3rd, 2008 @ 8:10 am
  7. Uhhh, use ikiwiki instead of a custom hack.

    Comment by foo — Saturday, May 3rd, 2008 @ 10:38 am
  8. @foo: Why? Then I couldn’t use rst and what would be the fun of it? :D

    Comment by Armin Ronacher — Saturday, May 3rd, 2008 @ 10:56 am
  9. @armin: killing the fun accepted, but you can use rst with ikiwiki

    For me I use ikiwiki + git = personal wiki.. (using markdown)

    See http://ikiwiki.info/plugins/rst/

    Comment by ulrik — Saturday, May 3rd, 2008 @ 10:23 pm

Leave a Reply

cogitations driven by wordpress