Module:BibCall: Difference between revisions

From Tsadra Commons
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 4: Line 4:


local dataTable = mw.ext.externalData.getExternalData{
local dataTable = mw.ext.externalData.getExternalData{
url = 'https://khyentselineage.tsadra.org/index.php?title=Special%3AAsk&q=' .. mw.uri.encode( '[[Category:People]]' ) .. '&po=MainNamePhon&p%5Bmainlabel%5D=Page&p%5Blimit%5D=10&p%5Bformat%5D=csv',
url = 'https://kb.tsadra.org/index.php?title=Special%3AAsk&q=' .. mw.uri.encode( '[[Category:Knowledge Base Articles]]' ) .. '&po=CreatedBy&p%5Bmainlabel%5D=Page&p%5Blimit%5D=10&p%5Bformat%5D=csv',
data = { MainNamePhon = 'MainNamePhon', Pagename = 'Page' }
data = { CreatedBy = 'CreatedBy', Pagename = 'Page' }
}
}


Line 12: Line 12:
for key, value in ipairs(dataTable) do
for key, value in ipairs(dataTable) do


displayedTable = displayedTable .. '<tr><td>' .. value['Pagename'] .. '</td><td>' .. value['MainNamePhon'] .. '</td></tr>'
displayedTable = displayedTable .. '<tr><td>' .. value['Pagename'] .. '</td><td>' .. value['CreatedBy'] .. '</td></tr>'


end
end

Revision as of 18:43, 2 September 2023

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

local p = {}

function p.getBiblioEntries(frame)

	local dataTable = mw.ext.externalData.getExternalData{
		url = 'https://kb.tsadra.org/index.php?title=Special%3AAsk&q=' .. mw.uri.encode( '[[Category:Knowledge Base Articles]]' ) .. '&po=CreatedBy&p%5Bmainlabel%5D=Page&p%5Blimit%5D=10&p%5Bformat%5D=csv',
		data = { CreatedBy = 'CreatedBy', Pagename = 'Page' }
	}

	local displayedTable = '<table class="smwtable-clean border sortable tsdwiki-depth-1"><tr><th>Page</th><th>Citation</th></tr>'

	for key, value in ipairs(dataTable) do

		displayedTable = displayedTable .. '<tr><td>' .. value['Pagename'] .. '</td><td>' .. value['CreatedBy'] .. '</td></tr>'

	end

	displayedTable = displayedTable .. '</table>'

	return displayedTable

end

return p