Skip to content

Commit

Permalink
Link to non-raw GitHub page, with edit link
Browse files Browse the repository at this point in the history
Let the pod6 docs link to their non-raw GitHub pages, so visitors can
see and maybe help out on improving some more.  And for convenience,
also provide an edit link.

There's probably some more improvement to do on the footer as well; will
further work on separate commits/PRs.
  • Loading branch information
zakame committed Sep 4, 2017
1 parent f26209e commit d607c78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Pod/Htmlify.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,18 @@ sub footer-html($pod-path) is export {
my $footer = slurp 'template/footer.html';
$footer.subst-mutate(/DATETIME/, ~DateTime.now.utc.truncated-to('seconds'));
my $pod-url;
my $edit-url;
my $gh-link = q[<a href='https://github.com/perl6/doc'>perl6/doc on GitHub</a>];
if $pod-path eq "unknown" {
$pod-url = "the sources at $gh-link";
$edit-url = "";
}
else {
$pod-url = "<a href='https://github.com/perl6/doc/raw/master/doc/$pod-path'>$pod-path\</a\> from $gh-link";
$pod-url = "<a href='https://github.com/perl6/doc/blob/master/doc/$pod-path'>$pod-path\</a\> from $gh-link";
$edit-url = "<a href='https://github.com/perl6/doc/edit/master/doc/$pod-path'>Edit this page\</a\>.";
}
$footer.subst-mutate(/SOURCEURL/, $pod-url);
$footer.subst-mutate(/EDITURL/, $edit-url);
state $source-commit = qx/git rev-parse --short HEAD/.chomp;
$footer.subst-mutate(:g, /SOURCECOMMIT/, $source-commit);

Expand Down
1 change: 1 addition & 0 deletions template/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Generated on DATETIME from SOURCEURL, commit <a href="https://github.com/perl6/doc/commit/SOURCECOMMIT"><span id="footer-commit">SOURCECOMMIT</span></a>.
This is a work in progress to document Perl 6, and known to be
incomplete.
EDITURL
<a href="https://github.com/perl6/doc/blob/master/CONTRIBUTING.md#reporting-bugs">Please report any issues.</a>
Your contribution is appreciated.
</p>
Expand Down

0 comments on commit d607c78

Please sign in to comment.