Module:glossary: Difference between revisions
Created page with "local export = {} local gsub = mw.ustring.gsub function format_def (term, definition) local anchor = gsub(term, "%[%[([^%]]+)%]%]", "%1") -- Remove wikilinks anchor = gsub..." |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 26: | Line 26: | ||
function export.link(frame) | function export.link(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local anchor, text = args[1] or "", args[2] | local anchor, text = args[1] or "", args[2] | ||
| Line 40: | Line 33: | ||
-- This won't work if the initial letter is non-ASCII. | -- This won't work if the initial letter is non-ASCII. | ||
local lower_anchor = | local lower_anchor = mw.ustring.lower(anchor) | ||
return "[[wikt:Appendix:Glossary#" .. lower_anchor .. "|" .. (text or anchor) .. "]]" | |||
end | end | ||
return export | return export | ||