martin f. krafft [Fri, 21 Mar 2008 22:17:38 +0000 (23:17 +0100)]
Handle going down with an exception
We previously used None as a sentinel to exit, but None is now a proper
value, so now it's the job of an exception-like object (except it isn't
an exception).
Signed-off-by: martin f. krafft <madduck@madduck.net>
martin f. krafft [Fri, 21 Mar 2008 18:12:16 +0000 (19:12 +0100)]
Allow individual hook registration to override ID
The preprocessor hooks need to specify IDs different from the ID used to
initialise the proxy. Thus, the hook function now takes an optional id
keyword argument and uses the ID used during initialisation if none is
provided.
Signed-off-by: martin f. krafft <madduck@madduck.net>
martin f. krafft [Fri, 21 Mar 2008 18:12:12 +0000 (19:12 +0100)]
Allow external plugins to return no value
Instead of using the XML-RPC v2 extension <nil/>, which Perl's
XML::RPC::Parser does not (yet) support (Joey's patch is pending), we
agreed on a sentinel: {'null':''}, that is, a hash with a single key
"null" pointing to the empty string.
The Python proxy automatically converts None appropriately and raises an
exception if a hook function should, by weird coincidence, attempt to
return {'null':''}.
Signed-off-by: martin f. krafft <madduck@madduck.net>
Joey Hess [Fri, 21 Mar 2008 13:07:44 +0000 (09:07 -0400)]
Changed to a binary index file, written using Storable, for speed
During refresh of a wiki with 800 files, loadindex was using more total
time than any other function, and saveindex was also in the top ten.
Rewriting them to use Storable makes them three times as fast.
0.7 seconds is saved on my laptop in profiling mode.
Joey Hess [Fri, 21 Mar 2008 10:36:07 +0000 (06:36 -0400)]
Precompile pagespecs, about 10% overall speedup
About 12% of ikiwiki runtime was spent in pagespec_match. It was evaling
the same pagespec code over and over again. This changes pagespec_translate
to return memoized, precompiled functions that can be called to match against
a given pagespec.
This also allows getting rid of the weird variable scoping trick that had
to be in effect for pagespec_translate to be called -- the variables are
now just fed into the function it returns.
On my laptop, this drops build time for the docwiki from about 60 to 50
seconds.
Joey Hess [Fri, 21 Mar 2008 08:48:26 +0000 (04:48 -0400)]
crazy optimisation to work around slow markdown
Markdown is slow. Especially if it has to process an enormous page. The
most common enormous page is currently the recentchanges page, which gets
processed a lot, and contains very little actual markdown. Most of it is a
big <div>, which markdown skips ... slowly.
This is a rather sick optimisation to work around markdown's speed issues.
Now inline inserts a small, dummy div, allows markdown to quickly render
the actual page content, then replaces the dummy with the actual inlined
pages later.
Results: Rendering just a recentchanges page, with diffs included, dropped
from 4.5 seconds to 2.7 seconds on my laptop. Building the entire wiki
dropped from 46.6 seconds to 39.5 seconds.
(It would be better if inline were a *post*-processor directive.)
Joey Hess [Wed, 19 Mar 2008 19:12:59 +0000 (15:12 -0400)]
getargv needs to return a list reference
xml rpc only allows functions to return a single value, no lists. So getargv
needs to return a list reference, which means that the caller will see an xml
rpc array.
martin f. krafft [Tue, 18 Mar 2008 16:39:06 +0000 (17:39 +0100)]
Prevent plugins/.gitignore from being installed
I added a .gitignore file to plugins/ to ignore *.pyc files, and that
file is now being installed +x to /usr/lib/ikiwiki/plugins. This commit
prevents that by excluding all dot-files under plugins/ from the
install.
Signed-off-by: martin f. krafft <madduck@madduck.net>
Joey Hess [Tue, 18 Mar 2008 01:28:31 +0000 (21:28 -0400)]
* Record new pages in %pagesources temporarily when previewing so that
things that need to know the page source or type can query it from there.
Fixes previewing of tables when creating a new page.