ToggleTag Script

Build 1501 on 14/Nov/2017  This topic last edited on: 9/May/2012, at 13:04

Description

Manipulates tag in the current paragraph: toggles, adds, removes, replaces.

Syntax

ToggleTag(strTagOld, strTagNew)

strTagOld

tag to be replaced, deleted or moved. You can specify it with or without tag brackets. If you specify it without the right bracket, it behaves as wildcard, e.g. >pq matches >pq<, >pql<, >pqz 120< etc.

There could be also some modifiers, see examples.

strTagNew

replacement tag. If it's an empty string, it will delete the strTagOld.

Examples

Toggle the tag >news<: if it is found in the current paragraph, remove it, otherwise insert it

ToggleTag (">news<", ">news<") 

Remove the tag >news<:

ToggleTag (">news<", "") 

Replace tag >dropc..< first, and then start to toggle it.

ToggleTag (">dropc",">dropc 4,1,3,-2,0,100,F<")   

The above will do the following:

If there's no any >dropc..< tag in the current paragraph, it will insert >dropc 4,1,3,-2,0,100,F<

If there's a >dropc..< tag with different parameters, it will replace it with >dropc 4,1,3,-2,0,100,F<

If there's the tag >dropc 4,1,3,-2,0,100,F<, it will toggle it.

Replace tag >dropc..< - do not toggle it.

ToggleTag ("=>dropc",">dropc 4,1,3,-2,0,100,F<")   

The above will do the following:

If there's no any >dropc..< tag in the current paragraph, it will insert >dropc 4,1,3,-2,0,100,F<

If there's a >dropc..< tag with different parameters, it will replace it with >dropc 4,1,3,-2,0,100,F<

If there's the tag >dropc 4,1,3,-2,0,100,F<, it will leave it as is.

Other examples:

ToggleTag (">pq","pql")   delete any >pq*< tag and insert pql

ToggleTag (">pq","!pql") delete any >pq*< tag and put >pql< as the first tag

ToggleTag (">pq","%pql") delete any >pq*< tag and put >pql< as the last tag

ToggleTag (">pq","$pql") delete any >pq*< tag and put >pql< before tags in UserTags2

ToggleTag ("itl","#") togle >itl< tag (on the cursor position)

See also

ToggleShow Script