Documentation for this module may be created at Module:Worldbuilders/doc
local p = {}
function p.getWorldbuilderSection(frame)
-- Get the title of the current page
local pageTitle = mw.title.getCurrentTitle().text
-- Fetch the content of the Talk page
local talkPageTitle = 'Talk:' .. pageTitle
local talkPage = mw.title.new(talkPageTitle)
local talkContent = talkPage:getContent()
-- Check if the Talk page exists and has content
if not talkContent then
return 'No content found in Talk page.'
end
-- Extract the Worldbuilder section
local sectionPattern = '==%s*Worldbuilder%s*==(.*)'
local worldbuilderSection = talkContent:match(sectionPattern)
-- Check if the Worldbuilder section exists
if not worldbuilderSection then
return 'No Worldbuilder section found.'
end
-- Return the Worldbuilder section content
return worldbuilderSection
end
return p
