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

Re: [Clip] HTML clip question

Expand Messages
  • Don
    Welcome Newbie :-) we all were once and when asked recently what we use the most the majority said clips I think :-) so keep learning and this group is
    Message 1 of 9 , Jun 20, 2012
    • 0 Attachment
      Welcome Newbie :-) we all were once and when asked recently what we use
      the most the majority said clips I think :-) so keep learning and this
      group is awesome.

      On 6/18/2012 9:22 PM, Johnn wrote:
      > Hi,
      >
      > Clip newbie here.
      >
      > I want to take this clip:
      >
      > ^!SetPasteIndent Off
      > ^!InsertHtml <P>^&</P>
      >
      > And change it so I can place the cursor at the start of a line, the clip selects all the text to the end of the line, and wraps the whole line in the p tags.
      >
      > This would save a lot of text highlighting and mousing for me.
      >
      > How would I do this?
      >
      > Thanks in advance for your help,
      > Johnn
    • Johnn
      Thanks for the help! This has saved a ton of clicking. When I run the clip, the tag gets put on a new line. Is there a way to stop this? For example,
      Message 2 of 9 , Jun 23, 2012
      • 0 Attachment
        Thanks for the help! This has saved a ton of clicking.

        When I run the clip, the </p> tag gets put on a new line. Is there a way to stop this?

        For example,

        ^!Select lines
        ^!InsertText <p>^$GetSelection$</p>^P

        Generates this result:

        <p>Test text.
        </p>

        And I'd prefer this result:

        <p>Test text.</p>

        Is there anything I can do to effect that?

        Johnn
      • Axel Berger
        ... Yes. I had explained the reason above but was too lazy to do anything about it. (The second reason is, that personally I prefer long or short paragraph
        Message 3 of 9 , Jun 23, 2012
        • 0 Attachment
          Johnn wrote:
          > Is there anything I can do to effect that?

          Yes. I had explained the reason above but was too lazy to do anything
          about it. (The second reason is, that personally I prefer
          long or short paragraph text
          </P><P>
          long or short paragraph text
          to
          <P>long or short paragraph text</P>
          <P>long or short paragraph text</P>)

          All you need is one extra ^!Find:

          ^!Select LINES
          ^!Replace "^((.*\R)*(.+))$" >> "<P>$1</P>" HRASTI
          ^!Jump Select_END

          The implicit ^!Find inside the ^!Replace:

          Finds from a line start ^ to a line end $
          Replaces the outer parewntheses ($1), the inner ones are for grouping.
          Finds zero or more groups of zero or more characters followed by a NL
          All that followed by at least one character followed by nothing.
          (In the case of a single selected line only the last will do anything)

          This find does NOT include the last newline. The replace string
          including the close tag is placed before it. Hope that's understandable.
          There are more elgant solutions, but this, I hope, is the simplest.

          Axel
        • Johnn
          Axel, That worked great. Thanks! Johnn
          Message 4 of 9 , Jun 23, 2012
          • 0 Attachment
            Axel,

            That worked great. Thanks!

            Johnn
          • John Shotsky
            If you turn your html toolbar on, you can just highlight the text you want in paragraph marks and click the icon. It works exactly as you wish. Regards, John
            Message 5 of 9 , Jun 24, 2012
            • 0 Attachment
              If you turn your html toolbar on, you can just highlight the text you want in paragraph marks and click the icon. It
              works exactly as you wish.

              Regards,
              John
              RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Johnn
              Sent: Saturday, June 23, 2012 11:02
              To: ntb-clips@yahoogroups.com
              Subject: Re: [Clip] HTML clip question


              Thanks for the help! This has saved a ton of clicking.

              When I run the clip, the </p> tag gets put on a new line. Is there a way to stop this?

              For example,

              ^!Select lines
              ^!InsertText <p>^$GetSelection$</p>^P

              Generates this result:

              <p>Test text.
              </p>

              And I'd prefer this result:

              <p>Test text.</p>

              Is there anything I can do to effect that?

              Johnn



              [Non-text portions of this message have been removed]
            • loro
              ... You already got a regex solution from Axel, but if you want to know how to do it directly with ^!Select, here s how. ^!Jump line_start ^!Select EOL
              Message 6 of 9 , Jun 25, 2012
              • 0 Attachment
                At 20:01 2012-06-23, Johnn wrote:
                >Thanks for the help! This has saved a ton of clicking.
                >
                >When I run the clip, the </p> tag gets put on a new line. Is there a
                >way to stop this?

                You already got a regex solution from Axel, but if you want to know
                how to do it directly with ^!Select, here's how.


                ^!Jump line_start
                ^!Select EOL
                ^!InsertText <p>^$GetSelection$</p>

                The ^!Jump line_start is just so you can place the cursor anywhere
                on the line and not necessarily at the start of it.

                On a sidenote, you don't really need ^$GetSelection$. You can use
                Notetab's inbuilt token ^& instead.

                ^!InsertText <p>^&</p>

                Many ways to skin a cat with Notetab. ;-)

                Lotta
              Your message has been successfully submitted and would be delivered to recipients shortly.