Surround selected text with HTML comment tags

Surround selected text with HTML comment tags

6
NewbieNewbie
6

    Nov 11, 2006#1

    Here's a simple macro I use all the time. It surrounds the currently selected text with HTML comment tags:

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Find "^s"
    Replace All SelectText "<!-- ^s -->"
    
    I got the idea from ColdFusion Studio. Very handy. You can see how easy it would be to convert it to, eg JavaScript blockquotes. Just replace the last line with:

    Code: Select all

    Replace All SelectText "/* ^s */"
    

    206
    MasterMaster
    206

      Nov 11, 2006#2

      That's a good example of a tiny macro that can make a huge difference!
      Software For Metalworking
      http://closetolerancesoftware.com

      6,675585
      Grand MasterGrand Master
      6,675585

        Nov 11, 2006#3

        Just want to tell you and all other interested users that inserting a text at start and end of a selection can be also done with
        • HTML Toolbar commands which can be customized at Configuration - Toolbars / Menus - HTML Toolbar
        • templates like /* [$replace$]^ */ which can be configured at Advanced - Display/Modify Templates
        • tags via the tag list view (View - Views/Lists - Tag List) which can be modified by right clicking into the tag list view and select Modify Tags
        Advantage of the macro is that the selection will remain after execution.

        Advantage of the other methods is that it will not work only on a selection. The start and end text will be also inserted without selection and the cursor is placed between them depending on the definition.

        I use templates for most of such replacements. The tag file is used for many other often used strings. 4 template examples:
        1. Template "Convert to URL"
          <a href="^[$replace$]">[$replace$]</a>
        2. Template "Convert to mail URL"
          <a href="mailto:[$replace$]">^[$replace$]</a>
        3. Template "Date International"
          [DATE_USER]yyyy'-'MM'-'dd[DATE_USER_END]
        4. Template "Date German"
          [DATE_USER]dd'.'MM'.'yyyy[DATE_USER_END]
        The last two templates are also used from within a macro to modify the date in the HTML head (international format) and in the document head (German format) of my HTML files.

        For more informations about templates and tags see
        Templates and tags are really very helpful and easy to use, but not very good documented and so most users don't know about it.

        A look on the user-submitted tag and autocomplete files page on this site is also a good idea. There are some useful files too.