Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / November 2004



Tip: Looking for answers? Try searching our database.

BBEdit as HTML validator back end?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Horner - 12 Nov 2004 00:06 GMT
I would like to be able to install a browser-based HTML validator on
my OSX web server, like the W3C:

     http://validator.w3.org/source/

or WDG:

     http://www.htmlhelp.com/tools/validator/source.html

validators.

It's possible to install these tools on LINUX using PPM but being
able to hack them and the associated C libraries to work on OSX is
way beyond my capabilities.

But then it occurred to me I already have an application which does
HTML validation which works on OSX - BBEdit. Is it a crazy idea that
it might be possible to pipe a file or string to BBEdit's "Check
Syntax" command and retrieve the output? Where would I start with
something like that?
Sherm Pendley - 12 Nov 2004 04:54 GMT
> I would like to be able to install a browser-based HTML validator on
> my OSX web server, like the W3C:
>
>      http://validator.w3.org/source/

Instructions for that one are only a couple clicks away:

<http://www.mediaville.net/articles/validator/>

> It's possible to install these tools on LINUX using PPM

I think you're confused - Linux is not an ancronym, and PPM is for
Windows. :-)

sherm--
John Horner - 12 Nov 2004 10:11 GMT
>>      http://validator.w3.org/source/
>
> Instructions for that one are only a couple clicks away:
>
> <http://www.mediaville.net/articles/validator/>

Thank you. I had no idea. Checking it out now.

>> It's possible to install these tools on LINUX using PPM
>
> I think you're confused - Linux is not an ancronym, and PPM is for
> Windows. :-)

Yes, indeed, sorry. Hangover. Please substitute "Linux" and "RPM".
John Horner - 12 Nov 2004 10:24 GMT
I'm working through the instructions on the mediaville.net site, but
it's going to take a while from the looks of things.

How about my original question, just for the sake of it?

I can, for instance, easily create an AppleScript which tells BBEdit to
validate a certain file and write the results to another file -- how
hard would it be to hook in to that with a CGI script?

>> I would like to be able to install a browser-based HTML validator on
>> my OSX web server
David Dierauer - 12 Nov 2004 16:00 GMT
You might also want to look at this article:
http://developer.apple.com/internet/opensource/validator.html

Between it and the mediaville.net article (and W3C's own installation
instructions at http://validator.w3.org/docs/install.html ), I was able to
get the W3C validator working on my mac (OS X 10.3.5) just yesterday.  I
had to install Fink to get OpenSP working; my attempts to build it from
source failed, but other than that, it wasn't too tricky.

I, too, considered how to work BBEdit into the mix, but gave up on it
without doing too much digging into its AppleScript dictionary. I find
AppleScript very frustrating to deal with. But if you have the AppleScript
to get BBEdit to write its validation results to a file, it sounds like
you've got the hard part taken care of, and could easily have the cgi read
in the file and display it.

BTW, I'd be interested in seeing your AppleScript, if you'd be willing to
email it to me, preferably off-list, since it's not really on topic for
this list.

Signature

David Dierauer
dierauer@voyager.net

> I'm working through the instructions on the mediaville.net site, but
> it's going to take a while from the looks of things.
[quoted text clipped - 7 lines]
> >> I would like to be able to install a browser-based HTML validator on
> >> my OSX web server
Sherm Pendley - 12 Nov 2004 18:48 GMT
> I can, for instance, easily create an AppleScript which tells BBEdit
> to validate a certain file and write the results to another file --
> how hard would it be to hook in to that with a CGI script?

If BBEdit can be driven via AppleScript, you should also be able to use
Mac::Glue to drive it. Or, you could run your AppleScript with the
"osascript" tool.

sherm--
John Horner - 12 Nov 2004 22:12 GMT
> If BBEdit can be driven via AppleScript, you should also be able to
> use Mac::Glue to drive it. Or, you could run your AppleScript with the
> "osascript" tool.

That got me on the right track -- to the extent that this is already
working:

#!/usr/bin/perl
use strict;
use Mac::AppleScript::Glue;
use LWP::Simple;
print "Enter URL:\n -> ";
my $URL = <STDIN> || die "$!";

getstore( $URL, "/path/to/tempfile.html" ) || die;

my $BB = new Mac::AppleScript::Glue::Application('BBEdit')
  || die "$!";

my $results =
  $BB->check_syntax(
    file => "path:to:tempfile.html" )
  || die "$!";

foreach my $item ( @{$results} ) {
    print 'Line '
      . $item->{'result_line'} . ': '
      . $item->{'message'} . "\n";
}

I don't quite understand the results data that's coming back from the
Glue object, but the basics are already there. Of course if it was
going to be a CGI script there's a lot of other stuff to do but the
concept is proven at least.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.