Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Put the templates in the template files :P
  • Loading branch information
Mouq committed Feb 7, 2015
1 parent e340b18 commit d0f3d01
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 37 deletions.
39 changes: 10 additions & 29 deletions htmlify.p6
Expand Up @@ -45,10 +45,10 @@ sub header-html ($current-selection = 'nothing selected') is cached {

my $menu-items = [~]
q[<div class="menu-items dark-green">],
@menu>>.key.map({qq[
<a class="menu-item {.[0] eq $current-selection ?? "selected darker-green" !! ""}"
href="/{.[0]}.html">
{ .[1] || .[0].wordcase }
@menu>>.key.map(-> ($dir, $name) {qq[
<a class="menu-item {$dir eq $current-selection ?? "selected darker-green" !! ""}"
href="/$dir.html">
{ $name || $dir.wordcase }
</a>
]}), #"
q[</div>];
Expand All @@ -67,13 +67,13 @@ sub header-html ($current-selection = 'nothing selected') is cached {
q[</div>]
}

$header.subst('MENU', qq[
<div class="menu">
$menu-items
$sub-menu-items
</div>
])
state $menu-pos = ($header ~~ /MENU/).from;
$header.subst('MENU', :p($menu-pos), $menu-items ~ $sub-menu-items);
}

sub footer-html() {
my $footer = slurp 'template/footer.html';
$footer.subst('DATETIME', ~DateTime.now);
}

sub p2h($pod, $selection = 'nothing selected') {
Expand Down Expand Up @@ -721,23 +721,4 @@ sub write-qualified-method-call(:$name!, :$pod!, :$type!) {
spurt "html/routine/{$type}.{$name}.html", p2h($p, 'routine');
}

sub footer-html() {
state $dt = ~DateTime.now;
my $footer = slurp 'template/footer_template.html';
my $footer_content = qq[
<p>
Generated on $dt from the sources at
<a href="https://github.com/perl6/doc">perl6/doc on github</a>.
This is a work in progress to document Perl 6, and known to be
incomplete. Your contribution is appreciated.
</p>
<p>
This documentation is provided under the terms of the Artistic
License 2.0.
The Camelia image is copyright 2009 by Larry Wall.
</p>
];
$footer.subst('CONTENT', $footer_content);
}

# vim: expandtab shiftwidth=4 ft=perl6
17 changes: 17 additions & 0 deletions template/footer.html
@@ -0,0 +1,17 @@
</div>
</div>
<div id="footer-wrapper">
<div id="footer" class="pretty-box yellow">
<p>
Generated on DATETIME from the sources at
<a href="https://github.com/perl6/doc">perl6/doc on github</a>.
This is a work in progress to document Perl 6, and known to be
incomplete. Your contribution is appreciated.
</p>
<p>
This documentation is provided under the terms of the Artistic
License 2.0.
The Camelia image is copyright 2009 by Larry Wall.
</p>
</div> <!-- footer -->
</div> <!-- footer-wrapper -->
7 changes: 0 additions & 7 deletions template/footer_template.html

This file was deleted.

4 changes: 3 additions & 1 deletion template/header.html
Expand Up @@ -6,7 +6,9 @@
<div id="search" class="ui-widget">
<div class="green"><input placeholder="Search" id="query" title="Enter Perl 6 document to search for"></div>
</div>
MENU
<div class="menu">
MENU
</div>
</div>
<div id="content-wrapper">
<div id="content" class="pretty-box yellow">

0 comments on commit d0f3d01

Please sign in to comment.