Skip to content

Commit

Permalink
Merge pull request #1533 from zakame/link-to-non-raw-pages-on-github
Browse files Browse the repository at this point in the history
Link to non-raw GitHub page, with edit link
  • Loading branch information
AlexDaniel authored Sep 4, 2017
2 parents 950ad92 + d607c78 commit f7c9224
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 f7c9224

Please sign in to comment.