×
Create a new article
Write your page title here:
We currently have 1,662 articles on The Quelmar Wiki. Type your article name above or click on one of the titles below and start writing!



The Quelmar Wiki

Editing Module:Worldbuilders

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 3: Line 3:
function p.getWorldbuilderSection(frame)
function p.getWorldbuilderSection(frame)
     -- Get the title of the current page
     -- Get the title of the current page
     local pageTitle = mw.title.getCurrentTitle().prefixedText
     local pageTitle = mw.title.getCurrentTitle().text


     -- Construct the Talk page URL
     -- Fetch the content of the Talk page
     local talkPageTitle = pageTitle:gsub(" ", "_")  -- Replace spaces with underscores
     local talkPageTitle = 'Talk:' .. pageTitle
     local baseWikiUrl = 'https://quelmarwiki.com/wiki/'
     local talkPage = mw.title.new(talkPageTitle)
     local talkPageUrl = baseWikiUrl .. 'Talk:' .. talkPageTitle
     local talkContent = talkPage:getContent()


     -- Construct the edit URL for adding the Worldbuilder section
     -- Define the URL for adding the Worldbuilder section
     local editSectionUrl = talkPageUrl .. '?action=edit&section=new&preloadtitle=Worldbuilders&preload=Template:WorldbuilderPreload'
     local addSectionParams = {
        action = 'edit',
        section = 'new',
        preloadtitle = 'Worldbuilders',
        preload = 'Template:WorldbuilderPreload' -- Assuming you have a template for preload content
    }
    local addSectionUrl = mw.uri.fullUrl(talkPageTitle, addSectionParams).full


     -- Link text
     -- Link text
     local addLinkText = 'Add worldbuilding credits now!'
     local addLinkText = 'Add worldbuilding credits now!'
    -- Fetch the content of the Talk page
    local talkPage = mw.title.new('Talk:' .. pageTitle)
    local talkContent = talkPage and talkPage:getContent() or nil


     -- Check if the Talk page exists and has content
     -- Check if the Talk page exists and has content
     if not talkContent or talkContent == '' then
     if not talkContent then
         return '[' .. editSectionUrl .. ' ' .. addLinkText .. ']'
         return '[' .. addSectionUrl .. ' ' .. addLinkText .. ']'
     end
     end


Line 31: Line 33:
     -- Check if the Worldbuilder section exists
     -- Check if the Worldbuilder section exists
     if not worldbuilderSection then
     if not worldbuilderSection then
         return '[' .. editSectionUrl .. ' ' .. addLinkText .. ']'
         return '[' .. addSectionUrl .. ' ' .. addLinkText .. ']'
     end
     end


Please note that all contributions to The Quelmar Wiki are considered to be released under the Creative Commons Attribution (see The Quelmar Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page:

Cookies help us deliver our services. By using our services, you agree to our use of cookies. (Hi Margarita's Table. 🇩🇪)
Cookies help us deliver our services. By using our services, you agree to our use of cookies. (Hi Margarita's Table. 🇩🇪)