Modul:Vorlage:Phab: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2015-04-04
wp>PerfektesChaos (2015-03-30) |
wp>PerfektesChaos (2015-04-04) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2015- | --[=[ 2015-04-04 | ||
{{Template:Phab}} | {{Template:Phab}} | ||
]=] | ]=] | ||
Zeile 35: | Zeile 35: | ||
-- .File | -- .File | ||
-- .Show | -- .Show | ||
-- .style | |||
-- Postcondition: | -- Postcondition: | ||
-- Returns string with bracketed external link, if fine | -- Returns string with bracketed external link, if fine | ||
Zeile 40: | Zeile 41: | ||
local r = args.File | local r = args.File | ||
local j = r:find( ",", 1, true ) | local j = r:find( ",", 1, true ) | ||
local n, params | local n, params, show | ||
if j then | if j then | ||
params = r:sub( j + 1 ) | params = r:sub( j + 1 ) | ||
Zeile 55: | Zeile 56: | ||
error( r, 0 ) | error( r, 0 ) | ||
end | end | ||
if args.Show then | if args.style then | ||
r = string.format( "[[phab:F%d|%s]]", n, | if args.Show then | ||
show = args.Show | |||
else | |||
show = string.format( "F%d", n ) | |||
end | |||
show = string.format( "<span style='%s'>%s</span>", | |||
args.style, show ) | |||
end | |||
if show then | |||
r = string.format( "[[phab:F%d|%s]]", n, show ) | |||
else | else | ||
r = string.format( "[[phab:F%d]]", n ) | r = string.format( "[[phab:F%d]]", n ) | ||
Zeile 174: | Zeile 184: | ||
-- .Mock | -- .Mock | ||
-- .Show | -- .Show | ||
-- .style | |||
-- Postcondition: | -- Postcondition: | ||
-- Returns string with bracketed external link, if fine | -- Returns string with bracketed external link, if fine | ||
Zeile 179: | Zeile 190: | ||
local r = args.Mock | local r = args.Mock | ||
local n = r:match( "^[Mm]?([0-9]+)$" ) | local n = r:match( "^[Mm]?([0-9]+)$" ) | ||
local show | |||
if n then | if n then | ||
n = tonumber( n ) -- discard leading zeros | n = tonumber( n ) -- discard leading zeros | ||
Zeile 185: | Zeile 197: | ||
error( r, 0 ) | error( r, 0 ) | ||
end | end | ||
if args.Show then | if args.style then | ||
r = string.format( "[[phab:M%d|%s]]", n, | if args.Show then | ||
show = args.Show | |||
else | |||
show = string.format( "M%d", n ) | |||
end | |||
show = string.format( "<span style='%s'>%s</span>", | |||
args.style, show ) | |||
end | |||
if show then | |||
r = string.format( "[[phab:M%d|%s]]", n, show ) | |||
else | else | ||
r = string.format( "[[phab:M%d]]", n ) | r = string.format( "[[phab:M%d]]", n ) | ||
Zeile 227: | Zeile 248: | ||
-- .Engage | -- .Engage | ||
-- .Show | -- .Show | ||
-- .style | |||
-- string; single ID | -- string; single ID | ||
-- Postcondition: | -- Postcondition: | ||
Zeile 259: | Zeile 281: | ||
if not show then | if not show then | ||
show = "#" .. s | show = "#" .. s | ||
end | |||
if args.style then | |||
show = string.format( "<span style='%s'>%s</span>", | |||
args.style, show ) | |||
end | end | ||
r = string.format( "%s[[phab:tag/%s|%s]]", | r = string.format( "%s[[phab:tag/%s|%s]]", | ||
Zeile 441: | Zeile 467: | ||
-- .User | -- .User | ||
-- .Show | -- .Show | ||
-- .style | |||
-- frame -- object or nil | -- frame -- object or nil | ||
-- Postcondition: | -- Postcondition: | ||
Zeile 458: | Zeile 485: | ||
if not frame then | if not frame then | ||
frame = mw.getCurrentFrame() | frame = mw.getCurrentFrame() | ||
end | |||
if args.style then | |||
show = string.format( "<span style='%s'>%s</span>", | |||
args.style, show ) | |||
end | end | ||
r = string.format( "[[phab:p/%s|%s]]", | r = string.format( "[[phab:p/%s|%s]]", | ||
Zeile 535: | Zeile 566: | ||
load = ( args.commit or args.commitdiff ) | load = ( args.commit or args.commitdiff ) | ||
if load then | if load then | ||
id40( slot ) | if scope ~= "SVN" then | ||
id40( slot ) | |||
end | |||
elseif args.diff then | elseif args.diff then | ||
since = args.diff | since = args.diff | ||
Zeile 592: | Zeile 625: | ||
-- .Anchor | -- .Anchor | ||
-- .Show | -- .Show | ||
-- .style | |||
-- Postcondition: | -- Postcondition: | ||
-- Returns string with bracketed external link, if fine | -- Returns string with bracketed external link, if fine | ||
Zeile 623: | Zeile 657: | ||
else | else | ||
show = string.format( "phab:T%d", n ) | show = string.format( "phab:T%d", n ) | ||
if | if args.Anchor then | ||
show = string.format( "%s #%s", show, | show = string.format( "%s #%s", show, args.Anchor ) | ||
end | end | ||
end | |||
if args.style then | |||
show = string.format( "<span style='%s'>%s</span>", | |||
args.style, show ) | |||
end | end | ||
r = string.format( "[[phab:T%d%s|%s]]", n, sub, show ) | r = string.format( "[[phab:T%d%s|%s]]", n, sub, show ) | ||
Zeile 743: | Zeile 781: | ||
local got = { } | local got = { } | ||
local mode = 0 | local mode = 0 | ||
local params = { Anchor = 1, | local params = { style = 0, | ||
Anchor = 1, | |||
Anchor = 1, | |||
Bugzilla = 1, | Bugzilla = 1, | ||
Countdown = 1, | Countdown = 1, | ||
Zeile 800: | Zeile 840: | ||
mode = 2 | mode = 2 | ||
got[ 2 ] = { } | got[ 2 ] = { } | ||
end | |||
if got[ 0 ] then | |||
for k, v in pairs( got[ 0 ] ) do | |||
got[ mode ][ k ] = v | |||
end -- for k, v | |||
end | end | ||
got = got[ mode ] | got = got[ mode ] |