Module:GetWorks: Difference between revisions

From Rinchen Terdzö
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 10: Line 10:
local pagename = mw.title.getCurrentTitle().text
local pagename = mw.title.getCurrentTitle().text


     local qRes = mw.smw.ask( '[[Category:Tibetan Texts]][[Category:' .. pagename .. ']]OR[[Category:Illustrations]][[Category:' .. pagename .. ']]|?#-=Page|?fulltitletib|?volumenumber|?textnuminvol|?fulltitle|limit=1008' )
     local qRes = mw.smw.ask( '[[Category:Tibetan Texts]][[Category:' .. pagename .. ']]OR[[Category:Illustrations]][[Category:' .. pagename .. ']]|?#-=Page|?fulltitletib|?volumenumber|?textnuminvol|?fulltitle|limit=1008|link=none' )


     if qRes == nil then
     if qRes == nil then

Revision as of 08:58, 9 April 2024

Documentation for this module may be created at Module:GetWorks/doc

local p = {}

function p.main(frame)

    if not mw.smw then
        return "Semantic Scribunto is not installed."
    end

	local pArgs = frame:getParent().args
	local pagename = mw.title.getCurrentTitle().text

    local qRes = mw.smw.ask( '[[Category:Tibetan Texts]][[Category:' .. pagename .. ']]OR[[Category:Illustrations]][[Category:' .. pagename .. ']]|?#-=Page|?fulltitletib|?volumenumber|?textnuminvol|?fulltitle|limit=1008|link=none' )

    if qRes == nil then
        return "No results!"
    end

    local output = '<h2><span id="TotalCount">' .. #qRes .. '</span> Works in the Rinchen Terdzö</h2><input type="text" id="filterInput" class="filter-input" placeholder="Filter content...">'

	if type( qRes ) == "table" then
        for k, data in pairs( qRes ) do
            output = output .. data.Page
        end
        return output
    end

    return output

end

return p