Moduł:a tergo: Różnice pomiędzy wersjami
[wersja przejrzana] | [wersja przejrzana] |
Usunięta treść Dodana treść
Nie podano opisu zmian |
m mw.site.namespaces[ 14 ].name |
||
(Nie pokazano 2 pośrednich wersji utworzonych przez tego samego użytkownika) | |||
Linia 1: | Linia 1: | ||
local p = {} |
local p = {} |
||
function reverse( text ) |
function p.reverse( text ) |
||
⚫ | |||
if type( text ) == 'table' and text == mw.getCurrentFrame() then |
|||
⚫ | |||
text = text.args[ 1 ] |
|||
⚫ | |||
end |
|||
return s |
|||
assert( type( text ) == 'string' ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
end |
|||
return table.concat( s ) |
|||
end |
end |
||
function p.categorize( frame ) |
|||
function p.categorize( language, title ) |
|||
local categoryPage = mw.title.makeTitle( |
|||
mw.site.namespaces[ 14 ].name, -- Kategoria |
|||
if currentPage.namespace ~= 0 then |
|||
language .. ' (indeks a tergo)' |
|||
return "" |
|||
) |
|||
end |
|||
local categoryPage = mw.title.makeTitle( "Kategoria", language .. " (indeks a tergo)" ) |
|||
if not categoryPage.exists then |
|||
return '' |
|||
end |
|||
return "[[" .. categoryPage.fullText .. "|" .. mw.ustring.lower( reverse( currentPage.text ) ) .. "]]" |
|||
return mw.ustring.format( '[[%s|%s]]', |
|||
categoryPage.fullText, |
|||
mw.ustring.lower( p.reverse( title ) ) |
|||
) |
|||
end |
end |
||
return p |
return p |
Wersja z 16:01, 8 kwi 2015
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:a tergo/opis
local p = {}
function p.reverse( text )
if type( text ) == 'table' and text == mw.getCurrentFrame() then
text = text.args[ 1 ]
end
assert( type( text ) == 'string' )
local s = {}
for codepoint in mw.ustring.gcodepoint( text ) do
table.insert( s, 1, mw.ustring.char( codepoint ) )
end
return table.concat( s )
end
function p.categorize( language, title )
local categoryPage = mw.title.makeTitle(
mw.site.namespaces[ 14 ].name, -- Kategoria
language .. ' (indeks a tergo)'
)
if not categoryPage.exists then
return ''
end
return mw.ustring.format( '[[%s|%s]]',
categoryPage.fullText,
mw.ustring.lower( p.reverse( title ) )
)
end
return p