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

RE: [NTB] Removing manual line breaks

Expand Messages
  • John Shotsky
    Another way would be to replace ( S) R with $1 x20. That says if there s anything actually on the line besides spaces, then replace the CR with a space. This
    Message 1 of 1 , Jan 17, 2010
    • 0 Attachment
      Another way would be to replace (\S)\R with $1\x20.

      That says if there's anything actually on the line besides spaces, then replace the CR with a space.



      This can be written as a two line clip which can quickly reformat any material into paragraphs without hard line breaks.




      If fancier formatting is wanted, a 'special code' could be inserted on the ends of lines that should be preserved first.
      Then after the two lines run, the 'special code' could be replaced by a CR. This would work for a list of items, for
      example, or a table that should remain intact.



      Here's the two line clip:

      ^!Replace "^\x20+(.+)\R" >> "\r\n\r\n$1\r\n" ARSTW

      ^!Replace "(\S)\R" >> "$1\x20" ARSTW



      It converts your initial text

      "Oh, boy," said Debbie's mom after a humongous yawn. "I think we'd

      better think about heading home, kiddo. It was a long night."

      "Um, well," interjected Debbie, "we were kinda gonna go hang out at

      the mall or something for a while. Right?" she asked me. She kicked me

      under the table to give me a hint.

      "Uh, yeah," I said, nodding. I didn't know how to get out of some

      of the costuming.

      "Oh, well, if you're going to the mall, could you pick something up

      for Aunt Kathy's shower? I haven't had the energy the last couple of

      days, and it's this Saturday."

      "Uh, yeah, I guess... did you have something in mind?" Debbie

      asked, as she squeezed my hand under the table.

      She mentioned some arcane female thing, which I didn't get. Debbie

      nodded.

      "Oh, well, we were going there too," said Mike helpfully. I glared

      at him as he went on, "Maybe we could take the girls there for you, so

      you could get home. Ma'am."

      "Well, that's awfully nice of you, Michael, but I wouldn't want to

      put you to any trouble," she said.

      "Oh, no trouble," they both said. And grinned. *Oh, no,* I

      thought.



      Into this:



      "Oh, boy," said Debbie's mom after a humongous yawn. "I think we'd better think about heading home, kiddo. It was a
      long night."



      "Um, well," interjected Debbie, "we were kinda gonna go hang out at the mall or something for a while. Right?" she
      asked me. She kicked me under the table to give me a hint.



      "Uh, yeah," I said, nodding. I didn't know how to get out of some of the costuming.



      "Oh, well, if you're going to the mall, could you pick something up for Aunt Kathy's shower? I haven't had the energy
      the last couple of days, and it's this Saturday."



      "Uh, yeah, I guess... did you have something in mind?" Debbie asked, as she squeezed my hand under the table.



      She mentioned some arcane female thing, which I didn't get. Debbie nodded.



      "Oh, well, we were going there too," said Mike helpfully. I glared at him as he went on, "Maybe we could take the girls
      there for you, so you could get home. Ma'am."



      "Well, that's awfully nice of you, Michael, but I wouldn't want to put you to any trouble," she said.



      "Oh, no trouble," they both said. And grinned. *Oh, no,* I thought.



      Regards,

      John



      From: notetab@yahoogroups.com [mailto:notetab@yahoogroups.com] On Behalf Of CNash
      Sent: Sunday, January 17, 2010 3:24 PM
      To: notetab@yahoogroups.com
      Subject: Re: [NTB] Removing manual line breaks





      Wow... I've been puzzling over this one for days; thanks!

      --- In notetab@yahoogroups.com <mailto:notetab%40yahoogroups.com> , Marcelo Bastos <mcblista@...> wrote:
      >
      > Interviewed by CNN on 16/1/2010 21:47, CNash told the world:
      > > I have a bunch of stories that I've downloaded from the 'net and want to read on my PSP while traveling. The problem
      is that the PSP's screen is smaller in width (by character) than the stories, and they're formatted with
      manually-inserted line breaks rather than relying on the viewing program's word wrap function. Is there any way to
      remove manual line breaks while preserving the paragraphing? I've tried Replace using ^P as the criteria, but this just
      double-spaces everything, and also using Join Lines, but NoteTab can't differentiate between an end-of-line and an
      end-of-paragraph, leaving me with a wall of text.
      > >
      > > Any help with this would be very much appreciated. I thought it might be helpful to have an example of what I mean,
      so here we are:
      > >
      >
      > I hear you, I do something similar with my old Palm.
      >
      > In my experience, the pre-editing *has* to be done in a case-by-case
      > basis, because even the same writer will be inconsistent in how they
      > indicate paragraph breaks.
      >
      > Your example, though, is an easy one to fix: the paragraphs can be
      > identified because they always have a few spaces in the beginning of the
      > line. This can be fixed in two or three steps. For instance:
      >
      > 1. Run a search for "^p " and replace with "^p^p " (note the
      > spaces). That will insert an extra line break between paragraphs.
      >
      > 2. Use the Join Lines command.
      >
      > 3. Optionally, replace "^p^p" with "^p" to get rid of the double spaces.
      >
      >
      > Eventually, you can use more complex patterns to get more special cases,
      > and develop them into clips. I have a clipbook with several
      > special-purpose clips that I developed over the years to handle a number
      > of tasks related to reading texts I download. The current version is
      > over 1300 lines long...
      >
      > --
      > MCBastos
      >
      > This message has been protected with the 2ROT13 algorithm. Unauthorized
      > use will be prosecuted under the DMCA.
      >
      > -=-=-
      > ... BOFH excuse #38:
      > secretary plugged hairdryer into UPS
      > *Added by TagZilla 0.0661 running on Seamonkey 2.0.2 *
      > http://xsidebar.mozdev.org/modifiedmailnews.html#tagzilla
      >





      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.