Module:links: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
m (Added test thing, will remove later)
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 7: Line 7:
local link = data.term
local link = data.term
local alt = data.alt or data.term
local alt = data.alt or data.term
local anchor = data.anchor
if data.language.proto and "Appendix:" .. data.language.name .. "/" .. data.term == mw.title.getCurrentTitle().prefixedText then
local plaenk_alt = mw.loadData("Module:lnk-pro-morph/data").alt
alt = "*" .. alt
return "<b>" .. alt .. "</b>"
if data.language then
elseif not data.language.proto and mw.ustring.gsub(link, "&nbsp;", " ") == mw.title.getCurrentTitle().subpageText then
if data.language.code == "lnk-pro" and plaenk_alt[link] then link = plaenk_alt[link] end
if data.hypo then alt = "&#42;&#42;" .. alt end
if data.language.proto then
if not data.nostar and not data.hypo then alt = "&#42;" .. alt end -- &#42; is an asterisk but sometimes the asterisk gets mistaken for wiki formatting
link = "Appendix:" .. data.language.name .. "/" .. data.term
if anchor then link = link .. "#" .. data.language.name .. anchor end
else
local jump = data.language.name
if anchor then jump = data.language.name .. anchor end
link = link .. "#" .. string.gsub(jump, " ", "_")
end
end
local term = mw.ustring.match(mw.ustring.gsub(link, "&nbsp;", " "),"([^%#]+)")
if term == mw.title.getCurrentTitle().text and not data.nobold then
return "<b>" .. alt .. "</b>"
return "<b>" .. alt .. "</b>"
elseif mw.ustring.match(term, "^[%?%-–—]+$") or mw.ustring.match(term, ":[%?%-–—]+$") or data.nolink then
return alt
else
else
if data.language and data.language.proto then
return "[[" .. link .. "|" .. alt .. "]]"
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
end
end
end
end