More fixes.

This commit is contained in:
kaeza 2013-08-20 19:33:44 -03:00
parent ba830602e5
commit d68833abdc
4 changed files with 28 additions and 2 deletions

View File

@ -21,6 +21,7 @@ pages from the mod interface.
See also:
* [.Tags]
* [.License]
* [.Help Index]
]],
----------------------------------------------------------------
----------------------------------------------------------------
@ -79,6 +80,7 @@ The specified internal page cannot be found. You may want to:
This page does not exist yet.
* Back to [Main].
* Go to [.Help Index].
]],
----------------------------------------------------------------
----------------------------------------------------------------
@ -86,6 +88,7 @@ This page does not exist yet.
The page name you entered is wrong. See [.Page Names] for more info.
* Back to [Main].
* Go to [.Help Index].
]],
----------------------------------------------------------------
----------------------------------------------------------------
@ -93,10 +96,13 @@ The page name you entered is wrong. See [.Page Names] for more info.
You have not enough privileges to view this page.
* Back to [Main].
* Go to [.Help Index].
]],
----------------------------------------------------------------
----------------------------------------------------------------
[".Help Index"] = [[
* [.Intro]
* [.Plugins]
* [.Page Names]
* [.User Pages]
@ -141,4 +147,18 @@ use it to write down secret locations, etc.
]],
----------------------------------------------------------------
----------------------------------------------------------------
[".Plugins"] = function()
local page = "Installed Plugins:\n\n"
for _,plugin in ipairs(wikilib.registered_plugins) do
page = page.." * "..plugin.description.."\n"
end
page = (page
.. "\n"
.. " * Back to [.Help Index].\n"
.. " * Back to [Main].\n"
)
return page
end,
----------------------------------------------------------------
----------------------------------------------------------------
}

View File

@ -17,7 +17,7 @@ end
wikilib.register_plugin({
regex = "^/ml/.*",
description = "Mailing List",
description = "Mailing List [/ml/recent]",
load_page = function(entry, player) --> text, allow_save
local state = get_player_state(player)
local what = entry:match("^/ml/(.*)")

View File

@ -3,6 +3,7 @@
plugindef = {
regex = "^/foo/bar/.*",
description = "My Awesome Plugin",
^ Can contain links
load_page = func(entry, player),
^ Must return text, allow_save
save_page = func(entry, player),
@ -31,3 +32,5 @@ end
function wikilib.plugin_handle_save(entry, player, text)
return do_handle("save_page", entry, player, text)
end
wikilib.registered_plugins = plugin_defs

View File

@ -28,6 +28,9 @@ local function get_page_path(name, player) --> path, is_file, allow_save
if name:sub(1, 1) == "." then
local text = wikilib.internal_pages[name] or wikilib.internal_pages[".NotFound_Internal"]
if type(text) == "function" then
text = text(player)
end
return text, false, false
elseif name:sub(1, 1) == ":" then
if name:match("^:[0-9]?$") then
@ -233,5 +236,5 @@ function wikilib.handle_formspec(player, formname, fields)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
wikilib.handle_formspec(player, formspec, fields)
wikilib.handle_formspec(player, formname, fields)
end)