Module:Sandbox/RobLa/Foo

local str = require( 'Module:StringHelper' ) local p = {}

-- generate a bulleted list of section headings extracted from a page. -- the page is passed as the first argument. -- example: function p.captions( frame ) local title = frame.args[1] local page = mw.title.new( title ) local content = page:getContent local captions = '' for line in str.lines( content ) do       if str.startswith(line, '== ') and str.endswith(line, ' ==') then item = '* ' .. str.strip( line, '= ') .. '\n' captions = captions .. item end end

return captions end return p