Replacement Tokens - Multiple replacement

TopStyle has been discontinued and support is no longer available. The forum is read-only. NOTE: TopStyle was not developed by the makers of CSS HTML Validator.
KBeng
Rank 0 - Newcomer
Posts: 9
Joined: Tue May 29, 2012 4:42 am

Replacement Tokens - Multiple replacement

Post by KBeng »

It would be useful if all appearances of a variable with the same name could be replaced while entering the value only once.

Example for the attributes name and id beeing identical:

Code: Select all

<input type="text" name="%r[id]" id="%r[id]" />
KBeng
Rank 0 - Newcomer
Posts: 9
Joined: Tue May 29, 2012 4:42 am

Re: Replacement Tokens - Multiple replacement

Post by KBeng »

Same goes for the new Auto-Replace feature.
User avatar
TopStyle Support
Rank VI - Professional
Posts: 506
Joined: Sat Jun 13, 2009 12:38 pm

Re: Replacement Tokens - Multiple replacement

Post by TopStyle Support »

The new Auto-Replace features does support this. Please take a look at this snippet:

Code: Select all

<input type="text" name="${1:hello}" id="$1" />
In this example, TopStyle 5 will prompt for a variable named "hello" only once, and then replace all appearances of it in your snippet.
KBeng
Rank 0 - Newcomer
Posts: 9
Joined: Tue May 29, 2012 4:42 am

Re: Replacement Tokens - Multiple replacement

Post by KBeng »

Perfect. Thank you! :)