Improving the hrefs.
This commit is contained in:
parent
cce5201ddd
commit
b17bc3b8dc
@ -9,6 +9,8 @@ use Data::Dumper;
|
||||
|
||||
use Path::Tiny qw/path/;
|
||||
use Mojo::Template;
|
||||
use Mojo::DOM;
|
||||
use File::pushd;
|
||||
|
||||
my $current_dir = path(__FILE__)->parent->parent->child('lib');
|
||||
|
||||
@ -19,9 +21,7 @@ $current_dir->visit(
|
||||
return if $path !~ /\.pm$/;
|
||||
system mkdir => '-pv', 'doc/' . $path->parent;
|
||||
system pod2html => $path,
|
||||
'-o', 'doc/' . $path . '.html', '--htmldir',
|
||||
$current_dir->child('./doc')->realpath, '--podpath', 'lib',
|
||||
'--recurse';
|
||||
'-o', 'doc/' . $path . '.html', '--recurse';
|
||||
}
|
||||
},
|
||||
{ recurse => 1 }
|
||||
@ -39,7 +39,29 @@ $documentation_path->visit(
|
||||
return;
|
||||
}
|
||||
$modules{ $path =~ s{^.*/lib/}{}r =~ s/\.pm\.html$//r =~ s{/}{::}gr } =
|
||||
''.$path=~s/doc\///r;
|
||||
$path
|
||||
},
|
||||
{ recurse => 1 },
|
||||
);
|
||||
$documentation_path->visit(
|
||||
sub {
|
||||
my ( $path, $state ) = @_;
|
||||
if ( !-f $path ) {
|
||||
return;
|
||||
}
|
||||
if ( $path !~ /\.pm\.html$/ ) {
|
||||
return;
|
||||
}
|
||||
my $html = Mojo::DOM->new($path->slurp_utf8);
|
||||
for my $a ($html->find('a')->each) {
|
||||
next if $a->{href};
|
||||
if (exists $modules{$a->text}) {
|
||||
$a->{href} = relativize_path($path, $modules{$a->text});
|
||||
next;
|
||||
}
|
||||
$a->{href} = "https://metacpan.org/pod/@{[$a->text]}";
|
||||
}
|
||||
$path->spew_utf8(''.$html);
|
||||
},
|
||||
{ recurse => 1 },
|
||||
);
|
||||
@ -47,6 +69,7 @@ $documentation_path->visit(
|
||||
my $mojo_template = Mojo::Template->new;
|
||||
my $html = $mojo_template->render(<<'EOF', \%modules);
|
||||
% my ($modules) = @_;
|
||||
% use Path::Tiny;
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
@ -56,7 +79,7 @@ my $html = $mojo_template->render(<<'EOF', \%modules);
|
||||
<ul>
|
||||
% for my $module (sort { $a cmp $b } keys %$modules) {
|
||||
<li>
|
||||
<a href="<%=$modules->{$module}%>"><%=$module%></a>
|
||||
<a href="<%=path($modules->{$module})->relative('doc')%>"><%=$module%></a>
|
||||
</li>
|
||||
% }
|
||||
</ul>
|
||||
@ -65,3 +88,9 @@ my $html = $mojo_template->render(<<'EOF', \%modules);
|
||||
EOF
|
||||
|
||||
$documentation_path->child('index.html')->spew_utf8($html);
|
||||
|
||||
sub relativize_path {
|
||||
my $current_path = $_[0];
|
||||
my $foreign_path = $_[1];
|
||||
return $foreign_path->relative($current_path->parent);
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Peace - Onlie GNU/Linux flatpak apps store.</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<title />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<title />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<title />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<title />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Peace::DB - Database handler generator for the Peace shop.</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -62,7 +62,7 @@ my $dbh = Peace::DB->dbh( config => $config );</code></pre>
|
||||
|
||||
<h1 id="SEE-ALSO">SEE ALSO</h1>
|
||||
|
||||
<p><a>DBI</a>, <a>DBD::Pg</a>, <a href="/lib/Peace.html">Peace</a></p>
|
||||
<p><a href="https://metacpan.org/pod/DBI">DBI</a>, <a href="https://metacpan.org/pod/DBD::Pg">DBD::Pg</a>, <a href="../Peace.pm.html">Peace</a></p>
|
||||
|
||||
|
||||
</body>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Peace::Model::Application - The application object representation.</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -129,7 +129,7 @@ $application->url($url);</code></pre>
|
||||
|
||||
$application->developer($developer);</code></pre>
|
||||
|
||||
<p>Allows to retrieve and set the application's developer which is a <a>Peace::Model::Developer</a>.</p>
|
||||
<p>Allows to retrieve and set the application's developer which is a <a href="Developer.pm.html">Peace::Model::Developer</a>.</p>
|
||||
|
||||
<h2 id="price">price</h2>
|
||||
|
||||
@ -165,7 +165,7 @@ $application->verified($verified);</code></pre>
|
||||
|
||||
<h1 id="SEE-ALSO">SEE ALSO</h1>
|
||||
|
||||
<p><a>Peace::Model::Developer</a>, <a>Peace::DAO::Application</a></p>
|
||||
<p><a href="Developer.pm.html">Peace::Model::Developer</a>, <a href="../DAO/Application.pm.html">Peace::DAO::Application</a></p>
|
||||
|
||||
|
||||
</body>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Peace::Model::Customer - The customer object representation.</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -96,7 +96,7 @@ $customer->stripe_id($stripe_id);</code></pre>
|
||||
|
||||
<h1 id="SEE-ALSO">SEE ALSO</h1>
|
||||
|
||||
<p><a>Peace::DAO::Customer</a></p>
|
||||
<p><a href="../DAO/Customer.pm.html">Peace::DAO::Customer</a></p>
|
||||
|
||||
|
||||
</body>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Peace::Model::Developer - The developer object representation.</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -83,7 +83,7 @@
|
||||
|
||||
<pre><code>my $applications = $developer->applications;</code></pre>
|
||||
|
||||
<p>Allows to retrieve the developer's applications which is a arrayref of <a>Peace::Model::Application</a>.</p>
|
||||
<p>Allows to retrieve the developer's applications which is a arrayref of <a href="Application.pm.html">Peace::Model::Application</a>.</p>
|
||||
|
||||
<h2 id="uuid">uuid</h2>
|
||||
|
||||
@ -157,7 +157,7 @@ $developer->verified($verified);</code></pre>
|
||||
|
||||
<h1 id="SEE-ALSO">SEE ALSO</h1>
|
||||
|
||||
<p><a>Peace::DAO::Developer</a>, <a>Peace::Model::Application</a></p>
|
||||
<p><a href="../DAO/Developer.pm.html">Peace::DAO::Developer</a>, <a href="Application.pm.html">Peace::Model::Application</a></p>
|
||||
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user