Просмотр исходного кода

* support new Trillian format
* revert doctype change

Christoph Berg 21 лет назад
Родитель
Сommit
b66bde5ebe
3 измененных файлов с 10 добавлено и 6 удалено
  1. 1 1
      docs/Changelog
  2. 1 2
      modules/Pisg/HTMLGenerator.pm
  3. 8 3
      modules/Pisg/Parser/Format/Trillian.pm

+ 1 - 1
docs/Changelog

@@ -6,11 +6,11 @@ pisg (0.67) - ??
      + Added support for multiple channels in config with the same name.
      + Added support for multiple channels in config with the same name.
        Even multiple channel directives for the very same channel are
        Even multiple channel directives for the very same channel are
        supported (closes SF tracker #967404, patch by Torbjörn Svensson).
        supported (closes SF tracker #967404, patch by Torbjörn Svensson).
-     + Change DTD to XHTML 1.1 Strict (suggested by Torbjörn).
    * Documentation:
    * Documentation:
      + Local options override global ones, not vice-versa.
      + Local options override global ones, not vice-versa.
    * Formats:
    * Formats:
      + Notes on using mIRC.
      + Notes on using mIRC.
+     + support the new Trillian format (thanks, Torbjörn).
    * Languages:
    * Languages:
      + Dutch: small update to shout1 (thanks, Søren Jensen).
      + Dutch: small update to shout1 (thanks, Søren Jensen).
      + Dutch/Flemish: new strings added (thanks, Jeroen van Nimwegen).
      + Dutch/Flemish: new strings added (thanks, Jeroen van Nimwegen).

+ 1 - 2
modules/Pisg/HTMLGenerator.pm

@@ -226,8 +226,7 @@ sub _htmlheader
     my $title = $self->_template_text('pagetitle1', %hash);
     my $title = $self->_template_text('pagetitle1', %hash);
     if($self->{cfg}->{colorscheme} ne "none") {
     if($self->{cfg}->{colorscheme} ne "none") {
         print OUTPUT <<HTML;
         print OUTPUT <<HTML;
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" 
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <html>
 <head>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}" />
 <meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}" />

+ 8 - 3
modules/Pisg/Parser/Format/Trillian.pm

@@ -2,6 +2,11 @@ package Pisg::Parser::Format::Trillian;
 
 
 # Documentation for the Pisg::Parser::Format modules is found in Template.pm
 # Documentation for the Pisg::Parser::Format modules is found in Template.pm
 
 
+# old format:
+# [hh:mm] <nick> says something
+# new v3 format:
+# [hh:mm] nick: says something
+
 use strict;
 use strict;
 $^W = 1;
 $^W = 1;
 
 
@@ -10,7 +15,7 @@ sub new
     my ($type, %args) = @_;
     my ($type, %args) = @_;
     my $self = {
     my $self = {
         cfg => $args{cfg},
         cfg => $args{cfg},
-        normalline => '^\[(\d+):\d+[^ ]+ <([^>]+)> (.*)',
+        normalline => '^\[(\d+):\d+[^ ]+ <?([^*:>]+)[^ ]+ (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*{3}\s(.+)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*{3}\s(.+)',
     };
     };
@@ -29,7 +34,7 @@ sub normalline
         $hash{hour}   = $1;
         $hash{hour}   = $1;
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         $hash{saying} = $3;
         $hash{saying} = $3;
-        $hash{saying} =~ s/\(Link: ((http|https|ftp|telnet|news):\/\/.*?)\)\1/$1/;
+        $hash{saying} =~ s/\(Link: (((http|https|ftp|telnet|news):\/\/|).*?)\)\1/$1/;
 
 
         return \%hash;
         return \%hash;
     } else {
     } else {
@@ -47,7 +52,7 @@ sub actionline
         $hash{hour}   = $1;
         $hash{hour}   = $1;
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         $hash{saying} = $3;
         $hash{saying} = $3;
-        $hash{saying} =~ s/\(Link: ((http|https|ftp|telnet|news):\/\/.*?)\)\1/$1/;
+        $hash{saying} =~ s/\(Link: (((http|https|ftp|telnet|news):\/\/|).*?)\)\1/$1/;
 
 
         return \%hash;
         return \%hash;
     } else {
     } else {