logo       

HTML::Tidy Filter for BBEdit?: msg#00066

Subject: HTML::Tidy Filter for BBEdit?
I have a very useful Perl::Tidy Filter in BBEdit, though I'm not quite sure where I got it from.

Essentially it takes input from the selection of the current window, and when invoked, writes Tidy'd code back to the selection.

It's terribly simple, in fact I'll post the entire thing here (minus a couple of comments):

#!/usr/bin/perl -wn
use Perl::Tidy;
BEGIN { my $input_string = ""; my $output_string = ""; }
$input_string .= $_;
END {
    Perl::Tidy::perltidy(
        source      => \$input_string,
        destination => \$output_string,
    );

    print "$output_string\n";
}
__END__

my question is, how can I create the same sort of script which will use HTML::Tidy?

Both the module and the library are installed and running OK on my Mac, but I can't seem to get it to work, in fact I can't even figure out from the documentation how to get any output from it at all!

According to http://search.cpan.org/~petdance/HTML-Tidy-1.04/lib/HTML/Tidy.pm the module only has six methods, none of which returns my HTML to me in any form -- am I missing something? The messages say things like "deleting empty <p> tag", but if it doesn't return anything, so what? Should I be using the API for libtidy itself, and if so, how?

------------------------------------------------------------
               "Have You Validated Your Code?"
John Horner                            (+612 / 02) 9333 3488
Senior Developer, ABC Online          http://www.abc.net.au/
------------------------------------------------------------




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe