Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Test: Difference between revisions

From ProleWiki, the proletarian encyclopedia
m (Testing length operator)
m (Testing capture of headers)
Line 3: Line 3:
local pageContent = tostring(mw.title.getCurrentTitle():getContent())
local pageContent = tostring(mw.title.getCurrentTitle():getContent())
local pageLines = mw.text.split(pageContent,'\n',true)
local pageLines = mw.text.split(pageContent,'\n',true)
return #pageLines
local render = ''
for i=1,#pageLines do
if mw.text.split(pageLines[i], '%s')[1] == '==' then
render = render + pageLines[i]
end
end
return render
end
end
return p
return p

Revision as of 17:53, 14 April 2024

local p = {}
function p.test( frame )
	local pageContent = tostring(mw.title.getCurrentTitle():getContent())
	local pageLines = mw.text.split(pageContent,'\n',true)
	local render = ''
	for i=1,#pageLines do
		if mw.text.split(pageLines[i], '%s')[1] == '==' then
			render = render + pageLines[i]
		end
	end
	return render
end
return p