Module:Excerpt and Module:Excerpt/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
imported>Sophivorus
Update to latest: refine error handling for invalid titles, make some methods local, add Aidan9382 as author, remove old reference to fragment param
 
imported>Sophivorus
Add "editintro" param
 
Line 4: Line 4:
-- License: CC-BY-SA-3.0
-- License: CC-BY-SA-3.0


local Transcluder = require( 'Module:Transcluder' )
local Transcluder = require( 'Module:Transcluder/sandbox' )


local yesno = require( 'Module:Yesno' )
local yesno = require( 'Module:Yesno' )


local ok, config = pcall( require, 'Module:Excerpt/config' )
local ok, config = pcall( require, 'Module:Excerpt/config/sandbox' )
if not ok then config = {} end
if not ok then config = {} end


Line 58: Line 58:
local hat = yesno( getArg( 'hat', true ) )
local hat = yesno( getArg( 'hat', true ) )
local edit = yesno( getArg( 'edit', true ) )
local edit = yesno( getArg( 'edit', true ) )
local editintro = getArg( 'editintro' )
local this = getArg( 'this' )
local this = getArg( 'this' )
local only = getArg( 'only' )
local only = getArg( 'only' )
Line 96: Line 97:
end
end
if edit then
if edit then
local editUrl = title:fullUrl( 'action=edit' );
if editintro then
editUrl = title:fullUrl( 'action=edit&editintro=' .. editintro )
end
hat = hat .. '<span class="mw-editsection-like plainlinks"><span class="mw-editsection-bracket">[</span>['
hat = hat .. '<span class="mw-editsection-like plainlinks"><span class="mw-editsection-bracket">[</span>['
hat = hat .. title:fullUrl( 'action=edit' ) .. ' ' .. mw.message.new( 'editsection' ):plain()
hat = hat .. editUrl .. ' ' .. mw.message.new( 'editsection' ):plain()
hat = hat .. ']<span class="mw-editsection-bracket">]</span></span>'
hat = hat .. ']<span class="mw-editsection-bracket">]</span></span>'
end
end