mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-28 03:20:54 +01:00
Add table of contents to quotegrabs html export
This commit is contained in:
parent
7cf8e91ab2
commit
b6a09e50e3
@ -116,7 +116,6 @@ sub export_quotegrabs() {
|
|||||||
return "Not enabled" if not defined $self->{export_path};
|
return "Not enabled" if not defined $self->{export_path};
|
||||||
my $text;
|
my $text;
|
||||||
my $table_id = 1;
|
my $table_id = 1;
|
||||||
my $last_channel = "";
|
|
||||||
my $had_table = 0;
|
my $had_table = 0;
|
||||||
open FILE, "> $self->{export_path}" or return "Could not open export path.";
|
open FILE, "> $self->{export_path}" or return "Could not open export path.";
|
||||||
my $time = localtime;
|
my $time = localtime;
|
||||||
@ -125,9 +124,20 @@ sub export_quotegrabs() {
|
|||||||
print FILE '<script type="text/javascript" src="js/jquery.tablesorter.js"></script>' . "\n";
|
print FILE '<script type="text/javascript" src="js/jquery.tablesorter.js"></script>' . "\n";
|
||||||
print FILE "</head>\n<body><i>Generated at $time</i><hr><h2>Candide's Quotegrabs</h2>\n";
|
print FILE "</head>\n<body><i>Generated at $time</i><hr><h2>Candide's Quotegrabs</h2>\n";
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
|
|
||||||
|
my $last_channel = "";
|
||||||
|
foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or $$a{nick} cmp $$b{nick} } @{ $self->{quotegrabs} }) {
|
||||||
|
if(not $quotegrab->{channel} =~ /^$last_channel$/i) {
|
||||||
|
print FILE "<a href='#" . $quotegrab->{channel} . "'>" . encode_entities($quotegrab->{channel}) . "</a><br>\n";
|
||||||
|
$last_channel = $quotegrab->{channel};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_channel = "";
|
||||||
foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or $$a{nick} cmp $$b{nick} } @{ $self->{quotegrabs} }) {
|
foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or $$a{nick} cmp $$b{nick} } @{ $self->{quotegrabs} }) {
|
||||||
if(not $quotegrab->{channel} =~ /^$last_channel$/i) {
|
if(not $quotegrab->{channel} =~ /^$last_channel$/i) {
|
||||||
print FILE "</tbody>\n</table>\n" if $had_table;
|
print FILE "</tbody>\n</table>\n" if $had_table;
|
||||||
|
print FILE "<a name='" . $quotegrab->{channel} . "'></a>\n";
|
||||||
print FILE "<hr><h3>$quotegrab->{channel}</h3><hr>\n";
|
print FILE "<hr><h3>$quotegrab->{channel}</h3><hr>\n";
|
||||||
print FILE "<table border=\"0\" id=\"table$table_id\" class=\"tablesorter\">\n";
|
print FILE "<table border=\"0\" id=\"table$table_id\" class=\"tablesorter\">\n";
|
||||||
print FILE "<thead>\n<tr>\n";
|
print FILE "<thead>\n<tr>\n";
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 448,
|
BUILD_REVISION => 449,
|
||||||
BUILD_DATE => "2013-10-13",
|
BUILD_DATE => "2013-10-13",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user