TiddlyWiki/tiddlywiki — pull request #110 by JohnHind (2012-10-21 10:35:53+00:00)
Title: Generic support for saver plugins and prefix blocks

This patch facilitates addition of saver methods via the traditional override technique in tiddler plugins and via a new technique of script blocks prefixed to the HTML file by custom browsers or web servers such as AppJS, which can 'preempt' certain functions in the core.

The test for 'savability' is factored out into a new ```allowSave``` function supporting preemption and minimising the amount of code duplication required for override. Each instance of this test in the core code is replaced by a call to ```allowSave```. It is hoped that plugins providing file save capability will migrate to using this too.

The core declarations of ```getLocalPath```, ```loadFile```, ```saveFile``` and, for completeness, ```copyFile``` are modified to support preemption.

A new preemption function ```tweakConfig``` is called if it has been declared by a prefix script. This gives prefix code a chance to alter ```config``` defaults and ```useJavaSaver```.