Skip to content

Commit 501286f

Browse files
committed
Support a <base> element
1 parent d0127e8 commit 501286f

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

bin/mksite

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ use v5.14;
77

88
use App::CPANModuleSite;
99

10-
@ARGV or die "Usage: $0 <distribution_name>\n";
10+
@ARGV or die "Usage: $0 <distribution_name> [<base_url>]\n";
1111

12-
my $app = App::CPANModuleSite->new($ARGV[0]);
12+
my $args = { distribution => $ARGV[0] };
13+
if (@ARGV > 1) {
14+
$args->{base} = $ARGV[1];
15+
}
16+
17+
my $app = App::CPANModuleSite->new($args);
1318

1419
$app->run;
1520

lib/App/CPANModuleSite.pm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It's probably not particularly useful to use the class directly.
1313

1414
package App::CPANModuleSite;
1515

16-
our $VERSION = '0.0.6';
16+
our $VERSION = '0.0.1';
1717

1818
use v5.14;
1919

@@ -105,6 +105,7 @@ sub _build_tt_config {
105105
distribution => $self->distribution,
106106
release => $self->release,
107107
modules => $self->modules,
108+
base => $self->base,
108109
},
109110
}
110111
}
@@ -168,6 +169,12 @@ sub _build_wrapper {
168169
return 'page.tt';
169170
}
170171

172+
has base => (
173+
is => 'ro',
174+
isa => 'Str',
175+
default => '',
176+
);
177+
171178
around BUILDARGS => sub {
172179
my $orig = shift;
173180
my $class = shift;

share/tt_lib/page.tt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<!doctype html>
33
<html lang="en">
44
<head>
5+
[% IF base -%]
6+
<base href="[% base %]">
7+
[% END -%]
58
<!-- Required meta tags -->
69
<meta charset="utf-8">
710
<meta name="viewport" content="width=device-width, initial-scale=1">

0 commit comments

Comments
 (0)