werc
Werc is a minimalist content management system (CMS) with a web interface implemented using the rc shell and the Plan 9 from Bell Labs tools provided as part of Plan 9 from User Space.
Originally developed for cat-v.org it has become more generalized. One of its major features is that it allows management of multiple domains and virtual hosts easily from a single installation.
(More or less idiosyncratic) Features
- Purely file system based, all documents are stored in a file tree as plain text files (.html files and .txt files are also handled and integrated transparently), no need for any database.
- Also allows for dynamically generated pages/scripts/applications that can take advantage of the framework (for an example see the dynamically generated gsoc project status table).
- Easily embedding of pre-existing html documents into the framework.
- Easy management of multiple domains/sub-domains/virtual-hosts from a single installation (just add another directory under sites/), and easy sharing of templates and files among sites.
- Markdown templating plus template cache (thanks Mechiel!) to make up for dog-slow markdown implementations.
- Automatic sitemap generation.
- Bloging system including rss feeds.
- More that I probably have forgotten about.
Development
To get a copy of the latest development code using mercurial, do:
hg clone http://gsoc.cat-v.org/hg/werc/
You can also browse the online repository.
Dependencies
To run werc you will need a recent version of Plan 9 from User Space and a sane version of awk (ideally the original one maintained by Brian Kernighan). Compiling statically p9p and awk is probably a good idea and will improve performance on platforms with dog slow fork(2) (linux fork(2) is a few magnitude orders faster for statically linked binaries).
If you use the included markdown.pl you will need perl too, sorry.
TODO
Too much to list here.
- Blog:
- Atom feeds
- Comments (including threading)
- Web interface to submit new posts
- Some form of pagination/history browsing
- Better modularization/integration of blog/rss related code.
- Sitemaps:
- In the sitemap index pages should be used for description of directories
- Dynamic generation of sitemap.txt too
- Cache sitemap generation
- Dirfilter var has different semantics in sitemap filtering than in sidebar filtering(?)
- Layout improvements:
- Fixed width of left sidebar (so design scales down to cellphone-sized-screens)
- Links to search page in top-right toolbar
- Need to find a way to rig the order of items in the sidebar
- Better page titles (include whole path hierarchy?)
- Allow utf-8 characters in path elements (need to make sure this is safe)
- General code:
- Write a regression test suite
- Replace all reference to non p9p/p9 programs
- Reorganize execution flow to allow for header changes imediately before page generation(useful to set redirections, caches, cookies, and errors)
- Better defined 'API' for sub-apps (both a set of environment vars apps can rely on (and in some cases set) and functions they can call)
Future plans:
- Wiki mode (replacement for diri)
- Bug/issue tracking module
- Further modularization and extensibility (meta-templates)
- A way to wrap external applications (eg., hg/git browser)
- A way to generate static sites (ie., use werc as a pure templating system)
- 9P interface
- New (simplified) markdown implementation, ideally in C or awk (maybe smu/libsmu by gottox?):
- Simplified
- Tables
- Images
- Autogenerated anchors
- No inline html
Resolved issues and implemented features:
- Permanent redirections by setting a variable in _config, avoiding need to mess around with httpd configuration for page moves. (done, set redirectPermanent var)
- Broken links in blog titles in post listing, eg: http://repo.cat-v.org/libixp/news/ (fixed?)
- Too wide margins for .html (troffied) in low screen resolutions (fixed)
- Better display of single blog entries (done, maybe could use more work)
- Make a proper 0.1 release (done)
- Autogenerated sitemaps (both .txt and .html versions) (done, but probably needs more work/caching and only html version so far)
- Modularize footer the same way the top header is (done)
- Should set
<BASE href=...>header so links and images in 'implicit dirs' work even when there is no trailing/. (Resolved in a better way by redirecting always to the canonical dir path ending with /)
Known bugs
- http://gsoc.cat-v.org/blog/asdfasdf/blog/ should give a 'not found' error
- Give proper 404 errors for non existent pages (1.0 BLOCKER)
- Listing of files/dirs with (single) dots is broken (1.0 BLOCKER)
- Some cat-v.org bits still left over here and there, should make them configurable (1.0 BLOCKER)
Contact
For patches and bugrepports email: uriel99-gmail.com
License
Public domain (by default includes markdown.pl which has a different license, but this can be replaced).
Credits
Thanks to Kris Maglione (aka JG) for implementing rss feeds, for writing the awk rc-templating system, and other help and inspiration (some parts of the code were based on JG's diri wiki).
Thanks to Mechiel (aka oksel) for the md_cache script.
Thanks Garbeam (aka arg) for writing the original diri code and showing that writing complex web apps in rc was feasible.
And thanks to everyone else whom I have forgotten and that has provided fixes and feedback.