This is a log of new features of note in DWiki.
New: directories can have an index 'page'
I've decided that sometimes I really want a directory to have an index page, not just a list of the contents. So now I can, with the unimaginatively named 'index' view. It's mostly template based; the normal template uses
inject::index
to display an__index
file. However, the view has several special properties:
- unlike other directory views, it is not inherited by subdirectories.
- it is only listed as an available view in the page tools area if there is a file called
__index
in the directory.- if
__index
is a redirection, the index view will just generate a redirect to the target.(Thus, the index view could be used to replace the
wikiroot
configuration directive.)The index view is valid on directories even without a
__index
page in the directory. Right now the template just displays a normal directory listing in that case.
New:
#pragma search ...
I got tired of the relative links in my blog drafts (written in an entirely different directory than their eventual home) not working. So, introducing
#pragma search
; this adds additional directories to search for pages when resolving relative links, both WikiWords and explicit [[...]] links. The directories listed in a search pragma must be absolute path names, and are searched only after the hard-coded possibilities have been exhausted (including the alias directory for WikiWords).You can't have both a
#pragma search ...
and a#pragma pre
in the same page, partly because it doesn't make any sense. (This is the simple way of getting out of handling multiple#pragma
directives.)
New: optional disk-based caching
Having run out of other ways to really improve performance, I added a disk-based caching infrastructure to DWiki and then put in two caches.
The real cache is the renderer cache, which stores the results of selected renderers (currently just the
wikitext
renderers). Via some glue it's also used to store the results of the filesystem walk that's the expensive bit ofblog::prevnext
.The Brute Force Cache is for dealing with Slashdotting style situations; it just caches complete requests for N seconds when the system seems to be under load. I also hijacked it as a convenient place to add extra caching for Atom feeds and to force this caching on software that doesn't do conditional GET.
(For more details, see Caching.)
This required a new storage pool class. Like the comment store, it uses a customized and restricted interface to write things (and a new interface to read them). The cache storage pool stores objects, not data blobs, using the cPickle module to make the swap back and forth. (This may be a mistake, but it's fast and easy.)
Since removing files in DWiki makes me nervous, I didn't bother to implement any sort of cache cleaning; you get to do that by hand. The cache has TTLs, and the renderer cache has validation layered on top of the cache object store, but when they detect something invalid they just ignore it. (On the other hand, the cache storage layer does use temporary files and
rename()
, so in a sense it's already removing files.)In theory the cache interface is generic, so later I can hook up a memcached setup or something without having to change higher-level code.
New: Text formatting via macros
I (ChrisSiebenmann) found myself with a genuine need for text set in HTML <strike>. Rather than try to invent a formatting setup for this that did not make me cringe, I just punted to the easy solution: macros that do text formatting.
So, DWiki now has grown the new macros:
ST
for the font styles DWiki didn't already have.C
for character entities, andShowCharEnts
to show the named entities we support.- because I was there anyways,
AB
for <abbr>, so I could have those cute inline abbreviation expansion things. Tragically <abbr> is not supported by IE 6 and less, soAB
may quietly change to generating <acronym> someday.- and finally,
IMG
to generate <img>. Width, height, and alt text is mandatory, and there is a hacky way to also roll title text in too. (Title text is optional.)Through special black magic,
ST
,C
, andAB
can be used in comments (the omission ofIMG
is deliberate). In theory this lets a commenter cause character set explosions, but in practice a bad commenter can just write UTF-8 directly (UTF-8 is the common and only sane character set choice, so).Implementing these as macros means that they have some limitations. You can't nest
C
,AB
, or a differently styledST
inside anST
, and currently none of them can be done inside link text ([[....]]
).These macros are a bit of a hack. It's relatively easy to implement bits of HTML this way, but I'm not sure if it's good design overall.
New: Previous and Next links in pages in blog views
The more I have used DWiki for a blog, the more I've realized that I want individual entries to be able to have Previous (entry) and Next (entry) links. At first I resisted because this would require an expensive filesystem walk on even individual page views, but I have now given in and made the
blog::prevnext
renderer, which will do this if I want.
blog::prevnext
generates links directly to the pages, not to/range/N-N/
virtual directories, because I think that works better. (It would be less code the other way, but better links are worth the code.)