Module:HasTag/doc: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(Created page with "<code><nowiki>{{#invoke:HasTag | main | TAG | WIKITEXT }}</nowiki></code> 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 | ref | Blah <ref>blep</ref> blub. }}</nowiki></code> Result: {{#invoke:HasTag | main | ref | Blah <ref>blep</ref> blub. }} (Why no work?)")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Doc page: [[Module:HasTag/doc]]
<code><nowiki>{{#invoke:HasTag | main | TAG | WIKITEXT }}</nowiki></code>
<code><nowiki>{{#invoke:HasTag | main | TAG | WIKITEXT }}</nowiki></code>


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 | ref | Blah <ref>blep</ref> blub. }}</nowiki></code>
Example: <code><nowiki>{{#invoke:HasTag | main | nowiki | Blah &lt;nowiki&gt;blep&lt;/nowiki&gt; blub. }}</nowiki></code>


Result: {{#invoke:HasTag | main | ref | Blah <ref>blep</ref> blub. }}
Result: {{#invoke:HasTag | main | nowiki | Blah <nowiki>blep</nowiki> blub. }}


(Why no work?)
Note: This only works with parser tags, not HTML tags. For example, it wouldn't work with <code>&lt;div&gt;</code> or <code>&lt;code&gt;</code>, but it works with <code>&lt;gallery&gt;</code> or <code>&lt;nowiki&gt;</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.)