Module:Format link: Difference between revisions
Content added Content deleted
(Integrate improvements from Module:Hatnote/sandbox, in particular use of mw.ustring by Izno and my own categoryMissing stuff) |
(Added formatPages analogue) |
||
Line 174: | Line 174: | ||
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category) |
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category) |
||
end |
|||
-------------------------------------------------------------------------------- |
|||
-- Derived convenience functions |
|||
-------------------------------------------------------------------------------- |
|||
function p.formatPages(options, pages) |
|||
-- Formats an array of pages using formatLink and the given options table, |
|||
-- and returns it as an array. Nil values are not allowed. |
|||
local ret = {} |
|||
for i, page in ipairs(pages) do |
|||
ret[i] = p._formatLink{ |
|||
link = page, |
|||
categorizeMissing = options.categorizeMissing, |
|||
italicizePage = options.italicizePage, |
|||
italicizeSection = options.italicizeSection |
|||
} |
|||
end |
|||
return ret |
|||
end |
end |
||