Module:links: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 217: Line 217:


-- Make a link from a given link's parts
-- Make a link from a given link's parts
local function make_link(link, lang, sc, id, isolated, plain, cats, no_alt_ast)
local function make_link(link, lang, sc, id, isolated, plain, cats, no_alt_ast, to_wik)
-- Convert percent encoding to plaintext.
-- Convert percent encoding to plaintext.
link.target = decode_uri(link.target, "PATH")
link.target = decode_uri(link.target, "PATH")
Line 319: Line 319:
link.fragment = link.fragment and encode_entities(remove_formatting(link.fragment), "#%&+/:<=>@[\\]_{|}")
link.fragment = link.fragment and encode_entities(remove_formatting(link.fragment), "#%&+/:<=>@[\\]_{|}")


return "[[" .. (link.nocont and "wikt:" or "Contionary:") .. link.target .. (link.fragment and "#" .. link.fragment or "") .. "|" .. link.display .. "]]"
return "[[" .. (to_wik and "wikt:" or "Contionary:") .. link.target .. (link.fragment and "#" .. link.fragment or "") .. "|" .. link.display .. "]]"
end
end


Line 503: Line 503:
text = text and trim(text)
text = text and trim(text)
data.alt = data.alt and trim(data.alt)
data.alt = data.alt and trim(data.alt)
return make_link({target = text, display = data.alt, fragment = data.fragment}, data.lang, data.sc, data.id, true, nil, data.cats, data.no_alt_ast)
return make_link({target = text, display = data.alt, fragment = data.fragment}, data.lang, data.sc, data.id, true, nil, data.cats, data.no_alt_ast, data.to_wik)
end
end