Преглед изворни кода

* support new Trillian format
* revert doctype change

Christoph Berg пре 21 година
родитељ
комит
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.
        Even multiple channel directives for the very same channel are
        supported (closes SF tracker #967404, patch by Torbjörn Svensson).
-     + Change DTD to XHTML 1.1 Strict (suggested by Torbjörn).
    * Documentation:
      + Local options override global ones, not vice-versa.
    * Formats:
      + Notes on using mIRC.
+     + support the new Trillian format (thanks, Torbjörn).
    * Languages:
      + Dutch: small update to shout1 (thanks, Søren Jensen).
      + 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);
     if($self->{cfg}->{colorscheme} ne "none") {
         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>
 <head>
 <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
 
+# old format:
+# [hh:mm] <nick> says something
+# new v3 format:
+# [hh:mm] nick: says something
+
 use strict;
 $^W = 1;
 
@@ -10,7 +15,7 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        normalline => '^\[(\d+):\d+[^ ]+ <([^>]+)> (.*)',
+        normalline => '^\[(\d+):\d+[^ ]+ <?([^*:>]+)[^ ]+ (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*{3}\s(.+)',
     };
@@ -29,7 +34,7 @@ sub normalline
         $hash{hour}   = $1;
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         $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;
     } else {
@@ -47,7 +52,7 @@ sub actionline
         $hash{hour}   = $1;
         ($hash{nick}  = $2) =~ s/^[@%\+~&]//o; # Remove prefix
         $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;
     } else {