So, I had published Erliki, my Erlang wiki server onto GitHub a while back. Erliki is a self-contained wiki server that uses BeepBeep, a framework that provides a few niceties like templating via ErlyDTL and session handling on top of the very solid Erlang http server, MochiWeb. BeepBeep doesn’t provide a backend, so I decided to go native and use Mnesia, Erlang’s native distributed dbms.
I didn’t go very far in implementing wiki syntax, so Erliki only supports [[Wiki links]]. However, I feel that I can easily extend it to support any syntax because I created a compiler using Erlang’s yecc module and some custom code. It’s pretty sweet, yecc will code-generate the parsing code for you if you just supply it with a grammar. Here’s wiki.yrl:
Header "%% Erliki". Nonterminals phrase wikilink word. Terminals string '[[' ']]' '<' '>'. Rootsymbol phrase. phrase -> word : '$1'. phrase -> word phrase : ['$1', '$2']. wikilink -> '[[' string ']]' : {'wikilink', '$2'}. word -> wikilink : '$1'. word -> string : '$1'. word -> '<' : '$1'. word -> '>' : '$1'.
Passing a string into the generated parsing code will return a list of tuples representing the parse tree, which I then store directly into Mnesia. From there, I can convert the wiki links in the parse tree into <a> tags or [[wiki syntax]] depending on if you’re reading or editing the page. Storing the native parse tree in Mnesia also makes it easy to prevent html injection because you’re not re-parsing the input when storing or reading from the database.
I created it mostly to learn about MochiWeb and Mnesia so I doubt I’ll be maintaining Erliki, but feel free to check it out for yourself. There’s not external dependencies, just add Erlang.