Module:Submit an edit request: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
avoid creating duplicate section headers, per talk
bypass redirect
 
(10 intermediate revisions by 6 users not shown)
Line 17:
template = 'template',
full = 'full',
interface = 'interface',
manual = 'manual'
}
 
Line 28 ⟶ 29:
return mw.message.newRawMessage(msg):params(params):plain()
end
end
 
local function isTranscludedOnMainPage(titleObj)
local mainPage = message('main-page')
for i, source in ipairs(titleObj.cascadingProtection.sources) do
if source == mainPage then
return true
end
end
return false
end
 
Line 59 ⟶ 50:
function p.makeRequestUrl(level, titleObj)
titleObj = titleObj or mw.title.getCurrentTitle()
local basePage = titleObj.basePageTitle.fullText
if isTranscludedOnMainPage(titleObj) then
if cfg['main-page-content'][basePage] then
return tostring(mw.uri.fullUrl(message('main-page-request-page')))
end
 
local talkPageName = resolveRedirect(titleObj.talkPageTitle.prefixedText)
local talkPageName = titleObj.talkPageTitle
if talkPageName == nil then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
end
local talkPageName = resolveRedirect(titleObj.talkPageTitletalkPageName.prefixedText)
if isProtected(talkPageName) then
return tostring(mw.uri.fullUrl(message('protected-talk-page-request-page')))
end
level = validateLevel(level)
if sourcelevel == mainPage'manual' then
return tostring(mw.uri.fullUrl(talkPageName, {
action = 'edit',
section = 'new'
}))
end
local sectionname = message(
'preload-title-text',
Line 73 ⟶ 76:
)
local content = mw.title.new(talkPageName):getContent()
if content and content:find("== *" .. escape(sectionname) .. " *==") then
local dedup = 2
while true do
Line 113 ⟶ 116:
 
function p._button(args)
return require('Module:Clickable button 2').luaMainmain{
[1] = args.display or message('default-display-value'),
url = p.makeRequestUrl(args.type),