This is the documentation page for Module:unsubst

This module protects templates and modules from being wrongly substituted.

First, put the following at the beginning of the entry_point function in the module:

if mw.isSubsting() then
	return require('Module:unsubst').unsubst_template("entry_point")
end

Where "entry_point" should be replaced with the function name. Next, edit the template:

{{safesubst:<noinclude/>#invoke:...|entry_point|...}}

The <mw:Transclusion#Transclusion markupnoinclude> is optional. The template will substitute into its transcluded form.

To protect the module itself instead of the template, add this at the start of the function instead:

if mw.isSubsting() then
	return require('Module:unsubst').unsubst_module("entry_point")
end

Directly in templates

baguhon

You can wrap the template code in

{{safesubst:#invoke:unsubst|me|=
...
}}

It will work just like unsubst_template above, apart from also generating a transclusion to Module:unsubst. Additionally, it protects templates from being copied and pasted to non-template pages.