Jump to content

Module:Legislationuk/test

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Theknightwho (talk | contribs) at 06:01, 19 January 2022 (Created page with 'local p = {} function p.maintest( frame ) if frame:getParent().args[ 1 ] then args = frame:getParent().args else args = frame.args end local qid = "" local o = "" local leg = {} for _,v in pairs( args ) do qid = args[ _ ] leg[ 1 ] = mw.wikibase.getBestStatements( qid, 'P1813' )[1]["mainsnak"]["datavalue"]["value"]["text"] leg[ 2 ] = mw.wikibase.getBestStatements( qid, 'P1448' )[1]["mainsnak"]["datavalue"]["value"]["text"] leg[ 3 ] = mw.ustring...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.maintest( frame )
	if frame:getParent().args[ 1 ] then args = frame:getParent().args else args = frame.args end
	local qid = ""
	local o = ""
	local leg = {}
	for _,v in pairs( args ) do
		qid = args[ _ ]
		leg[ 1 ] = mw.wikibase.getBestStatements( qid, 'P1813' )[1]["mainsnak"]["datavalue"]["value"]["text"]
		leg[ 2 ] = mw.wikibase.getBestStatements( qid, 'P1448' )[1]["mainsnak"]["datavalue"]["value"]["text"]
		leg[ 3 ] = mw.ustring.sub( mw.wikibase.getBestStatements( qid, 'P7589' )[1]["mainsnak"]["datavalue"]["value"]["time"], 2, 11 )
		leg[ 3 ] = os.time { day = tonumber( mw.ustring.sub( leg[ 3 ], 9, 10 ) ), month = tonumber( mw.ustring.sub( leg[ 3 ], 6, 7 ) ), year = tonumber( mw.ustring.sub( leg[ 3 ], 1, 4 ) ) }
		o = o .. leg[ 1 ] ..", " .. os.date( "*t", leg[ 3 ] ).day .. " " .. os.date( "%B %Y", leg[ 3 ] ) .. ", " .. leg[ 2 ] .. "<br/>"
	end
	return o
end

return p