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

[Clip] Marking selected text with opening and closing par tags

Expand Messages
  • ptrewern@vic.bigpond.net.au
    G day Notetabbers, This is an expansion on a request I made some time ago. Many thanks to those who assisted I edit large documents which need to be marked
    Message 1 of 6 , May 6, 1999
    • 0 Attachment
      G'day Notetabbers,

      This is an expansion on a request I made some time ago. Many thanks to those who assisted

      I edit large documents which need to be marked up using both the <p> and </p> tags on every par.

      The complication is the docs also contain many sections which require mark-up as unordered lists, ie, with a bullet.

      My last post suggested I use find ^p ^p and replace with </p>^p^p<p> which does work but is a bit of a task when it has to be done many times in each document.

      Can any one suggest a clip that does the following on a selected group of pars:

      Inserts a <p> at the start of the selection, then searches for the first ^p^p within the selection, replaces with </p>^p^p<p>, searches for the next ^p^p and replaces and so on until it reaches the end of the selection and then inserts </p>

      Any assistance would greatly cut my editing time and would be greatly appreciated.

      Thanks and hooroo, Paul.



      ------------------------------------------------------------------------
      eGroup home: http://www.eGroups.com/group/ntb-clips
      http://www.eGroups.com - Simplifying group communications
    • Kay Roath
      5/6/1999 9:15 PM ptrewern@vic.bigpond.net.au wrote ... ALWAYS test on a COPY of your data! How large is large? I ran this on a selection of 4000 lines. Worked
      Message 2 of 6 , May 7, 1999
      • 0 Attachment
        5/6/1999 9:15 PM ptrewern@... wrote

        > I edit large documents......

        > > Inserts a <p> at the start of the selection, then searches
        > for the first ^p^p within the selection, replaces with
        > </p>^p^p<p>, searches for the next ^p^p and replaces and
        > so on until it reaches the end of the selection and then
        > inserts </p>

        ALWAYS test on a COPY of your data!
        How large is large? I ran this on a selection of 4000 lines.
        Worked fine & was very fast :)
        (code lines - 1 short / 1 long)

        ^!Set %temp%=^$GetSelection$
        ^!InsertText <p>^$StrReplace("^%nl%^%nl%";"</p>^%nl%^%nl%<p>";"^%temp%";False;False)$</p>

        In answer to the request not quite stated :) - mark from the
        start of the first line to the end of the last line (don't
        include cr/lf on last line) of an unordered list & try this.
        (code - 1 short / 1 long again & assumes your list is a
        group of single lines)

        ^!Set %temp%=^$GetSelection$
        ^!InsertText <ul>^%nl%<li>^$StrReplace("^%nl%";"^%nl%<li>";"^%temp%";False;False)$^%nl%</ul>

        --- Grandma Kay ---
        Introduction to NoteTab Clip Programming
        http://notetab.kay.net



        ------------------------------------------------------------------------
        eGroup home: http://www.eGroups.com/group/ntb-clips
        http://www.eGroups.com - Simplifying group communications
      • Raymond Fitzgerald
        Hi Kay Hi Paul, ... ^$StrReplace( ^%nl%^%nl% ; ^%nl%^%nl% ; ^%temp% ;False;False)$ I like Kay s a lot better! Cheers, Ray ... eGroup home:
        Message 3 of 6 , May 7, 1999
        • 0 Attachment
          Hi Kay Hi Paul,

          >^!Set %temp%=^$GetSelection$
          >^!InsertText
          <p>^$StrReplace("^%nl%^%nl%";"</p>^%nl%^%nl%<p>";"^%temp%";False;False)$</p>

          I like Kay's a lot better!

          Cheers,
          Ray

          ------------------------------------------------------------------------
          eGroup home: http://www.eGroups.com/group/ntb-clips
          http://www.eGroups.com - Simplifying group communications
        • Jody
          Hi Paul, Kay & Ray, ... Here is a variation that someone might find useful when do large amounts of lines and/or paragraph alignment. I always have a time
          Message 4 of 6 , May 7, 1999
          • 0 Attachment
            Hi Paul, Kay & Ray,

            > In answer to the request not quite stated :) - mark from the
            > start of the first line to the end of the last line.

            Here is a variation that someone might find useful when do large
            amounts of lines and/or paragraph alignment. I always have a
            time trying to manually clear selections from the top and bottom
            of text. (I know it is easy, but I don't do it often enough
            to remember which is what.) It is easier for me to do a line
            number. This is a lot easier than scrolling 4000 lines to
            select the text. :)

            I don't really like leaving a command undone like ^!SelectTo
            below because some of the commands cause error like that, but
            did not know any other way to do it without curly brackets
            causing a second wizard to popup.

            <-- Copy below this row - header is long line -->
            H=Wrap <P ALIGN=?... Wraps selected text: <p align=?</p> or simple <p></p>
            ; Paul, Ray, Kay, Jody, Clip List 05-07-1999
            ; Get end line number and place cursor anywhere on the start line.
            ; This assumes you have one blank line at the end of the selection.
            ; 5 lines below: 4 with ^! start and one with <p^%Align%>
            ^!Jump Line_Start
            ^!SelectTo ^$Calc(^?[Line number to select down to (leave blank if not used)]+1;0)$:1
            ^!^?[Select?==Select All|_None^=]
            ^!Select -2
            ^!Set %Align%="^?[(H=5)Align==left^= align=left|center^= align=center|right^= align=right|justify^= align=justify|_None^=]"
            <p^%Align%>^$StrReplace("^%nl%^%nl%";"</p>^%nl%^%nl%<p^%Align%>";"^$GetSelection$";False;False)$</p>
            <-- Copy above this row, Clipbook, right mouse, "Add from Clipboard" -->


            Happy NoteTabbin',
            Jody Adair

            The NoteTabbers Assistant Page
            http://www.sureword.com/notetab
            NoteTab Home Page - Go Pro.....
            http://www.notetab.com

            ------------------------------------------------------------------------
            eGroup home: http://www.eGroups.com/group/ntb-clips
            http://www.eGroups.com - Simplifying group communications
          • Jody
            Hi Paul, Kay & Ray, I had an emmediate need to use the clip and saw I did not allow for a current selection which it now does, sorry:
            Message 5 of 6 , May 7, 1999
            • 0 Attachment
              Hi Paul, Kay & Ray,

              I had an emmediate need to use the clip and saw I did not allow
              for a current selection which it now does, sorry:

              <-- Copy below this row - long lines... -->
              H=Wrap <P ALIGN=?... Wraps [pre]selected text: <p align=?</p> or simple <p></p>
              ; Paul, Ray, Kay, Jody, Clip List 05-07-1999
              ; Preselect text or Get end line number and place
              ; cursor anywhere on the start line. This assumes
              ; you have one blank line at the end of the
              ; selection when using the wizard to select text.

              ^!Set %Select%=^?[Select?==Current selection^=1|Select All|_None^=]
              ^!IfTrue ^%Select% Current
              ^!Jump Line_Start
              ^!SelectTo ^$Calc(^?[Line number to select down to (leave blank if not used)]+1;0)$:1
              ^!^%Select%
              ^!Select -2

              :Current
              ^!Set %Align%="^?[(H=5)Align==left^= align=left|center^= align=center|right^= align=right|justify^= align=justify|_None^=]"
              <p^%Align%>^$StrReplace("^%nl%^%nl%";"</p>^%nl%^%nl%<p^%Align%>";"^$GetSelection$";False;False)$</p>
              <-- Copy above this row, Clipbook, right mouse, "Add from Clipboard" -->


              C ya,
              Jody

              http://www.sureword.com/sojourner
              http://www.sureword.com/notetab

              ------------------------------------------------------------------------
              eGroup home: http://www.eGroups.com/group/ntb-clips
              http://www.eGroups.com - Simplifying group communications
            • Kay Roath
              5/7/1999 8:01 AM Raymond Fitzgerald wrote ... I was comfortable with StrReplace as an option in Paul s case since he s working with data that s going on the
              Message 6 of 6 , May 7, 1999
              • 0 Attachment
                5/7/1999 8:01 AM Raymond Fitzgerald wrote

                > I like Kay's a lot better!

                I was comfortable with StrReplace as an option in Paul's
                case since he's working with data that's going on the web.
                I forgot to mention for new people on the list that it can't
                be used with text that contains clip code. Having several
                ways of doing things is a definate advantage & whether one
                is better than another really depends on what you happen to
                be doing at the moment :) It's also interesting to see how
                many ways things can be done in NoteTab. It becomes
                addictive. I'm often reminding myself of all the other
                things I really should be doing while fixing & testing a
                clip for the list but it's such fun!

                --- Grandma Kay ---
                Introduction to NoteTab Clip Programming
                http://notetab.kay.net



                ------------------------------------------------------------------------
                eGroup home: http://www.eGroups.com/group/ntb-clips
                http://www.eGroups.com - Simplifying group communications
              Your message has been successfully submitted and would be delivered to recipients shortly.