Module:nl-common

From Wiktionary, the free dictionary
Archived revision by Rua (talk | contribs) as of 03:19, 1 March 2013.
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

-- Make a link out of a form, or show a dash if empty.
function link_form(form)
    if type(form) == "table" then
        for n, subform in pairs(form) do
            form[n] = link_form(subform)
        end
        return table.concat(form, ", ")
    else
        if form ~= "" then
            if form == PAGENAME then
                return "<span lang=\"nl\">[[" .. form .. "]]</span>"
            else
                return "<span lang=\"nl\">[[" .. form .. "#Dutch|" .. form .. "]]</span>"
            end
        else
            return "&mdash;"
        end
    end
end