Module:Link capture: Difference between revisions

(Created page with "local p = {} function p.linkcapture(frame) local linkString = frame.args[1] or "" local linkText = string.match(linkString, "%[%[([^%]]+)%]%]") local linkTextText = string.match(linkString, "%[%[[^%|]+%|([^%}]+)%]%]") if (linkTextText ~= nil) then return linkTextText elseif (linkText ~= nil) then return linkText else return linkString end end return p")
m (1 revision imported: Vulture update)
 

Latest revision as of 08:18, 11 March 2023

Module documentation[view][edit][history][purge]
This documentation is transcluded from Module:Link capture/doc. Changes can be proposed in the talk page.
Function list
L 2 — p.linkcapture

Module:Link capture implements the {{Link capture}} template.


local p = {}
function p.linkcapture(frame)
    local linkString = frame.args[1]  or ""
    local linkText = string.match(linkString, "%[%[([^%]]+)%]%]")
    local linkTextText = string.match(linkString, "%[%[[^%|]+%|([^%}]+)%]%]")
    
    if (linkTextText ~= nil) then
    	return linkTextText
    elseif (linkText ~= nil) then
    	return linkText
    else
    	return linkString
	end
end

return p