มอดูล:unsubst/documentation
หน้าตา
นี่คือหน้าเอกสารการใช้งานสำหรับ มอดูล:unsubst
This module protects templates and modules from being wrongly substituted.
Usage
[แก้ไข]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 <noinclude/>
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
[แก้ไข]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.