teknopaul edited this page Aug 29, 2011 · 4 revisions
Clone this wiki locally

Portawiki is a Rierteta.net experimental project for messing around with node.js.

When discussing putting up a wiki for internal use 2 Riereta, Abdul commented...

"Don't install a wiki, you put your data in then and you can't get it back out"

or words to that effect in Spanish, or was it Catalan?

And so Portawiki was born, a text pad with no lock-in, files stored to the filesystem can be read directly by Apache or any http server that supports basic SSI.

A "wiki" in the vuagest of senses...

  • It does not use wiki syntax, wiki syntax is horrible and needs to be learned and relearned
  • wiki syntax is pointless AFAICS, Markup is a readable (M$ Word HTML excluded) and much better supported in editors so you can have a wysiwg view.
  • Markdown is a good concept, but Tiny Editor is a fully wysiwyg editor that makes the backing format irrelevant, if you want bold press the bold button, there is no need to read the manual
  • This page for example can render a <hr> tag with *** --- or ___ which is very nice thank you, but <hr> is far more of a standard. If you think ###### is more readable than <h6> install one of many wikis out there.
  • Portawiki stores HTML files, with SSI includes, to the file system.
  • Another design goal was that the data stored should be simple enough to extract the meta data with sed grep and other Linux tools. This is achieved by using HTML tags with classes to define meta data and storing it in the HTML, CSS hides the meta data when the page is rendered. This is more verbose than a mysql table but does not need maintenance.
  • This system is no good if you don't trust your content editors, since JavaScript can be entered into the page at any time. This is deliberate, security is a non-goal, the read-only copy is rendered by Apache, so there is no security issue.
  • The server is written with node.js
  • The node server stores the pages on disk as flat HTML files with a couple of standard SSI include tags. These includes can be ignored (they are HTML comments) or parsed by Apache or nginx to inject style and JavaScript. You can thus "export" the wiki data by copying the HTML files and starting Apache. Some SSI includes that do not have the "edit page" buttons are included.
  • When the node.js server parses the HTML, the SSI is interpreted and injects an edit menu and creates directory indexes for directories. Feel free to fork the SSI implementation, it has a couple of bits of code specific to this project but it can be easily extracted to be more generic.

Since the simple idea of storing HTML with SSI has worked so well, next project is a REST server that deals with JSON but also stores that to the local file system.