I want to build my own wiki engine. And I expect it will not take long to write, if I find the time to just do it. I'm planning on building it around a very basic programming language of mine, baseML. This page outlines how I'm planning on doing it, some kind of a piece of paper to do my design, and it's open to the public.


baseML is a tool to manage and construct web sites. To create a web site, you have to provide baseML with a set of "source" XML files that contain the styling and contents of your web site. The source code format is a mix between XML/XHTML components and procedural programming. Some concepts taken from object orientation (such as inheritance/overloading and containers) facilitate managing cascading styles, contents and containers of documents. baseML is not Turing complete, but I don't think it doesn't require Turing completeness for its main job either.


Basically, baseWiki would just be a (set of) PHP file(s) that help you to edit the baseML imput files in your browser. If a change is made to a baseML file, the script would have to call baseML to render the page, and all the baseML documents in the database that depend on that file (documents that inherit the recently changed document, has it in a container, or uses it as an API), too.


Keep existing web site as much as it is now

Any web site built with baseML should easily be able to use baseWiki. On a baseML web site, it is very easy to change the looks of your complete web site in the blink of an eye. Somewhere on the rendered web site, the user should insert a reference to a PHP editor, to edit the current file. This is possible with baseML, using the following in your style file such that it renders a link to the editor on every page:

<a href="edit.php?page=$BASEML_SOURCE;">Edit</a>

Note that $BASEML_SOURCE; is a variable in baseML that, by default, contains the filename of the baseML source file that is being rendered.

Editor functionality

A script (e.g. edit.php) can be started that allows the browser to edit the baseML file of the current page viewed in the browser. The editor should be as minimal as possible. All it requires is a text box to edit the file. A button allows the user to save the current changes. I'm just not sure whether it's that straightforwarded to edit/save/... XML files with standard functions.

Rerendering upon changes

When a baseML document has been changed and saved from the editor, the baseML compiler must render that page to the right HTML file, such that it becomes available for the web server.

Catch errors when rerendering

baseML documents are XML documents. While editing them, errors can be introduced by not correctly closing a tag, etc. The rerenderer should be able to catch these errors (baseML returns a 1 upon errors) if they were made, show the errors to the user of the editor (possible showing the faulty lines), and allow him to debug these errors.

Recursive rerendering of documents

baseML documents can be made to depend on each other, so if one file was changed, the depending documents must be updated too. The rerendering engine thus needs to be able to take care of this job, possibly by recursively checking all documents whether someone needs to be updated.

If all goes well, maybe this rerenderer wants to check circular dependencies as we don't want the rerenderer going into an infinite loop. This could easily be solved by not recursing on documents that have just been updated.


It must be possible to preview the file when it's being changed. We'd better use a temporary folder to store the changed, but possible wrong page while we're editing it.

Catch 404s

If a document doesn't exist yet, it means that we're planning on writing it. This is because it is possible as we have clicked from another document that refers to this not yet existing document, but we were planning on writing it. This would render a 404, but we want to be able to make it a page that allows to edit the new document as a baseML file. I'm not sure how to handle this easily, and possible to transport to other systems with ease, is yet an unsolved problem.

Template for new pages

If a new page is added to the pool of baseML files, the editor must pop up with an already filled template, to ease the introduction of new documents. This template could be copied from a template file (one that can also be edited by the editor).

Session Management

At times, we want pages to be protected from mutulation from the general public, and have password protection around the editor. Let's please have some kind of session management in place to allow this, but I have currently no clue for how to do this, I'll have to dive the PHP books, ready to help me, sitting on their shelf.

Version revisioning system

This would be a nice addon, but not necessary. I like revision histories and the likes.

comments powered by Disqus