Module:TSLoader: Difference between revisions

From Structorica Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
---
--- This module allows loading TemplateStyles styles only once per page.
---
--- Although TemplateStyles has its own deduplication mechanism.
--- * It still leaves extra HTML tags after repeated loading attempts.
---
--- By using this module, you can avoid the appearance of extra tags.
---
--- Source: https://minecraft.wiki/w/Module:TSLoader
---
local p = {}
local p = {}



Latest revision as of 18:02, 15 January 2026

Documentation

This module allows loading TemplateStyles styles only once per page.


Although TemplateStyles has its own deduplication mechanism.

  • It still leaves extra HTML tags after repeated loading attempts.


By using this module, you can avoid the appearance of extra tags.

Source

https://minecraft.wiki/w/Module:TSLoader


local p = {}

-- Performs loading
function p.call( name )
	if not name then
		return nil
	end
	return mw.getCurrentFrame():extensionTag{ name = "templatestyles", args = { src = name } }
end

-- Wrapper for use outside modules
function p.main( f )
	local args = f
	local frame = mw.getCurrentFrame()
	if f == frame then
		args = require( 'Module:ProcessArgs' ).merge( true )
	end
	return p.call( args[ 1 ] )
end

return p