Modul:Vorlage:Phab: Unterschied zwischen den Versionen
2018-07-15
K (1 Version importiert: Module) |
wp>PerfektesChaos (2018-07-15) |
||
Zeile 1: | Zeile 1: | ||
local Serial = " | local Serial = "2018-07-15" | ||
--[=[ | --[=[ | ||
{{Template:Phab}} | {{Template:Phab}} | ||
Zeile 386: | Zeile 386: | ||
local function phabDiffusion( action, assembly, adopt, attach, | local function phabDiffusion( action, assembly, adopt, attach, | ||
anchor, against, frame ) | anchor, against, as, frame ) | ||
-- Create path for Phabricator Diffusion since 2015-03 | -- Create path for Phabricator Diffusion since 2015-03 | ||
-- Precondition: | -- Precondition: | ||
Zeile 395: | Zeile 395: | ||
-- anchor -- string; line number (or empty) | -- anchor -- string; line number (or empty) | ||
-- against -- string; diff ./. previous ID (or empty) | -- against -- string; diff ./. previous ID (or empty) | ||
-- as -- string; s = query | |||
-- frame -- object or nil | -- frame -- object or nil | ||
-- Postcondition: | -- Postcondition: | ||
Zeile 471: | Zeile 472: | ||
sub = string.format( "%s$%s", sub, anchor ) | sub = string.format( "%s$%s", sub, anchor ) | ||
end | end | ||
end | |||
if as then | |||
sub = string.format( "%s?%s", sub, as ) | |||
end | end | ||
end | end | ||
Zeile 538: | Zeile 542: | ||
local jump = false | local jump = false | ||
local last = false | local last = false | ||
local query = false | |||
local scope = "mediawiki/core" | local scope = "mediawiki/core" | ||
local show | local show | ||
Zeile 554: | Zeile 559: | ||
swift = r | swift = r | ||
source = args[ swift ] | source = args[ swift ] | ||
if args.file then | |||
local suffix = args.file:match( "%.(%l+)$" ) | |||
if suffix then | |||
if suffix == "svg" then | |||
query = "as=source&highlight=xml&" | |||
elseif suffix == "json" or | |||
suffix == "txt" or | |||
suffix == "xml" then | |||
query = "?" | |||
end | |||
if query then | |||
query = query .. "blame=off" | |||
end | |||
if suffix == "md" then | |||
query = "as=remarkup" | |||
end | |||
end | |||
end | |||
end | end | ||
r = lonely( args, { "commit", "commitdiff" } ) | r = lonely( args, { "commit", "commitdiff" } ) | ||
Zeile 579: | Zeile 602: | ||
end | end | ||
error( r, 0 ) | error( r, 0 ) | ||
elseif args.line then | |||
if args.diff then | if args.diff then | ||
r = "No ''line'' on ''diff'' page available" | r = "No ''line'' on ''diff'' page available" | ||
Zeile 612: | Zeile 634: | ||
end | end | ||
r, show = phabDiffusion( swift, scope, slot, source, jump, since, | r, show = phabDiffusion( swift, scope, slot, source, jump, since, | ||
frame ) | query, frame ) | ||
if args.title and ( args.title ~= "" ) then | if args.title and ( args.title ~= "" ) then | ||
show = args.title | show = args.title |