2
0
Fork 0

[lua:core plugin]: Fix comments, cache 'cached_html' action

This commit is contained in:
Stefan Bühler 2010-02-14 19:12:06 +01:00
parent e220bd588c
commit ebfa9e9ae7
1 changed files with 6 additions and 3 deletions

View File

@ -1,10 +1,10 @@
-- contrib.lua
-- core.lua
-- usage:
-- load mod_lua and this plugin:
-- setup {
-- module_load "mod_lua";
-- lua.plugin "/path/contrib.lua";
-- lua.plugin "/path/core.lua";
-- }
local filename, args = ...
@ -54,8 +54,11 @@ end
-- if url doesn't already belong to a file and has not already ".html" prefix
-- example:
-- core.cached_html;
local _cached_html -- cache action as it doesn't have parameters
local function cached_html()
local try_cached_html = action.lua.handler(basepath .. 'core__cached_html.lua')
if not _cached_html then
_cached_html = action.lua.handler(basepath .. 'core__cached_html.lua')
end
return action.when(physical.is_file:isnot(), action.when(physical.path:notsuffix('.html'), try_cached_html))
end