At 15:48 -0700 5/17/11, Bo von Hohenlohe wrote:
>Here is a sample schedule 
>http://www.robertburridge.com/Workshops/schedule_sample.html that is basic 
>html, next step would be to make the email and web addresses active hyperlinks.

Untested and based on your sample. The regular expressions are bare minimums.  
bbedit can do global replacements with similar regular expressions but I 
typically find it better to work with the original file when I know a lot about 
it.

Your source has a bunch of <br> tags that will need some special attention that 
isn't here.

#!/usr/bin/perl
$PathToOriginal =  "Workshops/schedule_sample.html";
$PathToReplacement = "Workshops/fixed_sample.html"
open INPUT, $PathToOriginal or die "Can't open $PathToOriginal\n";
open OUTPUT, ">$PathToReplacement" or die "Can't open $PathToReplacement\ for 
outpur\n";\
while (<INPUT>)  # reads one line at a time
  {
  chomp; # removes the line end.
  if (/(www.*)/)
    {
    $newline = "<a href= \" http://$1\";> $1 </a>\n";
    print OUTPUT $newline;
    next;
    }
  if (/(\S)@(\S)(*)/)
    {
    $newline = "<a href=\"mailto:$1@$2\";> $1@$2 </a> $3\n";
    print OUTPUT $newline;
    next;
    }
    print "$_\n";  #  Just print the line if we haven't changed anything.
  }


-- 

--> A fair tax is one that you pay but I don't <--

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