Modul:Vorlage:LuaModuleDoc: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
update
wp>PerfektesChaos (update) |
wp>PerfektesChaos (update) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2013-05- | --[=[ 2013-05-10 | ||
Support {{LuaModuleDoc}} | Support {{LuaModuleDoc}} | ||
* nav() | * nav() | ||
Zeile 7: | Zeile 7: | ||
local import, LuaWiki = pcall( require, " | -- Module globals | ||
local import, LuaWiki = pcall( require, "Module:LuaWiki" ) | |||
local currentTitle | |||
Zeile 52: | Zeile 54: | ||
-- args.pageNav defined | -- args.pageNav defined | ||
-- Uses: | -- Uses: | ||
-- >< currentTitle | |||
-- LuaWiki.getArg() | -- LuaWiki.getArg() | ||
-- LuaWiki.transclude() | -- LuaWiki.transclude() | ||
Zeile 58: | Zeile 61: | ||
-- navError() | -- navError() | ||
local r = LuaWiki.transclude( swift, collect ) | local r = LuaWiki.transclude( swift, collect ) | ||
local s = | local s = false | ||
if not | local t = currentTitle.talkPageTitle | ||
if t then | |||
s = t.exists | |||
end | |||
if not s then | |||
if super then | if super then | ||
s = "NoTalkCentral" | s = "NoTalkCentral" | ||
Zeile 142: | Zeile 149: | ||
-- super -- string; central documentation root | -- super -- string; central documentation root | ||
-- Return: | -- Return: | ||
-- table: args for navigation | -- table: args for navigation template | ||
-- [1] basic module name | -- [1] basic module name | ||
-- [2] number of language codes + 1 | -- [2] number of language codes + 1 | ||
Zeile 156: | Zeile 163: | ||
local r = { } | local r = { } | ||
local specified = LuaWiki.getArg( "langsRequest", false ) | local specified = LuaWiki.getArg( "langsRequest", false ) | ||
if type( specified ) == "string" then | |||
if specified:match( "^%s*$" ) then | |||
specified = false | |||
end | |||
end | |||
navLang( LuaWiki.getArg( "langsDefault" ), | navLang( LuaWiki.getArg( "langsDefault" ), | ||
r, | r, | ||
specified ) | |||
navLang( specified, r, false ) | navLang( specified, r, false ) | ||
if #r < 1 then | if #r < 1 then | ||
Zeile 193: | Zeile 205: | ||
-- Uses: | -- Uses: | ||
-- LuaWiki.getArg() | -- LuaWiki.getArg() | ||
-- navError() | -- navError() | ||
-- navLangs() | -- navLangs() | ||
Zeile 202: | Zeile 213: | ||
local light = false | local light = false | ||
local script | local script | ||
local story = | local story = currentTitle.text .. "/" | ||
if lead then | if lead then | ||
-- any template transclusion happens on a doc page | -- any template transclusion happens on a doc page | ||
Zeile 245: | Zeile 256: | ||
-- Start execution; return navigation text; analyze namespace | -- Start execution; return navigation text; analyze namespace | ||
-- Uses: | -- Uses: | ||
-- | -- >< currentTitle | ||
-- LuaWiki.getArg() | -- LuaWiki.getArg() | ||
-- | -- mw.title.getCurrentTitle() | ||
-- navPage() | -- navPage() | ||
-- navError() | -- navError() | ||
local r | local r | ||
local nsDocs = LuaWiki.getArg( "nsDocs" ) | |||
local nsDocs = | |||
if nsDocs then | if nsDocs then | ||
local ns = | currentTitle = mw.title.getCurrentTitle() | ||
local ns = currentTitle.namespace | |||
local lead = ( ns == mw.site.namespaces.Module.id ) | local lead = ( ns == mw.site.namespaces.Module.id ) | ||
nsDocs = tonumber( nsDocs ) | nsDocs = tonumber( nsDocs ) |