Page MenuHomePhabricator

Load template styles with a module instead of an invocation on a template page
Closed, DeclinedPublic

Description

I don't know if this is a documentation problem, or if we should use frame:extensionTag, or if an explicit method might be preferred, but it would be nice to be able to load a templatestyles page via module rather than from the explicit template. I know for example that all of the citation templates have been modified in their sandbox to support templatestyles but I think this would be much cleaner to load it from the module supporting them instead.

Event Timeline

if we should use frame:extensionTag

Probably, yeah. That's the standard way to invoke an extension tag. Is there something special about this use case?

Anomie subscribed.

Yes, frame:extensionTag would be the way to do it.

It doesn't seem worth it to define an mw.ext.TemplateStyles module just to have one function wrapping that call. It would literally be something like

local p = {};

function p.templateStyle( frame, src )
   return frame:extensionTag( 'templatestyles', '', { src = src } );
end

return p;

You still have to include the returned strip marker in your module's output, there's no way around that.

Feel free to copy that to an on-wiki module if you really want it, I hereby license it as CC-0.

Yes, frame:extensionTag would be the way to do it.

It doesn't seem worth it to define an mw.ext.TemplateStyles module just to have one function wrapping that call.

Fine with me. It would be good to document that the current approved way to invoke in a module is via frame:extensionTag, probably on the MediaWiki help page?

It's a wiki, go ahead.

Did the thing ~