[[<link>|<label>]] → [[<link>]] when <link> and <label> are same value

This commit is contained in:
Trappist the monk 2026-10-26 03:48:00 +13:00 • committed by Jonathan Harker
parent 4724cd3c55
commit ca015c4f68

View file

@ -1019,9 +1019,12 @@ local function _cite_q (citeq_args)
citeq_args['name-list-style'] = nil
end
-- clean up any blank parameters
for k, v in pairs(citeq_args) do
if v == "" then citeq_args[k] = nil end
if v == "" then citeq_args[k] = nil end -- remove blank parameters
local link = v:match ('%[%[([^|]+)|%1%]%]'); -- get <link> from <v> wikilink [[<link>|<label>]] when <link> and <label> are same value
if link then -- and if <link> and <label> are the same thing
citeq_args[k] = '[[' .. link .. ']]'; -- rewrite <v> as [[<link>]]
end
end
-- if |expand=<anything>, write a nowiki'd version to see what the {{citation}} template call looks like