More fixes.
This commit is contained in:
parent
ba830602e5
commit
d68833abdc
20
internal.lua
20
internal.lua
@ -21,6 +21,7 @@ pages from the mod interface.
|
|||||||
See also:
|
See also:
|
||||||
* [.Tags]
|
* [.Tags]
|
||||||
* [.License]
|
* [.License]
|
||||||
|
* [.Help Index]
|
||||||
]],
|
]],
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
@ -79,6 +80,7 @@ The specified internal page cannot be found. You may want to:
|
|||||||
This page does not exist yet.
|
This page does not exist yet.
|
||||||
|
|
||||||
* Back to [Main].
|
* 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.
|
The page name you entered is wrong. See [.Page Names] for more info.
|
||||||
|
|
||||||
* Back to [Main].
|
* 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.
|
You have not enough privileges to view this page.
|
||||||
|
|
||||||
* Back to [Main].
|
* Back to [Main].
|
||||||
|
* Go to [.Help Index].
|
||||||
]],
|
]],
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
[".Help Index"] = [[
|
[".Help Index"] = [[
|
||||||
|
* [.Intro]
|
||||||
|
* [.Plugins]
|
||||||
* [.Page Names]
|
* [.Page Names]
|
||||||
* [.User Pages]
|
* [.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,
|
||||||
|
----------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ end
|
|||||||
|
|
||||||
wikilib.register_plugin({
|
wikilib.register_plugin({
|
||||||
regex = "^/ml/.*",
|
regex = "^/ml/.*",
|
||||||
description = "Mailing List",
|
description = "Mailing List [/ml/recent]",
|
||||||
load_page = function(entry, player) --> text, allow_save
|
load_page = function(entry, player) --> text, allow_save
|
||||||
local state = get_player_state(player)
|
local state = get_player_state(player)
|
||||||
local what = entry:match("^/ml/(.*)")
|
local what = entry:match("^/ml/(.*)")
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
plugindef = {
|
plugindef = {
|
||||||
regex = "^/foo/bar/.*",
|
regex = "^/foo/bar/.*",
|
||||||
description = "My Awesome Plugin",
|
description = "My Awesome Plugin",
|
||||||
|
^ Can contain links
|
||||||
load_page = func(entry, player),
|
load_page = func(entry, player),
|
||||||
^ Must return text, allow_save
|
^ Must return text, allow_save
|
||||||
save_page = func(entry, player),
|
save_page = func(entry, player),
|
||||||
@ -31,3 +32,5 @@ end
|
|||||||
function wikilib.plugin_handle_save(entry, player, text)
|
function wikilib.plugin_handle_save(entry, player, text)
|
||||||
return do_handle("save_page", entry, player, text)
|
return do_handle("save_page", entry, player, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
wikilib.registered_plugins = plugin_defs
|
||||||
|
@ -28,6 +28,9 @@ local function get_page_path(name, player) --> path, is_file, allow_save
|
|||||||
|
|
||||||
if name:sub(1, 1) == "." then
|
if name:sub(1, 1) == "." then
|
||||||
local text = wikilib.internal_pages[name] or wikilib.internal_pages[".NotFound_Internal"]
|
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
|
return text, false, false
|
||||||
elseif name:sub(1, 1) == ":" then
|
elseif name:sub(1, 1) == ":" then
|
||||||
if name:match("^:[0-9]?$") then
|
if name:match("^:[0-9]?$") then
|
||||||
@ -233,5 +236,5 @@ function wikilib.handle_formspec(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
wikilib.handle_formspec(player, formspec, fields)
|
wikilib.handle_formspec(player, formname, fields)
|
||||||
end)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user