Módulo:Book: diferenças entre revisões
[edição verificada] | [edição verificada] |
Conteúdo apagado Conteúdo adicionado
Desfez a edição 269240 de Helder.wiki (Discussão) + if not value then return nil end |
Uso de getArgs nas funções que implementam a Predefinição:NOMEDOLIVRO, a Predefinição:NOMEDOCAPÍTULO e a Predefinição:EXISTBASEPAGENAME; simplificação |
||
Linha 1:
local getArgs = require('Module:Arguments').getArgs
local collectionPrefix = 'Wikilivros:Livros/'
local arraySearch = function ( needle, haystack )
for k,v in pairs( haystack ) do
Linha 9 ⟶ 10:
return result;
end
local function getArgNums(args)
-- Returns an array containing the keys of all positional arguments that contain data (i.e. non-whitespace values).
Linha 21 ⟶ 23:
end
-- [[Predefinição:NOMEDOLIVRO]]
local getBookName = function ( page )
page = page or mw.title.getCurrentTitle().text
Linha 26 ⟶ 29:
if pos == nil then
return page
return mw.ustring.sub( page, 1, pos - 1 )▼
end
end
-- [[Predefinição:NOMEDOCAPÍTULO]]
local getChapterName = function ( page )
page = page or mw.title.getCurrentTitle().text
Linha 36 ⟶ 39:
if pos == nil then
return ''
return mw.ustring.sub( page, pos + 1 )▼
end
end
Linha 243 ⟶ 245:
_core = core,
getBookName = function( frame )
return getBookName( args[1] )
end,
getChapterName = function( frame )
return getChapterName( args[1] )
end,
getExistingBasePageName = function( frame )
return getExistingBasePageName( args[1] )
end,
getPrintableVersion = function( frame )
|