Skip to content

Commit 2f61c61

Browse files
authored
Merge pull request #1667 from perl6/add-edit-ico
Add edit ico
2 parents b663b04 + 4f224f8 commit 2f61c61

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

assets/sass/style.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,19 @@ a[href*="//"]:not([href*="perl6.org"])::after,
556556
padding-left: 2px;
557557
content: url(/images/External-link-04-bold-12x12.svg);
558558
}
559+
560+
561+
.pencil{
562+
background: #fff; /* Old browsers */
563+
background: -moz-linear-gradient(top, #ffffff 0%, #ededed 100%); /* FF3.6+ */
564+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
565+
background: -webkit-linear-gradient(top, #ffffff 0%,#ededed 100%); /* Chrome10+,Safari5.1+ */
566+
background: -o-linear-gradient(top, #ffffff 0%,#ededed 100%); /* Opera11.10+ */
567+
background: -ms-linear-gradient(top, #ffffff 0%,#ededed 100%); /* IE10+ */
568+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
569+
background: linear-gradient(top, #ffffff 0%,#ededed 100%); /* W3C */
570+
border: 1px solid #CCCCCC;
571+
color: #777777;
572+
cursor: pointer;
573+
overflow: visible; border-radius: 4px 4px 4px 4px;
574+
}

html/images/External-link-04-bold-12x12.svg

Lines changed: 0 additions & 1 deletion
Loading

html/images/pencil.svg

Lines changed: 9 additions & 0 deletions
Loading

htmlify.p6

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ my @menu =
8585
;
8686

8787
my $head = slurp 'template/head.html';
88-
sub header-html($current-selection = 'nothing selected') is cached {
88+
89+
sub header-html($current-selection, $pod-path) is cached {
8990
state $header = slurp 'template/header.html';
9091

9192
my $menu-items = [~]
@@ -112,15 +113,25 @@ sub header-html($current-selection = 'nothing selected') is cached {
112113
q[</div>];
113114
}
114115

115-
state $menu-pos = ($header ~~ /MENU/).from;
116-
$header.subst('MENU', :p($menu-pos), $menu-items ~ $sub-menu-items);
116+
my $edit-url = "";
117+
if defined $pod-path {
118+
$edit-url = qq[
119+
<div align="right">
120+
<button title="Edit this page" class="pencil" onclick="location='https://github.com/perl6/doc/edit/master/doc/$pod-path'">
121+
{svg-for-file("html/images/pencil.svg")}
122+
</button>
123+
</div>]
124+
}
125+
126+
$header.subst('MENU', $menu-items ~ $sub-menu-items)
127+
.subst('EDITURL', $edit-url);
117128
}
118129

119-
sub p2h($pod, $selection = 'nothing selected', :$pod-path = 'unknown') {
130+
sub p2h($pod, $selection = 'nothing selected', :$pod-path = Nil) {
120131
pod2html $pod,
121132
:url(&rewrite-url),
122133
:$head,
123-
:header(header-html $selection),
134+
:header(header-html($selection, $pod-path)),
124135
:footer(footer-html($pod-path)),
125136
:default-title("Perl 6 Documentation"),
126137
:css-url(''), # disable Pod::To::HTML's default CSS
@@ -331,7 +342,7 @@ multi write-type-source($doc) {
331342
$graph-contents .= subst('PODNAME', $podname);
332343
$graph-contents .= subst('INLINESVG', svg-for-file("html/images/type-graph-$podname.svg"));
333344

334-
$pod.contents.append:
345+
$pod.contents.append:
335346
pod-heading("Type Graph"),
336347
Pod::Raw.new(
337348
target => 'html',

lib/Pod/Htmlify.pm6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ sub footer-html($pod-path) is export {
9595
my $pod-url;
9696
my $edit-url;
9797
my $gh-link = q[<a href='https://github.com/perl6/doc'>perl6/doc on GitHub</a>];
98-
if $pod-path eq "unknown" {
98+
if not defined $pod-path {
9999
$pod-url = "the sources at $gh-link";
100100
$edit-url = ".";
101101
}

template/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
</div>
1818
</div>
1919
<div id="content" class="pretty-box yellow">
20+
EDITURL

0 commit comments

Comments
 (0)