Permalink
Browse files

Merge pull request #7 from prakashk/master

Make summary mode sticky, when prev/next day links are clicked
  • Loading branch information...
2 parents ba62875 + 2e4526c commit ceeec37544b6f91fca113167497a25d605177bc8 @moritz committed Apr 5, 2013
Showing with 50 additions and 6 deletions.
  1. +6 −0 cgi/out.pl
  2. +14 −5 cgi/template/linkblock.tmpl
  3. +30 −1 lib/IrcLog/WWW.pm
View
@@ -237,6 +237,9 @@ sub irclog_output {
# where the hell does the leading double slash come from?
$next_url =~ s{^//+}{/};
$t->param(NEXT_URL => $next_url);
+ if ($summary) {
+ $t->param(NEXT_DATE => $tomorrow);
+ }
}
my $yesterday = date($date) - 1;
@@ -246,6 +249,9 @@ sub irclog_output {
my $prev_url = $base_url . "$channel/$yesterday";
$prev_url =~ s{^//+}{/};
$t->param(PREV_URL => $prev_url);
+ if ($summary) {
+ $t->param(PREV_DATE => $yesterday);
+ }
}
}
@@ -1,12 +1,21 @@
- <p><TMPL_IF NAME=PREV_URL><a href="<TMPL_VAR NAME=PREV_URL>" rel="prev">&larr; Previous
- day</a> |</TMPL_IF>
+ <p><TMPL_IF NAME=PREV_URL>
+ <TMPL_IF NAME=IS_SUMMARY>
+ <a href="<TMPL_VAR NAME=BASE_URL>out.pl?channel=<TMPL_VAR NAME=CHANNEL>;date=<TMPL_VAR NAME=PREV_DATE>;summary=1" rel="prev">
+ <TMPL_ELSE>
+ <a href="<TMPL_VAR NAME=PREV_URL>" rel="prev">
+ </TMPL_IF>&larr; Previous day</a> |
+ </TMPL_IF>
<a href="<TMPL_VAR NAME=BASE_URL>">Channels</a> |
<a href="<TMPL_VAR NAME=BASE_URL><TMPL_VAR NAME=CHANNEL>/">#<TMPL_VAR
CHANNEL> index</a> |
- <a href="<TMPL_VAR NAME=BASE_URL><TMPL_VAR NAME=CHANNEL>/today">Today</a> |
+ <a href="<TMPL_VAR NAME=BASE_URL><TMPL_VAR NAME=CHANNEL>/today<TMPL_IF NAME=IS_SUMMARY>?summary=1</TMPL_IF>">Today</a> |
<TMPL_IF NAME=NEXT_URL>
- <a href="<TMPL_VAR NAME=NEXT_URL>" rel="next">Next day &rarr;</a> |
- </TMPL_IF>
+ <TMPL_IF NAME=IS_SUMMARY>
+ <a href="<TMPL_VAR NAME=BASE_URL>out.pl?channel=<TMPL_VAR NAME=CHANNEL>;date=<TMPL_VAR NAME=NEXT_DATE>;summary=1" rel="next">
+ <TMPL_ELSE>
+ <a href="<TMPL_VAR NAME=NEXT_URL>" rel="next">
+ </TMPL_IF>Next day &rarr;</a> |
+ </TMPL_IF>
<a href="<TMPL_VAR BASE_URL>search.pl?channel=<TMPL_VAR CHANNEL>">Search</a> |
<a href="http://www.google.com/search?q=site%3Airclog.perlgeek.de+inurl%3A<TMPL_VAR NAME=CHANNEL ESCAPE=URL>">Google Search</a>
<TMPL_IF NAME=DATE>| <a href="<TMPL_VAR
View
@@ -319,6 +319,30 @@ my $re_links = qr/(?!)/;
}
+sub github_links {
+ my ($key, $state, $channel, $nick) = @_;
+ if ($key =~ m/^GH/i) {
+ $key =~ m/(\d+)/;
+ if ($channel eq "parrot") {
+ return qq{<a href="https://github.com/parrot/parrot/issues/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ elsif ($channel eq "moe") {
+ return qq{<a href="https://github.com/MoeOrganization/moe/issues/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ }
+ elsif ($key =~ m/^pull request/i) {
+ if ($channel eq "moe") {
+ return qq{<a href="https://github.com/MoeOrganization/moe/pull/$1">}
+ . encode_entities($key, ENTITIES)
+ . qq{</a> };
+ }
+ }
+}
+
sub rt_links {
my ($key, $state) = @_;
if ($key =~ m/^tt/i) {
@@ -386,7 +410,12 @@ my %output_chain = (
static_links => {
re => $re_links,
match => \&expand_links,
- rest => 'rt_links'
+ rest => 'github_links'
+ },
+ github_links => {
+ re => qr{(?i:\b(?:GH|pull request)\s*)?#\d{2,6}\b},
+ match => \&github_links,
+ rest => 'rt_links',
},
rt_links => {
re => qr{(?i:\btt\s*)?#\d{2,6}\b},

0 comments on commit ceeec37

Please sign in to comment.