On Thu, Jan 24, 2013 at 5:10 AM, John Delacour <[email protected]> wrote:
> I think the question is rather, why not do the whole thing with a Perl text
> filter?  Then your text filter to do the whole lot would be something like
> the script below.  This can be run, with or without a key shortcut, from the
> Text Filters palette:

Man, you're going to make me learn perl grep syntax, aren't you? :-)

I see roughly how to do it, and I can do simple substitutions in perl,
but I'm having trouble getting the more complex ones to run. I've
figured out that you need to dot-combine literal characters with grep
in the replacements, but I'm getting SCALAR and some numbers instead
of my grep replacements, and there's some distinction between /n and
/r I'm not yet understanding (since things work better with \n than
\r, but I always use \r in BBEdit).

  s/^Title: / '#' /e;
  s/^Blurb: (.+)/ 'A>' . \1/e;
  s/^(by.+)/ '_' . \1 . '_'/ie;
  s/^\*\*(.+)\*\* (-*)( *)/ '## ' . \1 . \r . \r/e;

cheers... -Adam

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to