Module:Sandbox/Lord Farin

local p = {}

local priv = {} --Private functions function priv.isNull( arg ) return ( arg == nil or arg == "" ) end

--Public functions function p.definitionCategory( frame ) local tpl_args = frame:getParent.args local mwTitle = mw.title.getCurrentTitle local category = mwTitle.subpageText local tcNamespace if (priv.isNull( tpl_args.namespace )) then tcNamespace = "Definition" else tcNamespace = tpl_args.namespace end --[=[ defPage: Definition page link. def contains a ":"  " " def contains no ":" "Definition: " Default:            "Definition: " ]=] local defPage if priv.isNull( tpl_args.def ) then defPage = "Definition:" .. category elseif ( string.match( tpl_args.def, ":" ) == nil ) then defPage = "Definition:" .. tpl_args.def else defPage = tpl_args.def end --[=[ defLinkWikitext: Display of definition page link disp exists: " " Default:     "" ]=] local defLinkWikitext = ""  if priv.isNull( tpl_args.disp ) then    defLinkWikitext = defLinkWikitext .. defPage .. "" else defLinkWikitext = defLinkWikitext .. tpl_args.disp .. "]]" end --[=[ contextText: Display of context addendum "in the context of ..." contextdisp exists: " " context exists:    " " Default:           No addendum ]=] local contextText if priv.isNull( tpl_args.context ) then contextText = "" else contextText = " in the context of "   if priv.isNull( tpl_args.contextdisp ) then      contextText = contextText .. tpl_args.context .. "" else contextText = contextText .. tpl_args.contextdisp .. "]]"   end end --[=[ resultCatText: Display of link to associated results category nocat exists: No display Default: ]=] local resultCatText = "" if priv.isNull( tpl_args.nocat ) then resultCatText = frame:expandTemplate{ title = 'ProofsLink', args = { category } } end local result = mw.html.create result :wikitext( defLinkWikitext ) :wikitext( contextText ) :wikitext( '. ' ) :wikitext( resultCatText ) :newline :wikitext( '' ) :newline return result end

return p