<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title><% _( $n || 'Jifty') %> - <%_('Jifty Pod Online')%></title>
<style type="text/css"><!--
a { text-decoration: none }
a:hover { text-decoration: underline }
a:focus { background: #99ff99; border: 1px black dotted }
--></style>
</head>
<body>
<%PERL>
my $jifty_dirname = Jifty::Util->jifty_root."/";
my $app_dirname = Jifty::Util->app_root."/lib/";
$n =~ s/::/\//g;
my $app_name = Jifty->app_class();

my @options = (
    $app_dirname.$n.".pod",
    $app_dirname.$n.".pm",
    $jifty_dirname.$n.".pod",
    $jifty_dirname.$n.".pm");

my $total_body;
foreach my $file (@options) {
    next unless -r "$file";
    local $/;
    my $fh;
    open $fh, "$file" or next;
    $total_body = <$fh>;
    close $fh;
}
my $body;
my $schema;
use Pod::Simple::HTML;
my $converter = Pod::Simple::HTML->new();
if($n !~ /^Jifty\//) {
    if ($total_body =~ /package (.*?)::Schema;(.*)package/ismx) {
         $schema = $2;
    }
}


$converter->output_string( \$body );
$converter->parse_string_document($total_body);
$body =~ s{.*?<body [^>]+>}{}s;
$body =~ s{</body>\s*</html>\s*$}{};
$n    =~ s{/}{::}g;
$m->print("<h1>$n</h1>");
$m->print("<h2>"._('Schema')."</h2><pre>$schema</pre>") if ($schema);
$body =~ s{<a href="http://search\.cpan\.org/perldoc\?((?:Jifty|$app_name)%3A%3A[^"]+)"([^>]*)>}{<a href="content.html?n=$1"$2>}g;
$body =~ s!</li>\n\t<ul>!<ul>!;
$body =~ s!</ul>!</ul></li>!;
$body =~ s!<p></p>!!;
$body =~ s!<a name=!<a id=!g;
$body =~ s!__index__!index!g;
$m->print($body);
</%PERL>
</body></html>
<%ARGS>
$Target    => '&method=content'
$n  => 'Jifty'
</%ARGS>
