Модуль:PagesWithScans

Матеріал з Вікіджерел

Документацію для цього модуля можна створити у Модуль:PagesWithScans/документація

-- uk.wikisource.org/wiki/User:Leh_Palych

local ps = {}

function ps.category( frame )
	local objTitle, cTxt, nPos, nPos1, nPos2, i, yes_no
	local text_find = {'<pagesindex','{{#lst','{{#section'}

	objTitle = mw.title.getCurrentTitle()

	cTxt = objTitle:getContent()
	cTxt = mw.ustring.lower(mw.ustring.gsub(cTxt, ' ', ''))
	
	yes_no = false
	for i = 1, 3 do
		nPos = mw.ustring.find(cTxt, text_find[i], 1, true)
		if nPos ~= nil then
			yes_no = true
			break
		end
	end

	if yes_no then
			return '[[Категорія:Сторінки з трансклюзією]]'
	else
		nPos1 = mw.ustring.find(cTxt, '{{версії', 1, true)
		nPos2 = mw.ustring.find(cTxt, '{{неоднозначність', 1, true)

		if nPos1 ~= nil or nPos2 ~= nil then
			return ''
		else
			return '[[Категорія:Сторінки без трансклюзії]]'
		end
	end

end

return ps