Module:Class link

--- Functions to link to class pages -- local class_icon = require("Module:Class icon") local class_tags = require("Module:Class tags") local links = require("Dev:Links") local utils = require("Module:Utils")

local p = {}

--- Make a link to a class page. -- @param {string} classname Name of the class -- @param {string} icon Icon file link -- @return {string} Link to the class page function p.make_class_link(classname, icon) local class_link = links.link("Class:" .. classname, classname, "local") if class_tags.has_tag(classname, 'Deprecated') then class_link = mw.text.tag("s", nil, class_link) end if icon then return icon .. class_link else return class_link end end

function p._class_link(args) return p.make_class_link(args.class, class_icon.get_custom_class_icon(args.class, false)) end

p.class_link = utils.make_wrapper_function(p._class_link)

function p._class_link_with_fallback_icon(args) return p.make_class_link(args.class, class_icon.get_custom_class_icon(args.class, true)) end

p.class_link_with_fallback_icon = utils.make_wrapper_function(p._class_link_with_fallback_icon)

return p