Jump to content

Module:Check DYK hook/doc

From Humanipedia
Revision as of 21:23, 3 February 2025 by Humanipedia (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Check DYK hook

This module checks the format of Wikipedia:Did you know hooks used in {{DYK talk}} and {{Article history}}.

Usage[edit source]

This module can be used from templates or from other Lua modules.

From templates[edit source]

From templates, call the isValidHook function, and use the |hook= parameter to specify the hook.

{{#invoke:Check DYK hook|isValidHook|hook=hook}}

Valid hooks will return a value of "yes"; invalid hooks will return the empty string.

You can also use the first positional parameter to specify the hook. If you do this, it is recommended to use |1= explicitly; if not, and the hook contains an equals sign, the text before the equals sign will be treated as a parameter name and the hook will not be recognised.

From modules[edit source]

From modules, call the _isValidHook function with the hook as the first positional parameter.

<syntaxhighlight lang="lua"> mCheckDYKHook = require('Module:Check DYK hook') result = mCheckDYKHook._isValidHook(hook) </syntaxhighlight>

Valid hooks will return true; invalid hooks will return false.