display the pagetitle() in linkmaps

without this patch, linkmaps display underscores and underscore escape
sequences in the rendered output.

this introduces a pageescape function, which invoces pagetitle() to get
rid of underscore escapes and wraps the resulting utf8 string
appropriately for inclusion in a dot file (using dot's html encoding
because it can represent the '\"' dyad properly, and because it doesn't
need special-casing of newlines).
In all=no conditionals, depend on the influences, not the test pagespec

Previously, if a page like `plugins/trail` contained a conditional like

    [[!if test="backlink(plugins/goodstuff)" all=no]]

(which it gets via `templates/gitbranch`), then the
[[plugins/conditional]] plugin would give `plugins/trail` a dependency on
`(backlink(plugins/goodstuff)) and plugins/trail`. This dependency is
useless: that pagespec can never match any page other than
`plugins/trail`, but if `plugins/trail` has been modified or deleted,
then it's going to be rendered or deleted *anyway*, so there's no point
in spending time evaluating match_backlink for it.

Conversely, the influences from the result were not taken into account,
so `plugins/trail` did not have the
`{ "plugins/goodstuff" => $DEPEND_LINKS }` dependency that it should.

Invert that, depending on the influences but not on the test.

Bug: http://ikiwiki.info/bugs/editing_gitbranch_template_is_really_slow/
SuccessReason: add some explanatory comments

Whenever I look at dependency calculation, it takes me a while to get my
head round the concept of influences. If what I've written here is
accurate, maybe the next person to look at this (or my future self)
will need less of a run-up.
IkiWiki::Render: make 'scan' idempotent

If it does nothing when a page has already been scanned, we can use it
at any time to force a page to be scanned. In particular, the
templatebody plugin is going to need this.
add readtemplate hook
Add templatebody plugin and directive, and enable it by default

Also add a regression test for templatebody.
Use templatebody for the templates in the basewiki and docwiki
Track whether we're in the scan or render phase

In the scan phase, it's too early to match pagespecs or sort pages;
in the render phase, both of those are OK.

It would be possible to add phases later, renumbering them if necessary
to maintain numerical order.
Assume that every page has been scanned by the time the scan phase ends

This doesn't prevent memory from being used to track what we have
and haven't scanned, but it does make it temporary. The existing
%rendered hash, which is filled afterwards, will be larger than %scanned
in practice anyway: %scanned will contain an entry for each page
that changed, plus an entry for each template used by templatebody,
whereas %rendered will contain an entry for each page that changed
plus an entry for each page rendered due to links or dependencies.
partially revert 154c4ea9e

explicitly en- and decoding xmlrpc requests in the python proxy broke
plugins on debian sid, while it was introduced to fix breakage in debian
stable. it is assumed that an xml module involved changed its behavior
from str to unicode, this patch handles both cases.
set the file type parameter after reading the image

imagemagick, when reading an image, sets its magick parameter to
indicate the file type, overriding the explicitly set file type for
output if it is set at creation.

as a result, previously (with graphicsmagick-libmagick-dev-compat
1.3.18-1 providing Image::Magick), svg output files were not png,
neither svg, but mvg (imagemagick vector graphics).
add pdf support to the img directive

this is trivial as pdf is supported by imagemagick, and just needs an
explicit mention to enable conversion.
add pagenumber parameter

this allows picking a page from a pdf. also, this enhances performance
greatly when rendering pdfs, as only the first page is rasterized.
(otherwise, imagemagick would treat the pdf as a list of images, work
with all of them, until finally only the first page gets saved). the
default parameter of 0 will select the single image contained in typical
image files anyway, so no specialcasing between single- and multifile
containers is needed.
Added svg figure
autoindex test: check what happens to files in transient/normal underlays
autoindex: remove unnecessary special case for transient underlay

It's not clear that the transient underlay should be excluded from
indexing; see [[bugs/transient autocreated tagbase is not transient
autoindexed]].

In any case, the code that checks what directories might need indexes
specifically checks for the srcdir anyway, so the only effect this extra
check can have is negative (it could fail to notice files in the
transient underlay and attempt to recreate them unnecessarily).
Add a regression test for autoindex_commit => 1
Allow creation of transient index pages for directories outside srcdir

After this change autoindex creates index pages also for empty directories
included in underlays, but only if it isn't going to commit them to the
srcdir ($config{autoindex_commit} = 0).

Inspired by a patch from Tuomas Jormola.

Bug-Debian: http://bugs.debian.org/611068
add unittests for img

this focuses on the features introduced in
http://ikiwiki.info/bugs/svg_and_pdf_conversion_fails/
make unittest work with all all three packages that provide perlmagick