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

328Re: Smart/intelligent text formatting

Expand Messages
  • rpdooling
    Sep 28, 2005
      Alan,

      Damian Conway, the guy who wrote the autoformat module wrote me back.
      Just open the autoformat.pm module and change the line

      my $quotechar = qq{[!#%=|:]};

      to:

      my $quotechar = qq{[!#%=|:;]};

      by adding the ";" and poof, it's a great
      clipcode autoformatter.

      Be sure to add in the script itself a line that tells the module to
      ignore clip code lines starting with "^"

      My line looks like:

      my $formatted = autoformat($rawtext, {all=>1, ignore=>qr/(\^)/});

      If anybody wants to whole script I'll post it later.

      I hope I didn't double post. Yahoo locked up in the middle of the last.

      Rick

      --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
      wrote:
      > --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
      > > Well, I poked around and looked at the Template-Toolkit, but I can't
      > > find a win32 rendition which is where I do all of my work. If they
      > > ever port NoteTab or Delphi to Linux, then I could be persuaded to
      > > switch. So for now I better just use plain old autoformat.
      >
      > I haven't tried the T-T module yet. But it appears it is avail for
      Win32
      >
      > http://template-toolkit.org/download.html
      >
      > Win32 about half way down the page.
      >
      >
      http://www.google.com/search?q=ppm+template-toolkit&sourceid=mozilla&start=0&start=0&ie=utf-8&oe=utf-8
      >
      > Another way could be
      >
      > H="_taform"
      >
      > H="_taform2"
      >
      > etc. etc. IOW have various formatting options in different child
      > clips. And call up the desired one.
      >
      > I'll be looking more into all of the above. But it's some days/weeks
      > up ahead at this time before it happens as I'm too booked up right now
      > to put yet another onto the platter at this time. If I discover more
      > or make script with more bells and whistles then I'll post here
      about it.
      >
      > > What's your favorite solution to the problem of reformatting text that
      > > comes to you with hard returns at the end of each line and NO blank
      > > space separating the paragraphs?
      > >
      > > I found this one on the clips forum that works most of the time.
      > >
      > > ^!REPLACE "{[.!?]}\b*$" >> "\1\n" ritswa
      >
      > It appears that looks for a period, exclamation mark, or question mark
      > with yes or no an adjacent word_boundary(s) (space(s)) -- and,
      > whenever hits/strikes that criteria, it inserts another line break.
      >
      > I haven't ever had text come to me with the problem that you describe.
      >
      > As long as the Notetab regex is doing what it set out to do then it
      > looks to me like there'd be no point in a Perl regex as to do so would
      > only duplicate the Notetab results.
      >
      > To dial in even more, wouldn't a parser need at least some
      > intelligence (as in ability to discern via language/grammar "rules" as
      > to when it is appropriate to have/make a paragraph)?
      >
      > The Parse-rec-descent module in Perl is trainable. It is trained via
      > grammars (rules) that you feed to it. I know it raises the
      > intelligence level above that of what regex can do.
      >
      > also is other parser that starts low and ascends (the inverse of P-R-D)
      >
      >
      http://search.cpan.org/~dconway/Parse-RecDescent-1.94/lib/Parse/RecDescent.pod
      >
      > http://search.cpan.org/~tbone/Parse-RecDescent-FAQ-3.94/FAQ.pm
      >
      > I don't know much about, really. Hope to some day once I further
      > advance my Perl skills.
      >
      > Perhaps snoop/search around for parser intelligence and similar if
      > interested.
      >
      > Alan.
    • Show all 19 messages in this topic