Moduł:a tergo
Wersyjo ze dnia 21:07, 21 mŏj 2020 autorstwa Grzegorz Kulik (dyskusyjŏ | wkłŏd) (Stworzōnŏ nowõ strōnã: "local p = {} function p.reverse( text ) if type( text ) == 'table' and text == mw.getCurrentFrame() then text = text.args[ 1 ] end assert( type( text ) == 's...")
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