Loading ...
Sorry, an error occurred while loading the content.

An "uncomment" command?

Expand Messages
  • John Mitchell
    The HTML clip bar includes a handy COMMENT button that can be used to convert one or more selected lines into an HTML comment by bracketing with
    Message 1 of 6 , Feb 15, 2004
    • 0 Attachment
      The HTML clip bar includes a handy COMMENT button that can be used to
      convert one or more selected lines into an HTML comment by bracketing
      with <!-- selected text goes here -->

      Is there a standard UNCOMMENT command, or if someone has developed such
      a script would they be kind enough to share it with a newcomer.

      Regards, John M
    • Alan C.
      ... A clip, Here s one way: H= uncomment ; select an html comment including beginning ; and ending brackets. Strips the comment markup ^!ClearVariable %sel%
      Message 2 of 6 , Feb 15, 2004
      • 0 Attachment
        On Mon, 16 Feb 2004 13:18:16 +1100, John Mitchell wrote:
        >�The HTML clip bar includes a handy COMMENT button that can be used to convert one or more selected lines into an HTML comment by bracketing with. �Is there a standard UNCOMMENT command, or if someone has developed such a script would they be kind enough to share it with a newcomer.

        A clip, Here's one way:

        H="uncomment"
        ; select an html comment including beginning
        ; and ending brackets. Strips the comment markup
        ^!ClearVariable %sel%
        ^!Set %sel%=^$GetSelection$
        ^!IfFalse ^$IsEmpty(^%sel%)$ Skip_2
        ^!Info Nothing selected!
        ^!Goto end
        ^!Set %sel%=^$StrReplace("<!--";"";"^%sel%";False;False)$
        ^!Set %sel%=^$StrReplace("-->";"";"^%sel%";False;False)$
        ^!InsertText ^$StrTrim("^%sel%")$
        ; ---< end of clip <----

        That last clip code line above, the ^!InsertText line is a more condensed version of the next two lines ie the above one liner does both #1 trims the string and also #2 inserts the string back into the document:

        ^!InsertSelect ^%sel%
        ^$StrTrim("^$GetSelection$")$

        Here, the 1st line inserts the string back into the document, leaving the string selected. 2nd line trims the string (I went with the one liner since it's more fun to pack more wallop into a lesser amount of clip code). Either works, either the one liner or its two potential replacement lines.

        help > help on clip programming > index tab > scroll to ^$StrTrim (or whatever clip code item suits your fancy)

        --
        Alan.
      • John Zeman
        ... to ... bracketing ... such ... Here s another way. Put your cursor anywhere within the HTML comment (you don t need to select anything) and run the
        Message 3 of 6 , Feb 16, 2004
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, John Mitchell <notetab@l...> wrote:
          > The HTML clip bar includes a handy COMMENT button that can be used
          to
          > convert one or more selected lines into an HTML comment by
          bracketing
          > with <!-- selected text goes here -->
          >
          > Is there a standard UNCOMMENT command, or if someone has developed
          such
          > a script would they be kind enough to share it with a newcomer.
          >
          > Regards, John M



          Here's another way.
          Put your cursor anywhere within the HTML comment (you don't need to
          select anything) and run the following 2 line clip.

          John


          ^!Replace "<!--" >> "^%empty%" TIBS
          ^!Replace "-->" >> "^%empty%" TIS
        • John Mitchell
          Many thanks to both Alan Cumming and John Zeman for their neat solutions. John, would you mind explaining what TIBS and TIS are/do? A search through the Clip
          Message 4 of 6 , Feb 16, 2004
          • 0 Attachment
            Many thanks to both Alan Cumming and John Zeman for their neat
            solutions.

            John, would you mind explaining what TIBS and TIS are/do? A search
            through the Clip Programming Help did not find a match for either.

            Regards, John M
          • John Mitchell
            Now that I have looked up the full syntax of ^!Replace (which I should have done in the first place) the answer to my question regarding the meaning of TIBS
            Message 5 of 6 , Feb 16, 2004
            • 0 Attachment
              Now that I have looked up the full syntax of ^!Replace (which I should
              have done in the first place) the answer to my question regarding the
              meaning of TIBS and TIS is apparent...

              ^!Replace "<!--" >> "^%empty%" TIBS
              ^!Replace "-->" >> "^%empty%" TIS

              Each letter in TIBS and TIS is an option. Next time I'll be a bit more
              diligent with my research.

              Thanks again and regards,

              John M
            • John Zeman
              ... should ... the ... more ... Glad you found your answers John. Also since you seem to be fairly new to this you might make a note that ^%empty% is one of
              Message 6 of 6 , Feb 16, 2004
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, John Mitchell <notetab@l...> wrote:
                > Now that I have looked up the full syntax of ^!Replace (which I
                should
                > have done in the first place) the answer to my question regarding
                the
                > meaning of TIBS and TIS is apparent...
                >
                > ^!Replace "<!--" >> "^%empty%" TIBS
                > ^!Replace "-->" >> "^%empty%" TIS
                >
                > Each letter in TIBS and TIS is an option. Next time I'll be a bit
                more
                > diligent with my research.
                >
                > Thanks again and regards,
                >
                > John M


                Glad you found your answers John. Also since you seem to be fairly
                new to this you might make a note that ^%empty% is one of NoteTab's
                predefined variables (search clip script help for "Variables") and
                means "nothing".

                Another john (no jokes please LOL)
              Your message has been successfully submitted and would be delivered to recipients shortly.