Remember Remember

lunes, 11 de mayo de 2009

Personal wiki

So I want a personal wiki. First, I started using vim and plain-text files with the gf magic, the main problem arrives when you want (or need) to use non plain-text files (pics, plots, pdfs, etc).


As my main concern is to be able to track my research, the fact of being able to attach a pdf is very useful. Is this why I ended up with the idea of using a more powerful wiki. My first shoot is something called MoinMoin. Installation in standalone mode is pretty straightforward. It looks OK so far, it is written in python and seems very extensible (there are many plugins available).


After a couple of tests, I found myself writing too much. This made me wonder if it were possible to use an external editor to modify the pages. I tried the It's all text firefox extension, a extension that enables using any external program to edit HTML textareas. The extension work fine (I am using it actually to write this post), but I still wanted something I could edit directly from the command line.


After googling a little, I reach the editmoin page. Editmoin allows you edit
MoinMoin pages directly from the CLI: it fetches, opens an editor and
commits when you close the editor if there were any changes in the file.


The only but I found, was the impossibility of following links inside the
editor (VIM in my case), so I modified the editmoin script to add the
JustFetch or JustCommit actions. The corresponding diff for the script in the editmoin-1.10.1.tar.gz tarball is



71c71
< def __init__(self, filename, id, has_moin_session):
---
> def __init__(self, filename, id, has_moin_session,url=None):
76a77
> self.url = url
150a152
> file.write("@@ URL: %s\n"%self.url)
305c307
< return MoinFile(filename, id, has_moin_session)
---
> return MoinFile(filename, id, has_moin_session,url=url)
381a384,392
> extra_options = {"f":"Fetch","r":"Release","c":"Commit"}
> action = None
> filename = None
> if argv[0][1] in extra_options.keys():
> action = extra_options[argv[0][1]]
> argv = argv[1:]
> if action == "Commit":
> filename = argv[0]
> argv[0] = open(argv[0]).readlines()[0].split()[-1]
394,395c405,411
< if editfile(moinfile):
< sendfile(urlopener, url, moinfile)
---
> if action:
> if action == "Fetch":
> print moinfile.write_raw()
> sys.exit(0)
> if action == "Commit":
> moinfile.read_raw(filename)
> sendfile(urlopener, url, moinfile)
397c413,416
< sendcancel(urlopener, url, moinfile)
---
> if editfile(moinfile):
> sendfile(urlopener, url, moinfile)
> else:
> sendcancel(urlopener, url, moinfile)



It is not an elegant hack, but it works. Just

editmoin -f ThePage


and it will print the filename. Edit the file as much as you want, and then

editmoin -c TheFile


and it will commit the page (Attention, it wont delete the file).


The next step is to integrate it into VIM.

2 comentarios:

  • We use moinmoin for our work documentation, and editmoin is really really good. You might want to look at http://vim.wikia.com/wiki/Edit_MoinMoin_wiki_files_with_folding
    to enable section folding.

    OTOH, you might also want to look at ikiwiki. I know it can handle images, attachments, and latex code just fine, and you get the plus of as many compiled (processed, HTML) copies of your wiki at no cost.

    But moinmoin is really powerful. Dunno, I chose ikiwiki for my personal stuff, but I still like moinmoin a lot

    De Anonymous jerojasro, A las 11 de mayo de 2009, 22:19  

  • Thanks for the tip J. I am giving it a try.

    As for ikiwiki, it sounds good, but I spent yesterday configuring moinmoin, so I will have to wait at least a couple of days to try :).

    De Blogger Camilo, A las 12 de mayo de 2009, 9:39  

Publicar un comentario

Suscribirse a Enviar comentarios [Atom]



<< Inicio