Module:HasTag/doc: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
Checks whether the tag named <code>TAG</code> occurs within <code>WIKITEXT</code>. Returns the position of the tag if found, empty otherwise. | Checks whether the tag named <code>TAG</code> occurs within <code>WIKITEXT</code>. Returns the position of the tag if found, empty otherwise. | ||
Example: <code><nowiki>{{#invoke:HasTag | main | | Example: <code><nowiki>{{#invoke:HasTag | main | nowiki | Blah <nowiki>blep</nowiki> blub. }}</nowiki></code> | ||
Result: {{#invoke:HasTag | main | | Result: {{#invoke:HasTag | main | nowiki | Blah <nowiki>blep</nowiki> blub. }} | ||
( | Note: This only works with parser tags, not HTML tags. For example, it wouldn't work with <code><div></code> or <code><code></code>, but it works with <code><gallery></code> or <code><nowiki></code>. (HTML tags can be searched for with regular parser string functions.) |
Latest revision as of 22:39, 10 June 2024
Doc page: Module:HasTag/doc
{{#invoke:HasTag | main | TAG | WIKITEXT }}
Checks whether the tag named TAG
occurs within WIKITEXT
. Returns the position of the tag if found, empty otherwise.
Example: {{#invoke:HasTag | main | nowiki | Blah <nowiki>blep</nowiki> blub. }}
Result: 8
Note: This only works with parser tags, not HTML tags. For example, it wouldn't work with <div>
or <code>
, but it works with <gallery>
or <nowiki>
. (HTML tags can be searched for with regular parser string functions.)