How to automatically apply HTML tags to selected text

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

How to automatically apply HTML tags to selected text

Postby cyclinwa » Fri Jan 18, 2013 3:02 pm

This seems like such a basic question, but after searching around in the help and on the web site, I did not see an answer. When I paste text into a document, highlight the text and then click my desired tag, I would expect the text to automatically be enclosed within the desired tag. Instead the default behavior puts the entire tag before my text and then requires me to cut and paste the text between the opening and closing tags, which is much more time consuming.

Is there an option to enable the desired behavior? Thanks. - John
cyclinwa
Newbie
 
Posts: 1
Joined: Fri Jan 18, 2013 2:54 pm

Re: How to automatically apply HTML tags to selected text

Postby Mofi » Sat Jan 19, 2013 8:26 am

Do you mean with highlight text that you select the text?

Highlighting means only displaying a text with a different color. No action can be applied on just highlighted text. Selecting a text marks a string for manipulation.


And what do you mean with click my desired tag?

In View - Views/Lists - Tag List there is the tag group HTML - Tags which can be selected at top of the view. Double clicking on a tag in this view results in inserting the start and end tag around the selected text. The tags can be customized and tag groups can be removed or added by right clicking into the tag list view and clicking on Modify Tags.


Next there is the HTML Toolbar with 27 predefined and 23 custom tags. Most of the 27 predefined tags can be customized too. Those tags are usually also inserted around a selected text. Some special coded HTML toolbar commands can't be customized at Advanced - Configuration - Toolbars / Menus - HTML Toolbar. Some HTML toolbar commands can even convert a selected block to a HTML block as the 2 commands for a bulleted or a numbered list.


Last you may reference (smart) templates which you have created by yourself. You can define such templates also for inserting text around a selection. After opening Modify Templates via context menu (right click) of Template List view or Advanced - Display/Modify Templates press key F1 or click on button Help. The first table on the help page lists special text strings. Most likely you are interested in [$replace$].

For example <a href="mailto:^">[$replace$]</a> can be used to insert a mailto link around a selected text and setting caret to the position for inserting the email address.

With smart templates above template can be also coded as <a href="mailto:[+address+]">[$replace$]</a> which is even better as the caret is after inserting the template and typing the email address after the end tag.

But the template can be even more improved by using <a href="mailto:[+address+]">[+[$replace$]+]</a> for the template. When inserting this template, the email address must be entered and replaces address. If a string is selected on inserting the template, the selected text is the default for the second parameter which in this case must not be modified. But if nothing is selected on inserting the template, the second parameter has no name and therefore no default string, but the visible string for the mailto link can be nevertheless entered like a parameter as the email address. And the caret is finally after inserting the template always after the end tag.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to UltraEdit General Discussion