Documentation for this module may be created at Module:Sandbox/trappist the monk/get lead section/doc

p={}
function p.get_lead_section (frame)
	local title_object = mw.title.new (frame.args[1]);							-- get a title object for named article
	local content = title_object:getContent();									-- get the unparsed article content
	local text = mw.ustring.match (content, '(.-)==+');							-- get everything from start to first section header '=='

	return frame:preprocess (text);												-- return the preprocessed text;
end

return p;