/**
require() plugin which fetches a wiki page from the repo db,
in the form of an Object which mimics the fsl_deck structure
(see Fossil.Context.loadManifest()).
It interprets its argument as a wiki page name and throws if not
found.
*/
return requireS2(['fsl/context', 'fsl/db/repo'], proc(fsl, repo){
return {
isVirtual: true,
_F: fsl,
_sql: <<<_SQL
SELECT x.rid FROM tag t, tagxref x
WHERE x.tagid=t.tagid
AND t.tagname='wiki-%1$q'
ORDER BY mtime DESC LIMIT 1 _SQL,
load: function(name){
return this._F.loadManifest(
this._F.db.selectValue(this._sql.applyFormat(name))
||| throw "No wiki such wiki page: "+name
);
}
};
});