On 16/01/2013 17:32, Adam Engst wrote:

(This paragraph is an example of lazylinks - the two links should be numbered 1 and 2.)

[*]: http://tidbits.com/
[*]: https://leanpub.com/

Adam,

I’m afraid I find AppleScript impossibly verbose for this kind of simple text munging. I don’t know what your docs look like but, supposing each link is on a separate line, then the Perl script below, saved as a text filter, will change all the asterisks to the appropriate number. If not, then the script can almost certainly be modified to do the job, however the doc is laid out. This script presumes that the docs have UNIX line endings. If they don’t then again it can easily be modified. If you post a snippet from a typical doc then it will only take a few moments to write a working filter


#!/usr/bin/perl
while (<>) {
    if (m~http://tidbits~) { s~\[\*\]~[1]~ }
    if (m~https://leanpub~) { s~\[\*\]~[2]~ }
    print;
}

JD




--
--
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