Module:GetWorks: Difference between revisions
From Rinchen Terdzö
((by SublimeText.Mediawiker)) |
((by SublimeText.Mediawiker)) |
||
Line 16: | Line 16: | ||
end | end | ||
local output = '<h2><span id="TotalCount">' .. #qRes .. '</span> Works in the Rinchen Terdzö</h2>' .. | local output = '<h2><span id="TotalCount">' .. #qRes .. '</span> Works in the Rinchen Terdzö</h2>' | ||
local fltrInput = mw.html.create( 'input' ) | |||
fltrInput | |||
:attr( 'type', 'text' ) | |||
:attr( 'id', 'filterInput' ) | |||
:attr( 'class', 'filter-input' ) | |||
:attr( 'placeholder', 'Filter content...' ) | |||
output = output .. fltrInput | |||
if type( qRes ) == "table" then | if type( qRes ) == "table" then |
Revision as of 08:08, 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|sort=Volumenumber,Textnuminvol|order=asc,asc' )
if qRes == nil then
return "No results!"
end
local output = '<h2><span id="TotalCount">' .. #qRes .. '</span> Works in the Rinchen Terdzö</h2>'
local fltrInput = mw.html.create( 'input' )
fltrInput
:attr( 'type', 'text' )
:attr( 'id', 'filterInput' )
:attr( 'class', 'filter-input' )
:attr( 'placeholder', 'Filter content...' )
output = output .. fltrInput
if type( qRes ) == "table" then
for k, data in ipairs( qRes ) do
output = output .. '<div class="filterable"><div class="d-inline-block float-left pt-2">Vol. ' .. data.Volumenumber .. ', Text ' .. data.Textnuminvol .. ': </div><div class="d-inline-block"><span style="font-size: 1.5em;">[[' .. data.Page .. '|' .. data.Fulltitletib .. ']]</span><div>' .. data.Fulltitle .. '</div></div></div>'
end
return output
end
return output
end
return p