Moduł:a tergo: Porōwnanie wersyji
| Linijŏ 18: | Linijŏ 18: | ||
function p.categorize( language, title ) | function p.categorize( language, title ) | ||
local categoryPage = mw.title.makeTitle( | local categoryPage = mw.title.makeTitle( | ||
| − | mw.site.namespaces[ 14 ].name, -- | + | mw.site.namespaces[ 14 ].name, -- Kategoria |
language .. ' (indeks a tergo)' | language .. ' (indeks a tergo)' | ||
) | ) | ||
Teroźnŏ wersyjŏ na dziyń 21:11, 21 mŏj 2020
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