Module:links: Difference between revisions

169 bytes removed ,  25 August 2023
m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
m (Added test thing, will remove later)
mNo edit summary
Line 8: Line 8:
local alt = data.alt or data.term
local alt = data.alt or data.term
if data.language.proto and "Appendix:" .. data.language.name .. "/" .. data.term == mw.title.getCurrentTitle().prefixedText then
if data.language and data.language.proto then
alt = "*" .. alt
link = "Appendix:" .. data.language.name .. "/" .. data.term
elseif data.language then
link = link .. "#" .. string.gsub(data.language.name, " ", "_")
end
if mw.ustring.match(mw.ustring.gsub(link, " ", " "),"([^%#]+)") == mw.title.getCurrentTitle().prefixedText then
alt = "*" .. alt
alt = "*" .. alt
return "<b>" .. alt .. "</b>"
return "<b>" .. alt .. "</b>"
elseif not data.language.proto and mw.ustring.gsub(link, "&nbsp;", " ") == mw.title.getCurrentTitle().subpageText then
else
return "<b>" .. alt .. "</b>"
else
if data.language and data.language.proto then
alt = "*" .. alt
link = "Appendix:" .. data.language.name .. "/" .. data.term
elseif data.language then
link = link .. "#" .. string.gsub(data.language.name, " ", "_")
end
return "[[" .. link .. "|" .. alt .. "]]" .. mw.title.getCurrentTitle().fragment
return "[[" .. link .. "|" .. alt .. "]]" .. mw.title.getCurrentTitle().fragment
end
end