repo
string
commit
string
message
string
diff
string
sattellite/perl
d5651e9fe7e89f9c0c983bf9e9a28f1328ca6a0e
Some little changes in code
diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl index 31b51b1..094da59 100644 --- a/tv_anounce/tv-programme.pl +++ b/tv_anounce/tv-programme.pl @@ -1,90 +1,86 @@ #!/usr/bin/env perl use strict; use warnings; no warnings "all"; use XML::Simple; use IO::File; use File::Path qw(make_path); use utf8; -my $fh = IO::File->new( 'xmltv.xml' ); -my $file = XMLin( $fh ); - -my %mon = ( - '01' => 'января', - '02' => 'февраля', - '03' => 'марта', - '04' => 'апреля', - '05' => 'мая', - '06' => 'июня', - '07' => 'июля', - '08' => 'августа', - '09' => 'сентября', - '10' => 'октября', - '11' => 'ноября', - '12' => 'декабря', -); - -my %day = ( - '1' => 'Понедельник. ', - '2' => 'Вторник. ', - '3' => 'Среда. ', - '4' => 'Четверг. ', - '5' => 'Пятница. ', - '6' => 'Суббота. ', - '7' => 'Воскресенье. ', - '8' => 'Понедельник. ', -); - -my @IDs = qw(1 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); - -my $dir = &dat(); -make_path $dir unless -d $dir; - -foreach my $n ( @IDs ) { - my $a = "1"; +my %month = ( '01' => 'января', '02' => 'февраля', + '03' => 'марта', '04' => 'апреля', + '05' => 'мая', '06' => 'июня', + '07' => 'июля', '08' => 'августа', + '09' => 'сентября', '10' => 'октября', + '11' => 'ноября', '12' => 'декабря' ); + +my %day = ( '1' => 'Понедельник. ', '2' => 'Вторник. ', + '3' => 'Среда. ', '4' => 'Четверг. ', + '5' => 'Пятница. ', '6' => 'Суббота. ', + '7' => 'Воскресенье. ', '8' => 'Понедельник. ' ); + +my $fileHandle = IO::File->new( 'xmltv.xml' ); +my $xmlTree = XMLin( $fileHandle ); + +my $directory = &date(); +make_path $directory unless -d $directory; + +my @channelID = qw(1 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); + +my $progData = $xmlTree->{'programme'}; + +foreach my $channel ( @channelID ) { + my $dayCounter = "1"; my ( $times, $d, $title, $out ); - my $cr_file = "$file->{'channel'}->{$n}->{'display-name'}->{'content'}"; - for ( my $i = 0; $i < @{$file->{'programme'}}; $i++ ) { - if ( ($file->{'programme'}->["$i"]{'channel'}) == $n ) { - my $date = $file->{'programme'}->["$i"]->{'start'}; + my $createFile = "$xmlTree->{'channel'}->{$channel}->{'display-name'}->{'content'}"; + for ( my $i = 0; $i < @$progData; $i++ ) { + my $progNow = @$progData->["$i"]; + if ( ( $progNow->{'channel'} ) == $channel ) { + + my $date = $progNow->{'start'}; - if ( $file->{'programme'}->["$i"]->{'desc'}->{'content'} ) { - $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}."\n<br><em>".$file->{'programme'}->["$i"]->{'desc'}->{'content'}.'</em><br>'; + if ( $progNow->{'desc'}->{'content'} ) { + $title = $progNow->{'title'}->{'content'}."\n<br><em>".$progNow->{'desc'}->{'content'}.'</em><br>'; } else { - $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}.'<br>'; + $title = $progNow->{'title'}->{'content'}.'<br>'; } $date =~ m/(....)(..)(..)(..)(..).+?/si; if ( $d ne $3 ) { - $times = '<br><h3><strong>'.$day{$a}.$3.' '.$mon{"$2"}."<\/strong><\/h3><hr><br>\n<strong><span style=\"color: #3366ff\">".$4.':'.$5.'</span></strong>'; + $times = '<br><h3><strong>'.$day{"$dayCounter"}.$3.' '.$month{"$2"}."<\/strong><\/h3><hr><br>\n<strong><span style=\"color: #3366ff\">".$4.':'.$5.'</span></strong>'; $d = $3; - $a++; + $dayCounter++; } else { $times = '<strong><span style="color: #3366ff">'.$4.':'.$5.'</span></strong>'; } $out .= "$times $title\n"; } } - open ( CH, ">", "$dir/$cr_file" ); - print CH $out; - close CH; - print "Создан файл \"$cr_file\"\n"; + $out =~ s/^<br><h3>/<h3>/i; + &writeToFile( $createFile, $out ); } -sub dat +sub date { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $d ) == 1) { $d = '0'.$d }; if(scalar split( '', $m ) == 1) { $m = '0'.$m }; my $dat = $y.'-'.$m.'-'.$d; return $dat; -} +} # date + +sub writeToFile +{ # Запись в файл + open (FILE, ">", "$directory/$_[0]" ); + print FILE $_[1]; + close FILE; + print "Создан файл: \"$_[0]\"\n"; +} # writeToFile
sattellite/perl
7cde18bdd97c86829c43aa93c0eb8ea88f875598
A very ugly code
diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl index 26e8130..31b51b1 100644 --- a/tv_anounce/tv-programme.pl +++ b/tv_anounce/tv-programme.pl @@ -1,84 +1,90 @@ #!/usr/bin/env perl use strict; use warnings; no warnings "all"; use XML::Simple; use IO::File; use File::Path qw(make_path); use utf8; my $fh = IO::File->new( 'xmltv.xml' ); my $file = XMLin( $fh ); my %mon = ( '01' => 'января', '02' => 'февраля', '03' => 'марта', '04' => 'апреля', '05' => 'мая', '06' => 'июня', '07' => 'июля', '08' => 'августа', '09' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря', ); my %day = ( '1' => 'Понедельник. ', '2' => 'Вторник. ', '3' => 'Среда. ', '4' => 'Четверг. ', '5' => 'Пятница. ', '6' => 'Суббота. ', '7' => 'Воскресенье. ', '8' => 'Понедельник. ', ); my @IDs = qw(1 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); my $dir = &dat(); make_path $dir unless -d $dir; foreach my $n ( @IDs ) { my $a = "1"; - my ($times, $d, $title); + my ( $times, $d, $title, $out ); my $cr_file = "$file->{'channel'}->{$n}->{'display-name'}->{'content'}"; - for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { + for ( my $i = 0; $i < @{$file->{'programme'}}; $i++ ) { if ( ($file->{'programme'}->["$i"]{'channel'}) == $n ) { my $date = $file->{'programme'}->["$i"]->{'start'}; - $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}; + + if ( $file->{'programme'}->["$i"]->{'desc'}->{'content'} ) { + $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}."\n<br><em>".$file->{'programme'}->["$i"]->{'desc'}->{'content'}.'</em><br>'; + } else { + $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}.'<br>'; + } + $date =~ m/(....)(..)(..)(..)(..).+?/si; if ( $d ne $3 ) { - $times = $day{$a}.$3.' '.$mon{"$2"}."\n".$4.':'.$5; + $times = '<br><h3><strong>'.$day{$a}.$3.' '.$mon{"$2"}."<\/strong><\/h3><hr><br>\n<strong><span style=\"color: #3366ff\">".$4.':'.$5.'</span></strong>'; $d = $3; $a++; } else { - $times = $4.':'.$5; + $times = '<strong><span style="color: #3366ff">'.$4.':'.$5.'</span></strong>'; } - - open (CH, ">>", "$dir/$cr_file" ); - print CH "$times $title\n"; - close CH; -# print "$times $title\n"; + + $out .= "$times $title\n"; } } + open ( CH, ">", "$dir/$cr_file" ); + print CH $out; + close CH; print "Создан файл \"$cr_file\"\n"; } sub dat { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $d ) == 1) { $d = '0'.$d }; if(scalar split( '', $m ) == 1) { $m = '0'.$m }; my $dat = $y.'-'.$m.'-'.$d; return $dat; }
sattellite/perl
d1de584f3bcff7153ea28013aa226e76faf330ef
Ugly code, but it works
diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl index d266dc0..26e8130 100644 --- a/tv_anounce/tv-programme.pl +++ b/tv_anounce/tv-programme.pl @@ -1,54 +1,84 @@ #!/usr/bin/env perl use strict; use warnings; no warnings "all"; -use Data::Dumper; use XML::Simple; use IO::File; +use File::Path qw(make_path); use utf8; -my $fh = IO::File->new( 'channels.xml' ); +my $fh = IO::File->new( 'xmltv.xml' ); my $file = XMLin( $fh ); -#print Dumper( $file ); -print key $file->{"channel"}; +my %mon = ( + '01' => 'января', + '02' => 'февраля', + '03' => 'марта', + '04' => 'апреля', + '05' => 'мая', + '06' => 'июня', + '07' => 'июля', + '08' => 'августа', + '09' => 'сентября', + '10' => 'октября', + '11' => 'ноября', + '12' => 'декабря', +); +my %day = ( + '1' => 'Понедельник. ', + '2' => 'Вторник. ', + '3' => 'Среда. ', + '4' => 'Четверг. ', + '5' => 'Пятница. ', + '6' => 'Суббота. ', + '7' => 'Воскресенье. ', + '8' => 'Понедельник. ', +); -my @IDs = qw(1);# 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); +my @IDs = qw(1 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); + +my $dir = &dat(); +make_path $dir unless -d $dir; foreach my $n ( @IDs ) { - print "$file->{'channel'}->{$n}->{'display-name'}->{'content'}\t"; + my $a = "1"; + my ($times, $d, $title); + my $cr_file = "$file->{'channel'}->{$n}->{'display-name'}->{'content'}"; for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { if ( ($file->{'programme'}->["$i"]{'channel'}) == $n ) { - my $date = &times( $n, $i ); - print "$date\n"; + my $date = $file->{'programme'}->["$i"]->{'start'}; + $title = $file->{'programme'}->["$i"]->{'title'}->{'content'}; + $date =~ m/(....)(..)(..)(..)(..).+?/si; + + if ( $d ne $3 ) { + $times = $day{$a}.$3.' '.$mon{"$2"}."\n".$4.':'.$5; + $d = $3; + $a++; + } else { + $times = $4.':'.$5; + } + + open (CH, ">>", "$dir/$cr_file" ); + print CH "$times $title\n"; + close CH; +# print "$times $title\n"; } } + print "Создан файл \"$cr_file\"\n"; } -sub times -{ # Время - if ( $file->{'programme'}->["$_[1]"]->{'channel'} = $_[0] ) { - my $date = $file->{'programme'}->["$_[1]"]->{'start'}; - $date =~ m/(....)(..)(..)(..)(..).+?/si; - my %mon = ( - '01' => 'января', - '02' => 'февраля', - '03' => 'марта', - '04' => 'апреля', - '05' => 'мая', - '06' => 'июня', - '07' => 'июля', - '08' => 'августа', - '09' => 'сентября', - '10' => 'октября', - '11' => 'ноября', - '12' => 'декабря', - ); - my $times = $3.'-'.$mon{"$2"}.' '.$4.':'.$5; - return $times; -# print "$1\-$2\-$3 $4:$5\n"; - } -} # times +sub dat +{ # Сегодняшняя дата + my ($d,$m,$y) = (localtime(time))[3,4,5]; + $y += 1900; $m += 1; + + # Если число однозначное, то пририсовать ноль к нему + if(scalar split( '', $d ) == 1) { $d = '0'.$d }; + if(scalar split( '', $m ) == 1) { $m = '0'.$m }; + + my $dat = $y.'-'.$m.'-'.$d; + return $dat; +}
sattellite/perl
601d452ad742ff7b90ebd7d30bf0ba81fdce5bfe
Change monthes
diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl index b4c06b2..383614a 100644 --- a/tv_anounce/tv-programme.pl +++ b/tv_anounce/tv-programme.pl @@ -1,40 +1,54 @@ #!/usr/bin/env perl use strict; use warnings; no warnings "all"; use Data::Dumper; use XML::Simple; use IO::File; use utf8; my $fh = IO::File->new( 'channels.xml' ); my $file = XMLin( $fh ); #print Dumper( $file ); print key $file->{"channel"}; my @IDs = qw(1);# 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); foreach my $n ( @IDs ) { print "$file->{'channel'}->{$n}->{'display-name'}->{'content'}\t"; for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { if ( ($file->{'programme'}->["$i"]{'channel'}) == $n ) { my $date = &times( $n, $i ); print "$date\n"; } } } sub times { # Время if ( $file->{'programme'}->["$_[1]"]->{'channel'} = $_[0] ) { my $date = $file->{'programme'}->["$_[1]"]->{'start'}; $date =~ m/(....)(..)(..)(..)(..).+?/si; - my $times = $1.'-'.$2.'-'.$3.' '.$4.':'.$5; + my %mon = ( + '01' => 'января', + '02' => 'февраля', + '03' => 'марта', + '04' => 'апреля', + '05' => 'мая', + '06' => 'июня', + '07' => 'июля', + '08' => 'августа', + '09' => 'сентября', + '10' => 'октября', + '11' => 'ноября', + '12' => 'декабря', + ); + my $times = $1.'-'.$mon{"$2"}.'-'.$3.' '.$4.':'.$5; return $times; # print "$1\-$2\-$3 $4:$5\n"; } } # times \ No newline at end of file
sattellite/perl
cc58c40cf94844435ea416946dc2352c188ddd92
It's really working now
diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl old mode 100755 new mode 100644 index e286b23..b4c06b2 --- a/tv_anounce/tv-programme.pl +++ b/tv_anounce/tv-programme.pl @@ -1,40 +1,40 @@ #!/usr/bin/env perl use strict; use warnings; no warnings "all"; use Data::Dumper; use XML::Simple; use IO::File; use utf8; my $fh = IO::File->new( 'channels.xml' ); my $file = XMLin( $fh ); #print Dumper( $file ); print key $file->{"channel"}; my @IDs = qw(1);# 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); foreach my $n ( @IDs ) { print "$file->{'channel'}->{$n}->{'display-name'}->{'content'}\t"; - if ( $file->{'programme'}->{'channel'} == $n ) { - my $date = &times( $n ); - print $date; + for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { + if ( ($file->{'programme'}->["$i"]{'channel'}) == $n ) { + my $date = &times( $n, $i ); + print "$date\n"; + } } } - sub times { # Время - for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { - if ( $file->{'programme'}->["$i"]->{'channel'} = $_[0] ) { - my $date = $file->{'programme'}->["$i"]->{'start'}; - $date =~ m/(....)(..)(..)(..)(..).+?/si; - my $times = $1.'-'.$2.'-'.$3.' '.$4.':'.$5; -# print "$1\-$2\-$3 $4:$5\n"; - } + if ( $file->{'programme'}->["$_[1]"]->{'channel'} = $_[0] ) { + my $date = $file->{'programme'}->["$_[1]"]->{'start'}; + $date =~ m/(....)(..)(..)(..)(..).+?/si; + my $times = $1.'-'.$2.'-'.$3.' '.$4.':'.$5; + return $times; +# print "$1\-$2\-$3 $4:$5\n"; } -} +} # times \ No newline at end of file
sattellite/perl
2f67679270eaa6e85ead2e90a2491a1611b5ae9e
Now can write only a programms time
diff --git a/parser/.parser.pl.swp b/parser/.parser.pl.swp new file mode 100644 index 0000000..ce5989a Binary files /dev/null and b/parser/.parser.pl.swp differ diff --git a/tv_anounce/.anounce.pl.swp b/tv_anounce/.anounce.pl.swp new file mode 100644 index 0000000..eeb2a67 Binary files /dev/null and b/tv_anounce/.anounce.pl.swp differ diff --git a/tv_anounce/tv-programme.pl b/tv_anounce/tv-programme.pl new file mode 100755 index 0000000..e286b23 --- /dev/null +++ b/tv_anounce/tv-programme.pl @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use strict; +use warnings; +no warnings "all"; + +use Data::Dumper; + +use XML::Simple; +use IO::File; +use utf8; + +my $fh = IO::File->new( 'channels.xml' ); +my $file = XMLin( $fh ); +#print Dumper( $file ); +print key $file->{"channel"}; + + + +my @IDs = qw(1);# 2 676 4 104 101 103 109 209 235 100052 663 226 326 288 300047 289 3 105 300020 595 272 300007 100010 5 107 108 503 300003 727 300035 255 325 222 313 330 100018 100017); + +foreach my $n ( @IDs ) { + print "$file->{'channel'}->{$n}->{'display-name'}->{'content'}\t"; + if ( $file->{'programme'}->{'channel'} == $n ) { + my $date = &times( $n ); + print $date; + } +} + + +sub times +{ # Время + for ( my $i = 0; $i < @{$file->{'programme'}}; $i++) { + if ( $file->{'programme'}->["$i"]->{'channel'} = $_[0] ) { + my $date = $file->{'programme'}->["$i"]->{'start'}; + $date =~ m/(....)(..)(..)(..)(..).+?/si; + my $times = $1.'-'.$2.'-'.$3.' '.$4.':'.$5; +# print "$1\-$2\-$3 $4:$5\n"; + } + } +} diff --git a/weather/.rp5.pl.swp b/weather/.rp5.pl.swp new file mode 100644 index 0000000..c39fcb0 Binary files /dev/null and b/weather/.rp5.pl.swp differ
sattellite/perl
69812ab99c052026af219c5abd53e7599b8aceb3
modified: README modified: weather/weather.pl
diff --git a/README b/README index 7d7d518..68cb6f6 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ ===== PERL scripts ===== = parser - create HTML page from RSSfeed (http://naklon.info/rss/about.htm) = tv_anounce - create anouncements for 19 russian TV chanels = weather - rp5.pl - weather from rp5.ru for Bryansk - - weather - weather from google + - weather.pl - weather from google diff --git a/weather/weather.pl b/weather/weather.pl index fa4dd73..ee8366e 100755 --- a/weather/weather.pl +++ b/weather/weather.pl @@ -1,26 +1,20 @@ #!/usr/bin/env perl use warnings; no warnings "all"; use Weather::Google; use strict; use open qw(:utf8 :std); use utf8; -weather_comm(); - -sub weather_comm { - my ($msg, $city) = @_; - $city = $ARGV[0]; $city = 'Брянск' unless $city; - my $w = new Weather::Google( $city, {language => 'ru'} ); - my @wt = $w->current qw( condition temp_c humidity wind_condition ); - my @wh = $w->tomorrow qw( condition high ); - my $weather = "Погода предоставлена Google\n\n"."Сейчас в городе $city за окном:\n$wt[0]\n". - "Температура: $wt[1] °C\n$wt[2]\n$wt[3]\n\nЗавтра:\n$wh[0]\nТемпература: $wh[1] °C\n"; - unless (scalar @{$w->forecast}) { - print "Тю\n"; - return; - } - print $weather; - -# send_message($msg, $weather); +my ($msg, $city) = @_; +$city = $ARGV[0]; $city = 'Брянск' unless $city; +my $w = new Weather::Google( $city, {language => 'ru'} ); +my @wt = $w->current qw( condition temp_c humidity wind_condition ); +my @wh = $w->tomorrow qw( condition high ); +my $weather = "Погода предоставлена Google\n\n"."Сейчас в городе $city за окном:\n$wt[0]\n". +"Температура: $wt[1] °C\n$wt[2]\n$wt[3]\n\nЗавтра:\n$wh[0]\nТемпература: $wh[1] °C\n"; +unless (scalar @{$w->forecast}) { + print "Тю\n"; + return; } +print $weather;
sattellite/perl
dbaaedca5ada2824972646306f2681b1699d3a39
Weather scripts
diff --git a/README b/README index 3277da2..7d7d518 100644 --- a/README +++ b/README @@ -1,4 +1,7 @@ ===== PERL scripts ===== = parser - create HTML page from RSSfeed (http://naklon.info/rss/about.htm) = tv_anounce - create anouncements for 19 russian TV chanels += weather + - rp5.pl - weather from rp5.ru for Bryansk + - weather - weather from google diff --git a/weather/rp5.pl b/weather/rp5.pl new file mode 100755 index 0000000..54ec8b1 --- /dev/null +++ b/weather/rp5.pl @@ -0,0 +1,49 @@ +#!/usr/bin/env perl +use strict; +#use warnings; + +use XML::DOM; +use LWP; +use utf8; + +my $ua = new LWP::UserAgent(); +my $req = HTTP::Request -> new( GET => 'http://rp5.ru/xml/1859/ru' ); # 1859 - +my $res = $ua -> request( $req ); # Bryansk +my $str = $res -> content; + +if ( $res -> is_success ) { + print &answer(); +} else { + print "Ошибка\n"; +} + +sub parser +{ + my ( $string ) = @_; + my @arr; + my $p = new XML::DOM::Parser; + my $doc = $p -> parse( $str ); + my $root = $doc -> getDocumentElement(); + my $items = $doc -> getElementsByTagName( "$string" ); + for ( my $i = 0; $i < $items -> getLength; $i++ ) { + my $item = $items -> item( $i ); + my $it = $item -> getFirstChild() -> getData(); + push( @arr, $it ); + } + return @arr; +} + +sub answer +{ + my @cloud = &parser( 'cloud_cover' ); + my @temp = &parser( 'temperature' ); + my @city = &parser( 'point_name2' ); + my @date = &parser( 'point_date' ); + my @pres = &parser( 'pressure' ); + my @prec = &parser( 'precipitation' ); + my @humi = &parser( 'humidity' ); + my @wd = &parser( 'wind_direction' ); + my @wv = &parser( 'wind_velocity' ); + my $answer = "Сводка погоды предоставлена RP5.ru\n\nПогода $city[0] ($date[0]):\n\nСегодня утром:\nТемпература: $temp[0] °C\nОблачность: $cloud[0]%\nОсадки: $prec[0] мм\nДавление: $pres[0] мм.рт.ст.\nВлажность: $humi[0]%\nНаправление ветра: $wd[0]\nСкорость ветра: $wv[0] м/с\n\nСегодня вечером:\nТемпература: $temp[1] °C\nОблачность: $cloud[1]%\nОсадки: $prec[1] мм\nДавление: $pres[1] мм.рт.ст.\nВлажность: $humi[1]%\nНаправление ветра: $wd[1]\nСкорость ветра: $wv[1] м/с\n\nЗавтра утром:\nТемпература: $temp[2] °C\nОблачность: $cloud[2]%\nОсадки: $prec[2] мм\nДавление: $pres[2] мм.рт.ст.\nВлажность: $humi[2]%\nНаправление ветра: $wd[2]\nСкорость ветра: $wv[2] м/с\n\nЗавтра вечером:\nТемпература: $temp[3] °C\nОблачность: $cloud[3]%\nОсадки: $prec[3] мм\nДавление: $pres[3] мм.рт.ст.\nВлажность: $humi[3]%\nНаправление ветра: $wd[3]\nСкорость ветра: $wv[3] м/с\n"; + return $answer; +} diff --git a/weather/weather.pl b/weather/weather.pl new file mode 100755 index 0000000..fa4dd73 --- /dev/null +++ b/weather/weather.pl @@ -0,0 +1,26 @@ +#!/usr/bin/env perl +use warnings; +no warnings "all"; +use Weather::Google; +use strict; +use open qw(:utf8 :std); +use utf8; + +weather_comm(); + +sub weather_comm { + my ($msg, $city) = @_; + $city = $ARGV[0]; $city = 'Брянск' unless $city; + my $w = new Weather::Google( $city, {language => 'ru'} ); + my @wt = $w->current qw( condition temp_c humidity wind_condition ); + my @wh = $w->tomorrow qw( condition high ); + my $weather = "Погода предоставлена Google\n\n"."Сейчас в городе $city за окном:\n$wt[0]\n". + "Температура: $wt[1] °C\n$wt[2]\n$wt[3]\n\nЗавтра:\n$wh[0]\nТемпература: $wh[1] °C\n"; + unless (scalar @{$w->forecast}) { + print "Тю\n"; + return; + } + print $weather; + +# send_message($msg, $weather); +}
sattellite/perl
811a40f79c2b434f83031b71520713d4a435309d
Small update some code
diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index 58b47ba..fd23050 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,226 +1,226 @@ #!/usr/bin/env perl use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; use File::Path qw(make_path); my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $week_url = 'http://www.kulichki.tv'; my $ch_url = 'http://www.kulichki.tv/cgi-bin/gpack.cgi'; my $ua = LWP::UserAgent->new; my $w = &week(); my $v = &get_ch(); my %chanels = ( # Список каналов '1' => ["47.$v", 'Первый'], '2' => ["52.$v", 'Россия 1'], '3' => ["41.$v", 'НТВ'], '4' => ["63.$v", 'ТВ-Центр'], '5' => ["65.$v", 'ТНТ'], '6' => ["64.$v", 'ТВ-3'], '7' => ["26.$v", 'ДТВ'], '8' => ["13.$v", 'РенТВ'], '9' => ["59.$v", 'СТС'], '10' => ["49.$v", '5 канал'], '11' => ["53.$v", 'Россия 2'], '12' => ["54.$v", 'Россия К'], '13' => ["27.$v", 'Звезда'], '14' => ["22.$v", 'Беларусь ТВ'], '15' => ["37.$v", 'Мир'], '16' => ["60.$v", 'TV XXI'], '17' => ["62.$v", 'TV 1000'], '18' => ["70.$v", 'Школьник ТВ'], '19' => ["21.$v", 'Viasat History'], ); # Вывести список каналов и выбрать нужный print "Список каналов:\n"; printf "%3s: %s\n", "00", "Все каналы"; for my $key ( sort {$a <=> $b} keys %chanels ) { printf "%3d: %s\n", $key, $chanels{$key}->[1]; } print "Веберите канал из списка: "; my $choise = <STDIN>; chomp( $choise ); # Создать директорию для хранения анонсов my $dir = &dat(); make_path $dir unless -d $dir; # Сформировать анонс if ( $choise eq '00' ) { for my $key ( sort {$a <=> $b} keys %chanels ) { my $p = &pars( &get_an( $chanels{$key}->[0] ) ); my $e = &effect( $p ); &wr( $e, $key ); } } elsif ( $choise =~ /^[1]\d?$/) { my $p = &pars( &get_an( $chanels{$choise}->[0] ) ); my $e = &effect( $p ); &wr( $e, $choise ); } else { print "\nerror: Такого канала не найдено. Внимательней читай что пишешь.\n"; exit; } sub dat { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $d ) == 1) { $d = '0'.$d }; if(scalar split( '', $m ) == 1) { $m = '0'.$m }; my $dat = $y.'-'.$m.'-'.$d; return $dat; } sub wr { # Запись в файл my ( $e, $choise ) = @_; my $file = $chanels{$choise}->[1]; open (CH, ">", "$dir/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { week => $w, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); my $response = $ua -> request( $request ); my $str = &encoding( $response -> content ); return $str; } sub get_ch { # Запрос по каналам my $request = POST($ch_url, Content => { week => $w, pakets => 'anons', }, ); my $response = $ua -> request( $request ); my $str = $response -> content; $str =~ /input type="checkbox" name="chanel" value="(.*?)"/si; $str = (split(/\./, $1))[1]; return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $week_url); my $resw = $ua -> request( $req ); my $week = $resw -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect -{ # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ +{ # Оформление текста под таблицу стилей сайта my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+\d+\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } =head1 ОПИСАНИЕ Создание недельного анонса ТВ прорамм для телевизионных каналов. Создается поддиректория формата I<year>-I<month>-I<day> и в ней создаются файлы с названиями каналов, которые содержат внутри себя HTML-разметку. Программа создана по однйо простой причине - сэконосить себе 3 дня рабочего времени и заниматься более полезной работой на своем рабочем месте. =head1 ИСПОЛЬЗОВАНИЕ ./anounce.pl И выбор номера необходимого канала. =head1 АВТОР Aleksander Groschev E-Mail: L<< E<lt>[email protected]<gt> >> JabberID: L<< E<lt>[email protected]<gt> >> =head1 ЛИЦЕНЗИЯ Эта программа распространяется под лицензией MIT (MIT License) Copyright (c) 2010 Aleksander Groschev Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное Обеспечение"), использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий: Вышеупомянутый копирайт и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения. ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. =head4 TODO 1. Дописать парсинг прочих возможных каналов с нужных сайтов - http://www.viasat-channels.tv/ - http://www.teleguide.info/download/new3/xmltv.xml.gz - На всякий случай http://www.tvpilot.ru/ =cut
sattellite/perl
2617d3f25d74d79d05e641f27778e2e5a6edb2fe
Some updates
diff --git a/parser/parser.pl b/parser/parser.pl index 476760a..613edb2 100755 --- a/parser/parser.pl +++ b/parser/parser.pl @@ -1,108 +1,122 @@ #!/usr/bin/env perl -# Скрипт для парсинга RSS ленты формируемой с помощью модуля RSS для phpBB форума/трекера -# http://naklon.info/rss/about.htm -# Author: sattellite -# E-Mail: sattellite[at]bks-tv.ru -# License: MIT - -# The MIT License -# -# Copyright (c) 2010 sattellite -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - use strict; use warnings; use utf8; use open qw(:utf8 :std); use CGI qw(:standard); use XML::RAI; my $uri = $ENV{QUERY_STRING}; my $q = CGI->new; my $rai = XML::RAI->parse_uri( "http://torrents.bks-tv.ru/forum/rss.php?$uri" ); my $topic = $rai->channel->title; ## Название топика, который сейчас парсится print "\n\n", $q->div({-class => 'topic'}, big("$topic")); ## А это уже комментарии к просматриваемому топику foreach my $item ( @{$rai->items} ) { my $i = $item->description; my $link = $item->link; print $q->start_div({-class => "comment"}), $q->a({-href=>"$link"},&t($item->title)), $q->span({-class=>"date"},&d(&pd($i))), $q->div({-class=>"author"},&au(&pd($i))), $q->div({-class=>"message"},&msg(&pd($i))), $q->end_div; } ## Подпрограммы ## Создание массива, который все содержимое разбивает в элементы по строкам sub pd { my ( $str ) = @_; my @content = split(/\n/, $str); return @content; } ## Выпарсивание топика, а вернее обрезание Названия просматриваемой темы. Остается только сама тема sub t { my $title = $_[0]; $title = (split(/::/, $title))[1]; return $title; } ## Выпарсивание автора комментария sub au { my $author = $_[0]; $author =~ s/<br \/>//sg; return $author; } ## Выпарсивание даты комментария sub d { my $dob = $_[1]; $dob =~ /Добавлено: (.*) \(GMT/sg; my $data = $1; my ($day, $time) = split(/\s/, $data); my %d = ("01"=>"Янв","02"=>"Фев","03"=>"Мар","04"=>"Апр","05"=>"Май","06"=>"Июн","07"=>"Июл","08"=>"Авг","09"=>"Сен","10"=>"Окт","11"=>"Ноя","12"=>"Дек"); my ($y, $m, $d) = split(/-/, $day); my $date = $d.'-'.$d{$m}.'-'.$y.' '.$time; return $date; } ## Выпарсивание конкретно сообщения без лишних полей из RSS и тегов sub msg { my ($a, $b, @msg) = @_; my $msg = join("\n",@msg); $msg =~ s/<br \/>(<span.*span>)<br \/>/$1/sg; return $msg; # Сраная-срань. Массив выводить через функцию в цикле нельзя, поэтому используем костыль, # возвращающий скаляр в исходном виде. В &pd делили по переносу строки, а тут для красоты # восстанавливаем эти самые переносы. } + +=head1 ОПИСАНИЕ + +Скрипт для парсинга RSS ленты формируемой с помощью модуля RSS для phpBB форума/трекера +( L<< http://naklon.info/rss/about.htm >> - ссылка на модуль RSS для phpBB форума ) + +=head1 ИСПОЛЬЗОВАНИЕ + +Настроить любой сервер с поддержкой CGI и запустить в нем этот файл. + +=head1 АВТОР + +Aleksander Groschev +E-Mail: L<< E<lt>[email protected]<gt> >> +JabberID: L<< E<lt>[email protected]<gt> >> + +=head1 ЛИЦЕНЗИЯ + +Эта программа распространяется под лицензией MIT (MIT License) + +Copyright (c) 2010 Aleksander Groschev + +Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного +обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное +Обеспечение"), использовать Программное Обеспечение без ограничений, включая +неограниченное право на использование, копирование, изменение, добавление, публикацию, +распространение, сублицензирование и/или продажу копий Программного Обеспечения, +также как и лицам, которым предоставляется данное Программное Обеспечение, при +соблюдении следующих условий: + +Вышеупомянутый копирайт и данные условия должны быть включены во все копии или +значимые части данного Программного Обеспечения. + +ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ, +ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ +ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ +СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ +УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, +ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ +ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. + +=cut
sattellite/perl
389d6e8952208bc882aa2f0dffe50cfab865a2e8
Cleaning code and modifing it from PerlPod
diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index bc37ada..e5092a3 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,195 +1,250 @@ #!/usr/bin/env perl -# Author: sattellite -# E-Mail: sattellite[at]bks-tv.ru -# License: MIT - -# The MIT License -# -# Copyright (c) 2010 sattellite -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; +use File::Path qw(make_path); + +my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; +my $week_url = 'http://www.kulichki.tv'; +my $ch_url = 'http://www.kulichki.tv/cgi-bin/gpack.cgi'; + + +my $ua = LWP::UserAgent->new; -my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; -my $m_url = 'http://www.kulichki.tv/'; +my $w = &week(); +my $v = &get_ch(); my %chanels = ( # Список каналов - 'Первый' => '47.7', - 'Россия 1' => '52.7', - 'НТВ' => '41.7', - 'ТВ-Центр' => '63.7', - 'ТНТ' => '65.7', - 'ТВ-3' => '64.7', - 'ДТВ' => '26.7', - 'РенТВ' => '13.7', - 'СТС' => '59.7', - '5 канал' => '49.7', - 'Россия 2' => '53.7', - 'Россия К' => '54.7', - 'Звезда' => '27.7', - 'Беларусь ТВ' => '22.7', - 'Мир' => '37.7', - 'TV XXI' => '60.7', - 'TV 1000' => '62.7', - 'Школьник ТВ' => '70.7', - 'Viasat History' => '21.7', + 'Первый' => "47.$v", + 'Россия 1' => "52.$v", + 'НТВ' => "41.$v", + 'ТВ-Центр' => "63.$v", + 'ТНТ' => "65.$v", + 'ТВ-3' => "64.$v", + 'ДТВ' => "26.$v", + 'РенТВ' => "13.$v", + 'СТС' => "59.$v", + '5 канал' => "49.$v", + 'Россия 2' => "53.$v", + 'Россия К' => "54.$v", + 'Звезда' => "27.$v", + 'Беларусь ТВ' => "22.$v", + 'Мир' => "37.$v", + 'TV XXI' => "60.$v", + 'TV 1000' => "62.$v", + 'Школьник ТВ' => "70.$v", + 'Viasat History' => "21.$v", ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); -my $ua = LWP::UserAgent->new; # Вывести список каналов и выбрать нужный print "Список каналов:\n00: Все каналы\n"; for my $l ( sort keys %list ) { print "$l: $list{$l}\n"; } print "Веберите канал из списка: "; my $choise = <STDIN>; chomp( $choise ); +# Создать директорию для хранения анонсов +my $dir = &dat(); +make_path $dir unless -d $dir; + # Сформировать анонс if ( $choise eq '00' ) { for my $l ( sort keys %list ) { my $p = &pars( &get_an( $chanels{$list{$l}} ) ); my $e = &effect( $p ); &wr( $e, $l ); } } elsif ( $choise =~ /^[01]\d$/) { my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); my $e = &effect( $p ); &wr( $e, $choise ); } else { print "Такого канала не найдено. Внимательней читай что пишешь.\n"; exit; } sub dat { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $d ) == 1) { $d = '0'.$d }; if(scalar split( '', $m ) == 1) { $m = '0'.$m }; my $dat = $y.'-'.$m.'-'.$d; return $dat; } sub wr { # Запись в файл my ( $e, $choise ) = @_; - my $file = $list{$choise}; - $file = &dat().' '.$file; - open (CH, ">", "tv/$file" ); + #$file = &dat().' '.$file; + + + open (CH, ">", "$dir/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { - week => &week, + week => $w, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); - my $response = $ua->request( $request ); - my $str = &encoding( $response->content ); + my $response = $ua -> request( $request ); + my $str = &encoding( $response -> content ); + return $str; +} + +sub get_ch +{ # Запрос по каналам + my $request = POST($ch_url, + Content => { + week => $w, + pakets => 'anons', + }, + ); + + my $response = $ua -> request( $request ); + my $str = $response -> content; + $str =~ /input type="checkbox" name="chanel" value="(.*?)"/si; + $str = (split(/\./, $1))[1]; return $str; } + sub week { # Номер недели - my $req = HTTP::Request -> new(GET => $m_url); - my $res = $ua -> request( $req ); - my $week = $res -> content; + my $req = HTTP::Request -> new(GET => $week_url); + my $resw = $ua -> request( $req ); + my $week = $resw -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; - $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; + $text =~ s/\(Анонс gmt\+\d+\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } -# TODO -# - Дописать парсинг прочих возможных каналов с нужных сайтов + +=head1 ОПИСАНИЕ + +Создание недельного анонса ТВ прорамм для телевизионных каналов. +Создается поддиректория формата I<year>-I<month>-I<day> +и в ней создаются файлы с названиями каналов, которые содержат внутри себя +HTML-разметку. + +Программа создана по однйо простой причине - сэконосить себе 3 дня рабочего времени +и заниматься более полезной работой на своем рабочем месте. + +=head1 ИСПОЛЬЗОВАНИЕ + + ./anounce.pl + И выбор номера необходимого канала. + +=head1 АВТОР + +Aleksander Groschev +E-Mail: L<< E<lt>[email protected]<gt> >> +JabberID: L<< E<lt>[email protected]<gt> >> + +=head1 ЛИЦЕНЗИЯ + +Эта программа распространяется под лицензией MIT (MIT License) + +Copyright (c) 2010 Aleksander Groschev + +Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного +обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное +Обеспечение"), использовать Программное Обеспечение без ограничений, включая +неограниченное право на использование, копирование, изменение, добавление, публикацию, +распространение, сублицензирование и/или продажу копий Программного Обеспечения, +также как и лицам, которым предоставляется данное Программное Обеспечение, при +соблюдении следующих условий: + +Вышеупомянутый копирайт и данные условия должны быть включены во все копии или +значимые части данного Программного Обеспечения. + +ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ, +ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ +ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ +СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ +УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, +ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ +ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. + +=head4 TODO +1. Дописать парсинг прочих возможных каналов с нужных сайтов +- http://www.viasat-channels.tv/ +- http://www.teleguide.info/download/new3/xmltv.xml.gz +- На всякий случай http://www.tvpilot.ru/ + +=cut
sattellite/perl
4ca0a43e1e52d81337a29484b761c245d49c9eb1
Added checking the selected channel
diff --git a/tv_anounce/.anounce.pl.swp b/tv_anounce/.anounce.pl.swp index dac55ec..5a256dc 100644 Binary files a/tv_anounce/.anounce.pl.swp and b/tv_anounce/.anounce.pl.swp differ diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index 7529faa..bc37ada 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,192 +1,195 @@ #!/usr/bin/env perl # Author: sattellite # E-Mail: sattellite[at]bks-tv.ru # License: MIT # The MIT License # # Copyright (c) 2010 sattellite # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $m_url = 'http://www.kulichki.tv/'; my %chanels = ( # Список каналов 'Первый' => '47.7', 'Россия 1' => '52.7', 'НТВ' => '41.7', 'ТВ-Центр' => '63.7', 'ТНТ' => '65.7', 'ТВ-3' => '64.7', 'ДТВ' => '26.7', 'РенТВ' => '13.7', 'СТС' => '59.7', '5 канал' => '49.7', 'Россия 2' => '53.7', 'Россия К' => '54.7', 'Звезда' => '27.7', 'Беларусь ТВ' => '22.7', 'Мир' => '37.7', 'TV XXI' => '60.7', 'TV 1000' => '62.7', 'Школьник ТВ' => '70.7', 'Viasat History' => '21.7', ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); my $ua = LWP::UserAgent->new; # Вывести список каналов и выбрать нужный print "Список каналов:\n00: Все каналы\n"; for my $l ( sort keys %list ) { print "$l: $list{$l}\n"; } print "Веберите канал из списка: "; my $choise = <STDIN>; chomp( $choise ); # Сформировать анонс -if ( $choise ne '00' ) { - my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); - my $e = &effect( $p ); - &wr( $e, $choise ); -} else { +if ( $choise eq '00' ) { for my $l ( sort keys %list ) { my $p = &pars( &get_an( $chanels{$list{$l}} ) ); my $e = &effect( $p ); &wr( $e, $l ); } +} elsif ( $choise =~ /^[01]\d$/) { + my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); + my $e = &effect( $p ); + &wr( $e, $choise ); +} else { + print "Такого канала не найдено. Внимательней читай что пишешь.\n"; + exit; } sub dat { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $d ) == 1) { $d = '0'.$d }; if(scalar split( '', $m ) == 1) { $m = '0'.$m }; my $dat = $y.'-'.$m.'-'.$d; return $dat; } sub wr { # Запись в файл my ( $e, $choise ) = @_; my $file = $list{$choise}; $file = &dat().' '.$file; open (CH, ">", "tv/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { week => &week, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); my $response = $ua->request( $request ); my $str = &encoding( $response->content ); return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $m_url); my $res = $ua -> request( $req ); my $week = $res -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } # TODO # - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
ba16f627b160b223c513f354028deecc875a4cc1
Some modify of code
diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index fc88d19..7529faa 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,204 +1,192 @@ #!/usr/bin/env perl # Author: sattellite # E-Mail: sattellite[at]bks-tv.ru # License: MIT # The MIT License # # Copyright (c) 2010 sattellite # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $m_url = 'http://www.kulichki.tv/'; my %chanels = ( # Список каналов 'Первый' => '47.7', 'Россия 1' => '52.7', 'НТВ' => '41.7', 'ТВ-Центр' => '63.7', 'ТНТ' => '65.7', 'ТВ-3' => '64.7', 'ДТВ' => '26.7', 'РенТВ' => '13.7', 'СТС' => '59.7', '5 канал' => '49.7', 'Россия 2' => '53.7', 'Россия К' => '54.7', 'Звезда' => '27.7', 'Беларусь ТВ' => '22.7', 'Мир' => '37.7', 'TV XXI' => '60.7', 'TV 1000' => '62.7', 'Школьник ТВ' => '70.7', 'Viasat History' => '21.7', ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); my $ua = LWP::UserAgent->new; -&list(); +# Вывести список каналов и выбрать нужный +print "Список каналов:\n00: Все каналы\n"; +for my $l ( sort keys %list ) { + print "$l: $list{$l}\n"; +} + +print "Веберите канал из списка: "; +my $choise = <STDIN>; +chomp( $choise ); -sub list -{ # Вывести список каналов и выбрать нужный - print "Список каналов:\n00: Все каналы\n"; +# Сформировать анонс +if ( $choise ne '00' ) { + my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); + my $e = &effect( $p ); + &wr( $e, $choise ); +} else { for my $l ( sort keys %list ) { - print "$l: $list{$l}\n"; + my $p = &pars( &get_an( $chanels{$list{$l}} ) ); + my $e = &effect( $p ); + &wr( $e, $l ); } - - print "Веберите канал из списка: "; - my $choise = <STDIN>; - chomp( $choise ); - &anounce( $choise ); - return 1; } -sub anounce -{ # Сформировать анонс - my ( $choise ) = @_; - if ( $choise ne '00' ) { - my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); - my $e = &effect( $p ); - &wr( $e, $choise ); - return 1; - } else { - for my $l ( sort keys %list ) { - my $p = &pars( &get_an( $chanels{$list{$l}} ) ); - my $e = &effect( $p ); - &wr( $e, $l ); - } - return 1; - } +sub dat +{ # Сегодняшняя дата + my ($d,$m,$y) = (localtime(time))[3,4,5]; + $y += 1900; $m += 1; + + # Если число однозначное, то пририсовать ноль к нему + if(scalar split( '', $d ) == 1) { $d = '0'.$d }; + if(scalar split( '', $m ) == 1) { $m = '0'.$m }; + + my $dat = $y.'-'.$m.'-'.$d; + return $dat; } sub wr { # Запись в файл my ( $e, $choise ) = @_; - sub dat - { # Сегодняшняя дата - my ($d,$m,$y) = (localtime(time))[3,4,5]; - $y += 1900; $m += 1; - - sub z - { # Если число однозначное, то пририсовать ноль к нему - if(scalar split( '', $_[0] ) == 1) { $_[0] = '0'.$_[0] }; - return $_[0]; - } - my $dat = $y.'-'.&z($m).'-'.&z($d); - return $dat; - } my $file = $list{$choise}; $file = &dat().' '.$file; open (CH, ">", "tv/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; - return 1; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { week => &week, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); my $response = $ua->request( $request ); my $str = &encoding( $response->content ); return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $m_url); my $res = $ua -> request( $req ); my $week = $res -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } # TODO # - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
667da7b8fcbd4ad5eb5158145ee7f853c393b783
Cleaned code
diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index da04a03..fc88d19 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,208 +1,204 @@ #!/usr/bin/env perl # Author: sattellite # E-Mail: sattellite[at]bks-tv.ru # License: MIT # The MIT License # # Copyright (c) 2010 sattellite # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $m_url = 'http://www.kulichki.tv/'; my %chanels = ( # Список каналов 'Первый' => '47.7', 'Россия 1' => '52.7', 'НТВ' => '41.7', 'ТВ-Центр' => '63.7', 'ТНТ' => '65.7', 'ТВ-3' => '64.7', 'ДТВ' => '26.7', 'РенТВ' => '13.7', 'СТС' => '59.7', '5 канал' => '49.7', 'Россия 2' => '53.7', 'Россия К' => '54.7', 'Звезда' => '27.7', 'Беларусь ТВ' => '22.7', 'Мир' => '37.7', 'TV XXI' => '60.7', 'TV 1000' => '62.7', 'Школьник ТВ' => '70.7', 'Viasat History' => '21.7', ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); my $ua = LWP::UserAgent->new; &list(); sub list { # Вывести список каналов и выбрать нужный print "Список каналов:\n00: Все каналы\n"; for my $l ( sort keys %list ) { print "$l: $list{$l}\n"; } print "Веберите канал из списка: "; my $choise = <STDIN>; chomp( $choise ); &anounce( $choise ); return 1; } sub anounce { # Сформировать анонс my ( $choise ) = @_; if ( $choise ne '00' ) { my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); my $e = &effect( $p ); &wr( $e, $choise ); return 1; } else { for my $l ( sort keys %list ) { my $p = &pars( &get_an( $chanels{$list{$l}} ) ); my $e = &effect( $p ); &wr( $e, $l ); } return 1; } } sub wr { # Запись в файл my ( $e, $choise ) = @_; sub dat { # Сегодняшняя дата my ($d,$m,$y) = (localtime(time))[3,4,5]; $y += 1900; $m += 1; sub z { # Если число однозначное, то пририсовать ноль к нему if(scalar split( '', $_[0] ) == 1) { $_[0] = '0'.$_[0] }; return $_[0]; } my $dat = $y.'-'.&z($m).'-'.&z($d); return $dat; } my $file = $list{$choise}; $file = &dat().' '.$file; open (CH, ">", "tv/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; return 1; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { week => &week, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); my $response = $ua->request( $request ); my $str = &encoding( $response->content ); return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $m_url); my $res = $ua -> request( $req ); my $week = $res -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } # TODO -# + Брать номер недели с сайта -# + Иметь список используемых каналов с этого сайта -# + Сделать возможность использовать эти каналы ^^^ -# + Запись в файлы всех оформленных анонсов # - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
64ac68a6e0584895c2691a710851b6fa4a302c92
Create the anouncements files with the DATE in names
diff --git a/.time.pl.swp b/.time.pl.swp new file mode 100644 index 0000000..0d17018 Binary files /dev/null and b/.time.pl.swp differ diff --git a/tv_anounce/.anounce.pl.swp b/tv_anounce/.anounce.pl.swp new file mode 100644 index 0000000..dac55ec Binary files /dev/null and b/tv_anounce/.anounce.pl.swp differ diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index 824ddb7..da04a03 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,192 +1,208 @@ #!/usr/bin/env perl # Author: sattellite # E-Mail: sattellite[at]bks-tv.ru # License: MIT # The MIT License # # Copyright (c) 2010 sattellite # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $m_url = 'http://www.kulichki.tv/'; my %chanels = ( # Список каналов 'Первый' => '47.7', 'Россия 1' => '52.7', 'НТВ' => '41.7', 'ТВ-Центр' => '63.7', 'ТНТ' => '65.7', 'ТВ-3' => '64.7', 'ДТВ' => '26.7', 'РенТВ' => '13.7', 'СТС' => '59.7', '5 канал' => '49.7', 'Россия 2' => '53.7', 'Россия К' => '54.7', 'Звезда' => '27.7', 'Беларусь ТВ' => '22.7', 'Мир' => '37.7', 'TV XXI' => '60.7', 'TV 1000' => '62.7', 'Школьник ТВ' => '70.7', 'Viasat History' => '21.7', ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); my $ua = LWP::UserAgent->new; &list(); sub list { # Вывести список каналов и выбрать нужный print "Список каналов:\n00: Все каналы\n"; for my $l ( sort keys %list ) { print "$l: $list{$l}\n"; } print "Веберите канал из списка: "; my $choise = <STDIN>; chomp( $choise ); &anounce( $choise ); return 1; } sub anounce { # Сформировать анонс my ( $choise ) = @_; if ( $choise ne '00' ) { my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); my $e = &effect( $p ); &wr( $e, $choise ); return 1; } else { for my $l ( sort keys %list ) { my $p = &pars( &get_an( $chanels{$list{$l}} ) ); my $e = &effect( $p ); &wr( $e, $l ); } return 1; } } sub wr { # Запись в файл my ( $e, $choise ) = @_; + + sub dat + { # Сегодняшняя дата + my ($d,$m,$y) = (localtime(time))[3,4,5]; + $y += 1900; $m += 1; + + sub z + { # Если число однозначное, то пририсовать ноль к нему + if(scalar split( '', $_[0] ) == 1) { $_[0] = '0'.$_[0] }; + return $_[0]; + } + my $dat = $y.'-'.&z($m).'-'.&z($d); + return $dat; + } + my $file = $list{$choise}; + $file = &dat().' '.$file; open (CH, ">", "tv/$file" ); print CH $e; close CH; print "Создан файл \"$file\"\n"; return 1; } sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, Content => { week => &week, day => '1,2,3,4,5,6,7', chanel => $ch, }, ); my $response = $ua->request( $request ); my $str = &encoding( $response->content ); return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $m_url); my $res = $ua -> request( $req ); my $week = $res -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ my ( $str ) = @_; $str =~ /(<p><font.*pre>)<table/si; $str = $1; return $str; } sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } # TODO # + Брать номер недели с сайта # + Иметь список используемых каналов с этого сайта # + Сделать возможность использовать эти каналы ^^^ # + Запись в файлы всех оформленных анонсов # - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
397f77060d679f931bd6201685bdd3d13df41b32
Now script can create anouncements for all chanels together
diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl index 51cbda4..7d747f4 100755 --- a/tv_anounce/anounce.pl +++ b/tv_anounce/anounce.pl @@ -1,142 +1,196 @@ #!/usr/bin/env perl +# Author: sattellite +# E-Mail: sattellite[at]bks-tv.ru +# License: BSD +# Copyright (c) 2010, sattellite +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + use strict; use warnings; use LWP; use HTTP::Request::Common; use Encode; my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; my $m_url = 'http://www.kulichki.tv/'; my %chanels = ( # Список каналов 'Первый' => '47.7', 'Россия 1' => '52.7', 'НТВ' => '41.7', 'ТВ-Центр' => '63.7', 'ТНТ' => '65.7', 'ТВ-3' => '64.7', 'ДТВ' => '26.7', 'РенТВ' => '13.7', 'СТС' => '59.7', '5 канал' => '49.7', 'Россия 2' => '53.7', 'Россия К' => '54.7', 'Звезда' => '27.7', 'Беларусь ТВ' => '22.7', 'Мир' => '37.7', 'TV XXI' => '60.7', 'TV 1000' => '62.7', 'Школьник ТВ' => '70.7', 'Viasat History' => '21.7', ); my %list = ( # Список '01' => 'Первый', '02' => 'Россия 1', '03' => 'НТВ', '04' => 'ТВ-Центр', '05' => 'ТНТ', '06' => 'ТВ-3', '07' => 'ДТВ', '08' => 'РенТВ', '09' => 'СТС', '10' => '5 канал', '11' => 'Россия 2', '12' => 'Россия К', '13' => 'Звезда', '14' => 'Беларусь ТВ', '15' => 'Мир', '16' => 'TV XXI', '17' => 'TV 1000', '18' => 'Школьник ТВ', '19' => 'Viasat History', ); my $ua = LWP::UserAgent->new; -# Вывести список каналов -print "Список каналов:\n"; -for my $l ( sort keys %list ) { - print "$l: $list{$l}\n"; +&list(); + +sub list +{ # Вывести список каналов и выбрать нужный + print "Список каналов:\n00: Все каналы\n"; + for my $l ( sort keys %list ) { + print "$l: $list{$l}\n"; + } + + print "Веберите канал из списка: "; + my $choise = <STDIN>; + chomp( $choise ); + &anounce( $choise ); + return 1; } -print "Веберите канал из списка: "; -my $choise = <STDIN>; -chomp( $choise ); -# Сформировать анонс -my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); -my $e = &effect( $p ); +sub anounce +{ # Сформировать анонс + my ( $choise ) = @_; + if ( $choise ne '00' ) { + my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); + my $e = &effect( $p ); + &wr( $e, $choise ); + return 1; + } else { + for my $l ( sort keys %list ) { + my $p = &pars( &get_an( $chanels{$list{$l}} ) ); + my $e = &effect( $p ); + &wr( $e, $l ); + } + return 1; + } +} -# Запись в файл -open (CH, ">", "tv/$list{$choise}"); -print CH $e; -close CH; -print "Создан файл $list{$choise}"; +sub wr +{ # Запись в файл + my ( $e, $choise ) = @_; + my $file = $list{$choise}; + open (CH, ">", "tv/$file" ); + print CH $e; + close CH; + print "Создан файл \"$file\"\n"; + return 1; +} sub encoding { # Изменение кодировки с cp1251 в utf-8 my ( $to_encode ) = @_; my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); return $encoded; } sub get_an { # Запрос анонса my ( $ch ) = @_; my $request = POST($url, - Content => { - # Дни недели по порядку (в итоге вся неделя) - # - # Канал берется из значения чекбоксов указанных в $url - week => &week, - day => '1,2,3,4,5,6,7', - chanel => $ch, - }, + Content => { + week => &week, + day => '1,2,3,4,5,6,7', + chanel => $ch, + }, ); - + my $response = $ua->request( $request ); my $str = &encoding( $response->content ); return $str; } sub week { # Номер недели my $req = HTTP::Request -> new(GET => $m_url); my $res = $ua -> request( $req ); my $week = $res -> content; $week =~ /input type="hidden" name="week" value=(\d+)/si; $week = $1; return $week; } sub pars { # Выпарсивание куска, в котором содержатся анонсы программ - my ( $str ) = @_; - $str =~ /(<p><font.*pre>)<table/si; - $str = $1; - return $str; + my ( $str ) = @_; + $str =~ /(<p><font.*pre>)<table/si; + $str = $1; + return $str; } - + sub effect { # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ my ( $text ) = @_; $text =~ s/<p>|<pre>|<\/pre>//sig; $text =~ s/font size=\+2|font/h3/sig; $text =~ s/b>/strong>/sig; $text =~ s/\n|<br>/<br \/>\n/sig; $text =~ s/<hr>/<hr>\n/sig; $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; $text =~ s/^(\d.*)/<br \/>\n$1/mig; $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; return $text; } # TODO # + Брать номер недели с сайта # + Иметь список используемых каналов с этого сайта -# - Сделать возможность использовать эти каналы ^^^ +# + Сделать возможность использовать эти каналы ^^^ +# + Запись в файлы всех оформленных анонсов # - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
c5ec35bca229f73265f0caff7c2309cc82f57092
TV anouncements
diff --git a/README b/README index 3e03e8a..3277da2 100644 --- a/README +++ b/README @@ -1,3 +1,4 @@ ===== PERL scripts ===== = parser - create HTML page from RSSfeed (http://naklon.info/rss/about.htm) += tv_anounce - create anouncements for 19 russian TV chanels diff --git a/tv_anounce/anounce.pl b/tv_anounce/anounce.pl new file mode 100755 index 0000000..51cbda4 --- /dev/null +++ b/tv_anounce/anounce.pl @@ -0,0 +1,142 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use LWP; +use HTTP::Request::Common; +use Encode; + +my $url = 'http://www.kulichki.tv/andgon/cgi-bin/itv.cgi'; +my $m_url = 'http://www.kulichki.tv/'; + +my %chanels = ( # Список каналов + 'Первый' => '47.7', + 'Россия 1' => '52.7', + 'НТВ' => '41.7', + 'ТВ-Центр' => '63.7', + 'ТНТ' => '65.7', + 'ТВ-3' => '64.7', + 'ДТВ' => '26.7', + 'РенТВ' => '13.7', + 'СТС' => '59.7', + '5 канал' => '49.7', + 'Россия 2' => '53.7', + 'Россия К' => '54.7', + 'Звезда' => '27.7', + 'Беларусь ТВ' => '22.7', + 'Мир' => '37.7', + 'TV XXI' => '60.7', + 'TV 1000' => '62.7', + 'Школьник ТВ' => '70.7', + 'Viasat History' => '21.7', + ); + +my %list = ( # Список + '01' => 'Первый', + '02' => 'Россия 1', + '03' => 'НТВ', + '04' => 'ТВ-Центр', + '05' => 'ТНТ', + '06' => 'ТВ-3', + '07' => 'ДТВ', + '08' => 'РенТВ', + '09' => 'СТС', + '10' => '5 канал', + '11' => 'Россия 2', + '12' => 'Россия К', + '13' => 'Звезда', + '14' => 'Беларусь ТВ', + '15' => 'Мир', + '16' => 'TV XXI', + '17' => 'TV 1000', + '18' => 'Школьник ТВ', + '19' => 'Viasat History', + ); + +my $ua = LWP::UserAgent->new; + +# Вывести список каналов +print "Список каналов:\n"; +for my $l ( sort keys %list ) { + print "$l: $list{$l}\n"; +} +print "Веберите канал из списка: "; +my $choise = <STDIN>; +chomp( $choise ); + +# Сформировать анонс +my $p = &pars( &get_an( $chanels{$list{$choise}} ) ); +my $e = &effect( $p ); + +# Запись в файл +open (CH, ">", "tv/$list{$choise}"); +print CH $e; +close CH; +print "Создан файл $list{$choise}"; + +sub encoding +{ # Изменение кодировки с cp1251 в utf-8 + my ( $to_encode ) = @_; + my $encoded = encode( 'utf-8', decode( 'cp1251', $to_encode ) ); + return $encoded; +} + +sub get_an +{ # Запрос анонса + my ( $ch ) = @_; + my $request = POST($url, + Content => { + # Дни недели по порядку (в итоге вся неделя) + # + # Канал берется из значения чекбоксов указанных в $url + week => &week, + day => '1,2,3,4,5,6,7', + chanel => $ch, + }, + ); + + my $response = $ua->request( $request ); + my $str = &encoding( $response->content ); + return $str; +} + +sub week +{ # Номер недели + my $req = HTTP::Request -> new(GET => $m_url); + my $res = $ua -> request( $req ); + my $week = $res -> content; + $week =~ /input type="hidden" name="week" value=(\d+)/si; + $week = $1; + return $week; +} + +sub pars +{ # Выпарсивание куска, в котором содержатся анонсы программ + my ( $str ) = @_; + $str =~ /(<p><font.*pre>)<table/si; + $str = $1; + return $str; +} + +sub effect +{ # Оформление текста под таблицу стилей сайта http://bks-tv.ru/ + my ( $text ) = @_; + $text =~ s/<p>|<pre>|<\/pre>//sig; + $text =~ s/font size=\+2|font/h3/sig; + $text =~ s/b>/strong>/sig; + $text =~ s/\n|<br>/<br \/>\n/sig; + $text =~ s/<hr>/<hr>\n/sig; + $text =~ s/\(Анонс gmt\+3\).*?(<br)/$1/sig; + $text =~ s/^(\d.*)/<br \/>\n$1/mig; + $text =~ s/^(\d+:\d+\s)(.*)\(/$1<span style="color: #3366ff">$2<\/span>\(/mig; + $text =~ s/^(\d.*)(\()/<strong>$1<\/strong>$2/mig; + $text =~ s/(Режиссер.*)(<br \/>)/<em>$1<\/em>$2/mig; + $text =~ s/(В ролях.*)(<br \/>)/<em>$1<\/em>$2/mig; + return $text; +} + +# TODO +# + Брать номер недели с сайта +# + Иметь список используемых каналов с этого сайта +# - Сделать возможность использовать эти каналы ^^^ +# - Дописать парсинг прочих возможных каналов с нужных сайтов
sattellite/perl
7e81d8e816489a307394470475e105b5cf336695
Create parser script
diff --git a/parser/parser.pl b/parser/parser.pl new file mode 100755 index 0000000..82ab69a --- /dev/null +++ b/parser/parser.pl @@ -0,0 +1,84 @@ +#!/usr/bin/env perl +# Скрипт для парсинга RSS ленты формируемой с помощью модуля RSS для phpBB форума/трекера +# http://naklon.info/rss/about.htm +# Author: sattellite +# License: MIT +use strict; +use warnings; +use utf8; +use open qw(:utf8 :std); + +use CGI qw(:standard); +use XML::RAI; + +my $uri = $ENV{QUERY_STRING}; +my $q = CGI->new; + +my $rai = XML::RAI->parse_uri( "http://torrents.bks-tv.ru/forum/rss.php?$uri" ); +my $topic = $rai->channel->title; +## Название топика, который сейчас парсится +print "\n\n", + $q->div({-class => 'topic'}, big("$topic")); + +## А это уже комментарии к просматриваемому топику +foreach my $item ( @{$rai->items} ) { + my $i = $item->description; + my $link = $item->link; + print $q->start_div({-class => "comment"}), + $q->a({-href=>"$link"},&t($item->title)), + $q->span({-class=>"date"},&d(&pd($i))), + $q->div({-class=>"author"},&au(&pd($i))), + $q->div({-class=>"message"},&msg(&pd($i))), + $q->end_div; +} + +## Подпрограммы + +## Создание массива, который все содержимое разбивает в элементы по строкам +sub pd +{ + my ( $str ) = @_; + my @content = split(/\n/, $str); + return @content; +} + +## Выпарсивание топика, а вернее обрезание Названия просматриваемой темы. Остается только сама тема +sub t +{ + my $title = $_[0]; + $title = (split(/::/, $title))[1]; + return $title; +} + +## Выпарсивание автора комментария +sub au +{ + my $author = $_[0]; + $author =~ s/<br \/>//sg; + return $author; +} + +## Выпарсивание даты комментария +sub d +{ + my $dob = $_[1]; + $dob =~ /Добавлено: (.*) \(GMT/sg; + my $data = $1; + my ($day, $time) = split(/\s/, $data); + my %d = ("01"=>"Янв","02"=>"Фев","03"=>"Мар","04"=>"Апр","05"=>"Май","06"=>"Июн","07"=>"Июл","08"=>"Авг","09"=>"Сен","10"=>"Окт","11"=>"Ноя","12"=>"Дек"); + my ($y, $m, $d) = split(/-/, $day); + my $date = $d.'-'.$d{$m}.'-'.$y.' '.$time; + return $date; +} + +## Выпарсивание конкретно сообщения без лишних полей из RSS и тегов +sub msg +{ + my ($a, $b, @msg) = @_; + my $msg = join("\n",@msg); + $msg =~ s/<br \/>(<span.*span>)<br \/>/$1/sg; + return $msg; + # Сраная-срань. Массив выводить через функцию в цикле нельзя, поэтому используем костыль, + # возвращающий скаляр в исходном виде. В &pd делили по переносу строки, а тут для красоты + # восстанавливаем эти самые переносы. +}
sattellite/perl
7867d418522fdae5e1f2293ec7802323d6610527
Create repo
diff --git a/README b/README new file mode 100644 index 0000000..4b2d361 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +===== PERL scripts ===== +
TheWanderer/stiler
b2ebcef0f9e96aa5e3cbdcacd2107daf27c98732
max_all - Maximize all windows
diff --git a/README b/README index 2ce6325..c52a9d6 100644 --- a/README +++ b/README @@ -1,15 +1,16 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. swap - Will swap the active window to master column cycle - Cycle all the windows in the master pane vertical - Simple vertical tiling horizontal - Simple horizontal tiling maximize - Maximize the active window/ for openbox which doesn't permit resizing of max windows +max_all - Maximize all windows On first run it will create a config file ~/.stilerrc. Modify the values to suit your window decorations/Desktop padding. If you need other layouts modify get_simple_tile diff --git a/stiler.py b/stiler.py index a4e37b1..3b3e95c 100755 --- a/stiler.py +++ b/stiler.py @@ -1,287 +1,309 @@ #!/usr/bin/python ############################################################################ # Copyright (c) 2009 unohu <[email protected]> # # # # Permission to use, copy, modify, and/or distribute this software for any # # purpose with or without fee is hereby granted, provided that the above # # copyright notice and this permission notice appear in all copies. # # # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # # ############################################################################ import sys import os import commands import pickle import ConfigParser def initconfig(): rcfile=os.getenv('HOME')+"/.stilerrc" if not os.path.exists(rcfile): cfg=open(rcfile,'w') cfg.write("""#Tweak these values [default] BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 MwFactor = 0.65 TempFile = /tmp/tile_winlist """) cfg.close() config=ConfigParser.RawConfigParser() config.read(rcfile) return config def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) # Get all global variables Config = initconfig() BottomPadding = Config.getint("default","BottomPadding") TopPadding = Config.getint("default","TopPadding") LeftPadding = Config.getint("default","LeftPadding") RightPadding = Config.getint("default","RightPadding") WinTitle = Config.getint("default","WinTitle") WinBorder = Config.getint("default","WinBorder") MwFactor = Config.getfloat("default","MwFactor") TempFile = Config.get("default","TempFile") (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout def get_horiz_tile(wincount): layout = [] x = OrigX height = int(MaxHeight/wincount - WinTitle - WinBorder) width = MaxWidth for n in range(0,wincount): y= OrigY + int((MaxHeight/wincount)*(n)) layout.append((x,y,width,height)) return layout +def get_max_all(wincount): + layout = [] + x = OrigX + y = OrigY + height = MaxHeight - WinTitle - WinBorder + width = MaxWidth + for n in range(0,wincount): + layout.append((x,y,width,height)) + + return layout + + def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) def horiz(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_horiz_tile(len(winlist)),winlist) def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) def maximize(): Width=MaxWidth Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") +def max_all(): + winlist = create_win_list() + active = get_active_window() + winlist.remove(active) + winlist.insert(0,active) + arrange(get_max_all(len(winlist)),winlist) + + if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() elif sys.argv[1] == "horizontal": horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle() elif sys.argv[1] == "maximize": maximize() +elif sys.argv[1] == "max_all": + max_all()
TheWanderer/stiler
8dd818581fa4fa50c7ebb85496af2f9e2e6ea5b3
Evil license detected
diff --git a/stiler.py b/stiler.py index d2e97d9..a4e37b1 100755 --- a/stiler.py +++ b/stiler.py @@ -1,269 +1,287 @@ #!/usr/bin/python + +############################################################################ +# Copyright (c) 2009 unohu <[email protected]> # +# # +# Permission to use, copy, modify, and/or distribute this software for any # +# purpose with or without fee is hereby granted, provided that the above # +# copyright notice and this permission notice appear in all copies. # +# # +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# # +############################################################################ + import sys import os import commands import pickle import ConfigParser def initconfig(): rcfile=os.getenv('HOME')+"/.stilerrc" if not os.path.exists(rcfile): cfg=open(rcfile,'w') cfg.write("""#Tweak these values [default] BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 MwFactor = 0.65 TempFile = /tmp/tile_winlist """) cfg.close() config=ConfigParser.RawConfigParser() config.read(rcfile) return config def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) # Get all global variables Config = initconfig() BottomPadding = Config.getint("default","BottomPadding") TopPadding = Config.getint("default","TopPadding") LeftPadding = Config.getint("default","LeftPadding") RightPadding = Config.getint("default","RightPadding") WinTitle = Config.getint("default","WinTitle") WinBorder = Config.getint("default","WinBorder") MwFactor = Config.getfloat("default","MwFactor") TempFile = Config.get("default","TempFile") (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout def get_horiz_tile(wincount): layout = [] x = OrigX height = int(MaxHeight/wincount - WinTitle - WinBorder) width = MaxWidth for n in range(0,wincount): y= OrigY + int((MaxHeight/wincount)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) def horiz(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_horiz_tile(len(winlist)),winlist) def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) def maximize(): Width=MaxWidth Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() elif sys.argv[1] == "horizontal": horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle() elif sys.argv[1] == "maximize": maximize()
TheWanderer/stiler
2deb495e4bdbf65a49cb5576edf9fbc3a3e377be
Renamed to sTiler
diff --git a/README b/README index b145f49..2ce6325 100644 --- a/README +++ b/README @@ -1,15 +1,15 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. swap - Will swap the active window to master column cycle - Cycle all the windows in the master pane vertical - Simple vertical tiling horizontal - Simple horizontal tiling maximize - Maximize the active window/ for openbox which doesn't permit resizing of max windows -On first run it will create a config file ~/.managerc. Modify the values to suit your window decorations/Desktop padding. +On first run it will create a config file ~/.stilerrc. Modify the values to suit your window decorations/Desktop padding. If you need other layouts modify get_simple_tile diff --git a/manage.py b/stiler.py similarity index 99% rename from manage.py rename to stiler.py index 3872f85..d2e97d9 100755 --- a/manage.py +++ b/stiler.py @@ -1,269 +1,269 @@ #!/usr/bin/python import sys import os import commands import pickle import ConfigParser def initconfig(): - rcfile=os.getenv('HOME')+"/.managerc" + rcfile=os.getenv('HOME')+"/.stilerrc" if not os.path.exists(rcfile): cfg=open(rcfile,'w') cfg.write("""#Tweak these values [default] BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 MwFactor = 0.65 TempFile = /tmp/tile_winlist """) cfg.close() config=ConfigParser.RawConfigParser() config.read(rcfile) return config def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) # Get all global variables Config = initconfig() BottomPadding = Config.getint("default","BottomPadding") TopPadding = Config.getint("default","TopPadding") LeftPadding = Config.getint("default","LeftPadding") RightPadding = Config.getint("default","RightPadding") WinTitle = Config.getint("default","WinTitle") WinBorder = Config.getint("default","WinBorder") MwFactor = Config.getfloat("default","MwFactor") TempFile = Config.get("default","TempFile") (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout def get_horiz_tile(wincount): layout = [] x = OrigX height = int(MaxHeight/wincount - WinTitle - WinBorder) width = MaxWidth for n in range(0,wincount): y= OrigY + int((MaxHeight/wincount)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) def horiz(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_horiz_tile(len(winlist)),winlist) def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) def maximize(): Width=MaxWidth Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() elif sys.argv[1] == "horizontal": horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle() elif sys.argv[1] == "maximize": maximize()
TheWanderer/stiler
275584cbd8e93615c5d793dcc871ac4f3b2decc7
added config file
diff --git a/README b/README index 2206c65..b145f49 100644 --- a/README +++ b/README @@ -1,19 +1,15 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are -simple - The basic tiling layout . 1 Main + all other at the side. - -left,right - Does the new windows7 ish style of sticking to the sides. - -swap - will swap the active window to master column - -cycle - Cycle all the windows in the master pane - -vertical - simple vertical tiling - -horizontal - simple horizontal tiling - -You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. +simple - The basic tiling layout . 1 Main + all other at the side. +left,right - Does the new windows7 ish style of sticking to the sides. +swap - Will swap the active window to master column +cycle - Cycle all the windows in the master pane +vertical - Simple vertical tiling +horizontal - Simple horizontal tiling +maximize - Maximize the active window/ for openbox which doesn't permit resizing of max windows + +On first run it will create a config file ~/.managerc. Modify the values to suit your window decorations/Desktop padding. If you need other layouts modify get_simple_tile diff --git a/manage.py b/manage.py index 8cdb48b..3872f85 100755 --- a/manage.py +++ b/manage.py @@ -1,244 +1,269 @@ #!/usr/bin/python import sys import os import commands import pickle - +import ConfigParser + +def initconfig(): + rcfile=os.getenv('HOME')+"/.managerc" + if not os.path.exists(rcfile): + cfg=open(rcfile,'w') + cfg.write("""#Tweak these values +[default] BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 -TempFile = "/tmp/tile_winlist" MwFactor = 0.65 +TempFile = /tmp/tile_winlist +""") + cfg.close() + + config=ConfigParser.RawConfigParser() + config.read(rcfile) + return config def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) +# Get all global variables +Config = initconfig() +BottomPadding = Config.getint("default","BottomPadding") +TopPadding = Config.getint("default","TopPadding") +LeftPadding = Config.getint("default","LeftPadding") +RightPadding = Config.getint("default","RightPadding") +WinTitle = Config.getint("default","WinTitle") +WinBorder = Config.getint("default","WinBorder") +MwFactor = Config.getfloat("default","MwFactor") +TempFile = Config.get("default","TempFile") (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout + def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout + def get_horiz_tile(wincount): layout = [] x = OrigX height = int(MaxHeight/wincount - WinTitle - WinBorder) width = MaxWidth for n in range(0,wincount): y= OrigY + int((MaxHeight/wincount)*(n)) layout.append((x,y,width,height)) return layout - - def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) + def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) + def horiz(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_horiz_tile(len(winlist)),winlist) + def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) + def maximize(): Width=MaxWidth Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") + if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() elif sys.argv[1] == "horizontal": horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle() elif sys.argv[1] == "maximize": maximize() - - -
TheWanderer/stiler
b08bf101492ab3aa076577de5a2f3f5b2123d9c2
Added a maximize function for openbox users Openbox prevents max windows from resizing and moving
diff --git a/manage.py b/manage.py index da7fb01..8cdb48b 100755 --- a/manage.py +++ b/manage.py @@ -1,237 +1,244 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" MwFactor = 0.65 def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout def get_horiz_tile(wincount): layout = [] x = OrigX height = int(MaxHeight/wincount - WinTitle - WinBorder) width = MaxWidth for n in range(0,wincount): y= OrigY + int((MaxHeight/wincount)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) def horiz(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_horiz_tile(len(winlist)),winlist) - - def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) - +def maximize(): + Width=MaxWidth + Height=MaxHeight - WinTitle -WinBorder + PosX=LeftPadding + PosY=TopPadding + move_active(PosX,PosY,Width,Height) + raise_window(":ACTIVE:") if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() elif sys.argv[1] == "horizontal": horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle() +elif sys.argv[1] == "maximize": + maximize() +
TheWanderer/stiler
be6608fcefb36e59793a0d22668705065799acc9
added horizontal tiling
diff --git a/README b/README index 15db341..2206c65 100644 --- a/README +++ b/README @@ -1,17 +1,19 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. swap - will swap the active window to master column cycle - Cycle all the windows in the master pane vertical - simple vertical tiling +horizontal - simple horizontal tiling + You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. If you need other layouts modify get_simple_tile diff --git a/manage.py b/manage.py index 0898eea..da7fb01 100755 --- a/manage.py +++ b/manage.py @@ -1,216 +1,237 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" MwFactor = 0.65 def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def get_vertical_tile(wincount): layout = [] y = OrigY width = int(MaxWidth/wincount) height = MaxHeight - WinTitle - WinBorder for n in range(0,wincount): x= OrigX + n * width layout.append((x,y,width,height)) return layout +def get_horiz_tile(wincount): + layout = [] + x = OrigX + height = int(MaxHeight/wincount - WinTitle - WinBorder) + width = MaxWidth + for n in range(0,wincount): + y= OrigY + int((MaxHeight/wincount)*(n)) + layout.append((x,y,width,height)) + + return layout + + def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def vertical(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_vertical_tile(len(winlist)),winlist) +def horiz(): + winlist = create_win_list() + active = get_active_window() + winlist.remove(active) + winlist.insert(0,active) + arrange(get_horiz_tile(len(winlist)),winlist) + def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "vertical": vertical() +elif sys.argv[1] == "horizontal": + horiz() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle()
TheWanderer/stiler
8a1876376abb9612b6aaffba3e1313a4804ba233
added vertical tiling
diff --git a/README b/README index 8780798..15db341 100644 --- a/README +++ b/README @@ -1,15 +1,17 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. swap - will swap the active window to master column cycle - Cycle all the windows in the master pane +vertical - simple vertical tiling + You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. If you need other layouts modify get_simple_tile diff --git a/manage.py b/manage.py index be7d827..0898eea 100755 --- a/manage.py +++ b/manage.py @@ -1,193 +1,216 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" MwFactor = 0.65 def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout +def get_vertical_tile(wincount): + layout = [] + y = OrigY + width = int(MaxWidth/wincount) + height = MaxHeight - WinTitle - WinBorder + for n in range(0,wincount): + x= OrigX + n * width + layout.append((x,y,width,height)) + + return layout + + def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) +def vertical(): + winlist = create_win_list() + active = get_active_window() + winlist.remove(active) + winlist.insert(0,active) + arrange(get_vertical_tile(len(winlist)),winlist) + + + def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() +elif sys.argv[1] == "vertical": + vertical() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle()
TheWanderer/stiler
3b06c1c6b8e4a6b64045605274f1d68fd95501ed
fix for xdotool error msg. Thanks to ninian http://bbs.archlinux.org/profile.php?id=14996
diff --git a/manage.py b/manage.py index af20089..be7d827 100755 --- a/manage.py +++ b/manage.py @@ -1,193 +1,193 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" MwFactor = 0.65 def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): - return str(hex(int(commands.getoutput("xdotool getactivewindow").split()[0]))) + return str(hex(int(commands.getoutput("xdotool getactivewindow 2>/dev/null").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def raise_window(windowid): if windowid == ":ACTIVE:": command = "wmctrl -a :ACTIVE: " else: command - "wmctrl -i -a " + windowid os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) raise_window(":ACTIVE:") def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) def cycle(): winlist = create_win_list() winlist.insert(0,winlist[len(winlist)-1]) winlist = winlist[:-1] arrange(get_simple_tile(len(winlist)),winlist) if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "swap": swap() elif sys.argv[1] == "cycle": cycle()
TheWanderer/stiler
6f5c9f6ea5ab70d7d075db326f89f0d3cda4fa43
cycle windows in the layout
diff --git a/README b/README index d108309..8780798 100644 --- a/README +++ b/README @@ -1,13 +1,15 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. swap - will swap the active window to master column +cycle - Cycle all the windows in the master pane + You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. If you need other layouts modify get_simple_tile diff --git a/manage.py b/manage.py index 074f639..af20089 100755 --- a/manage.py +++ b/manage.py @@ -1,171 +1,193 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" MwFactor = 0.65 + def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} - for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) - return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() + def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) - - (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) - for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout + def move_active(PosX,PosY,Width,Height): - command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) - os.system(command) + command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) + os.system(command) + def move_window(windowid,PosX,PosY,Width,Height): - command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) - os.system(command) - command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" - os.system(command) + command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) + os.system(command) + command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" + os.system(command) + + +def raise_window(windowid): + if windowid == ":ACTIVE:": + command = "wmctrl -a :ACTIVE: " + else: + command - "wmctrl -i -a " + windowid + + os.system(command) + def left(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle -WinBorder PosX=LeftPadding PosY=TopPadding move_active(PosX,PosY,Width,Height) + raise_window(":ACTIVE:") + def right(): Width=MaxWidth/2-1 Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 PosY=TopPadding move_active(PosX,PosY,Width,Height) + raise_window(":ACTIVE:") + def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist - - def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) + def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) +def cycle(): + winlist = create_win_list() + winlist.insert(0,winlist[len(winlist)-1]) + winlist = winlist[:-1] + arrange(get_simple_tile(len(winlist)),winlist) + + if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "swap": swap() +elif sys.argv[1] == "cycle": + cycle() +
TheWanderer/stiler
737be14330b2890067b860681d3d492d76a43384
change in README
diff --git a/README b/README index 1e49640..d108309 100644 --- a/README +++ b/README @@ -1,11 +1,13 @@ Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. Currently options are simple - The basic tiling layout . 1 Main + all other at the side. left,right - Does the new windows7 ish style of sticking to the sides. +swap - will swap the active window to master column + You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. If you need other layouts modify get_simple_tile
TheWanderer/stiler
dd52be55ffb28e29b96393ec5469d3fa90b99b3e
left/right snap considers screenpadding now thanks to brisbin33
diff --git a/manage.py b/manage.py index bc901ef..074f639 100755 --- a/manage.py +++ b/manage.py @@ -1,171 +1,171 @@ #!/usr/bin/python import sys import os import commands import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 TempFile = "/tmp/tile_winlist" -MwFactor = 0.5 +MwFactor = 0.65 def initialize(): desk_output = commands.getoutput("wmctrl -d").split("\n") desk_list = [line.split()[0] for line in desk_output] current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] win_output = commands.getoutput("wmctrl -lG").split("\n") win_list = {} for desk in desk_list: win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) return (desktop,orig_x,orig_y,width,height,win_list) def get_active_window(): return str(hex(int(commands.getoutput("xdotool getactivewindow").split()[0]))) def store(object,file): with open(file, 'w') as f: pickle.dump(object,f) f.close() def retrieve(file): try: with open(file,'r+') as f: obj = pickle.load(f) f.close() return(obj) except: f = open(file,'w') f.close dict = {} return (dict) (Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding OldWinList = retrieve(TempFile) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" os.system(command) def left(): Width=MaxWidth/2-1 - Height=MaxHeight - PosX=0 - PosY=0 + Height=MaxHeight - WinTitle -WinBorder + PosX=LeftPadding + PosY=TopPadding move_active(PosX,PosY,Width,Height) def right(): Width=MaxWidth/2-1 - Height=MaxHeight + Height=MaxHeight - WinTitle - WinBorder PosX=MaxWidth/2 - PosY=0 + PosY=TopPadding move_active(PosX,PosY,Width,Height) def compare_win_list(newlist,oldlist): templist = [] for window in oldlist: if newlist.count(window) != 0: templist.append(window) for window in newlist: if oldlist.count(window) == 0: templist.append(window) return templist def create_win_list(): Windows = WinList[Desktop] if OldWinList == {}: pass else: OldWindows = OldWinList[Desktop] if Windows == OldWindows: pass else: Windows = compare_win_list(Windows,OldWindows) return Windows def arrange(layout,windows): for win , lay in zip(windows,layout): move_window(win,lay[0],lay[1],lay[2],lay[3]) WinList[Desktop]=windows store(WinList,TempFile) def simple(): Windows = create_win_list() arrange(get_simple_tile(len(Windows)),Windows) def swap(): winlist = create_win_list() active = get_active_window() winlist.remove(active) winlist.insert(0,active) arrange(get_simple_tile(len(winlist)),winlist) if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() elif sys.argv[1] == "swap": swap()
TheWanderer/stiler
82a057b4ed697013035d38331b73230a64365b75
Added swap functionality. The active window will be swapped into the main column
diff --git a/manage.py b/manage.py index edf7c15..bc901ef 100755 --- a/manage.py +++ b/manage.py @@ -1,104 +1,171 @@ #!/usr/bin/python import sys import os import commands +import pickle BottomPadding = 0 TopPadding = 0 LeftPadding = 0 RightPadding = 0 WinTitle = 21 WinBorder = 1 +TempFile = "/tmp/tile_winlist" +MwFactor = 0.5 + +def initialize(): + desk_output = commands.getoutput("wmctrl -d").split("\n") + desk_list = [line.split()[0] for line in desk_output] + + current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split() -def get_desktop(): - output = commands.getoutput("wmctrl -d").split("\n") - current = filter(lambda x: x.split()[1] == "*" , output)[0].split() - print current desktop = current[0] width = current[8].split("x")[0] height = current[8].split("x")[1] orig_x = current[7].split(",")[0] orig_y = current[7].split(",")[1] - return (desktop,orig_x,orig_y,width,height) -(DESKTOP,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr) = get_desktop() + win_output = commands.getoutput("wmctrl -lG").split("\n") + win_list = {} + + + for desk in desk_list: + win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_output )) + + + return (desktop,orig_x,orig_y,width,height,win_list) + + +def get_active_window(): + return str(hex(int(commands.getoutput("xdotool getactivewindow").split()[0]))) + + +def store(object,file): + with open(file, 'w') as f: + pickle.dump(object,f) + f.close() + +def retrieve(file): + try: + with open(file,'r+') as f: + obj = pickle.load(f) + f.close() + return(obj) + except: + f = open(file,'w') + f.close + dict = {} + return (dict) + + + + +(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize() MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding OrigX = int(OrigXstr) + LeftPadding OrigY = int(OrigYstr) + TopPadding +OldWinList = retrieve(TempFile) -MwFactor = 0.5 - -def get_windows(desktop): - output = commands.getoutput("wmctrl -lG").split("\n") - return filter(lambda x: x.split()[1] == desktop, output ) def get_simple_tile(wincount): rows = wincount - 1 layout = [] if rows == 0: layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) return layout else: layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) width=int((MaxWidth*(1-MwFactor))-2*WinBorder) height=int(MaxHeight/rows - WinTitle-WinBorder) for n in range(0,rows): y= OrigY+int((MaxHeight/rows)*(n)) layout.append((x,y,width,height)) return layout def move_active(PosX,PosY,Width,Height): command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) os.system(command) def move_window(windowid,PosX,PosY,Width,Height): command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) - print command os.system(command) command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" - print command os.system(command) def left(): Width=MaxWidth/2-1 Height=MaxHeight PosX=0 PosY=0 move_active(PosX,PosY,Width,Height) def right(): Width=MaxWidth/2-1 Height=MaxHeight PosX=MaxWidth/2 PosY=0 move_active(PosX,PosY,Width,Height) + +def compare_win_list(newlist,oldlist): + templist = [] + for window in oldlist: + if newlist.count(window) != 0: + templist.append(window) + for window in newlist: + if oldlist.count(window) == 0: + templist.append(window) + return templist + + + + +def create_win_list(): + Windows = WinList[Desktop] + + if OldWinList == {}: + pass + else: + OldWindows = OldWinList[Desktop] + if Windows == OldWindows: + pass + else: + Windows = compare_win_list(Windows,OldWindows) + + return Windows + + +def arrange(layout,windows): + for win , lay in zip(windows,layout): + move_window(win,lay[0],lay[1],lay[2],lay[3]) + WinList[Desktop]=windows + store(WinList,TempFile) + def simple(): - Windows = get_windows(DESKTOP) - WinCount = len(Windows) - Layout = get_simple_tile(WinCount) - - for n in range(0,WinCount): - window = Windows[n].split()[0] - x = Layout[n][0] - y = Layout[n][1] - w = Layout[n][2] - h = Layout[n][3] - move_window(window,x,y,w,h) + Windows = create_win_list() + arrange(get_simple_tile(len(Windows)),Windows) + +def swap(): + winlist = create_win_list() + active = get_active_window() + winlist.remove(active) + winlist.insert(0,active) + arrange(get_simple_tile(len(winlist)),winlist) - if sys.argv[1] == "left": left() elif sys.argv[1] == "right": right() elif sys.argv[1] == "simple": simple() +elif sys.argv[1] == "swap": + swap()
TheWanderer/stiler
94bad194be82485168028c22117e3ba2021701bb
added files README and manage.py
diff --git a/README b/README new file mode 100644 index 0000000..1e49640 --- /dev/null +++ b/README @@ -0,0 +1,11 @@ +Basically a simple python script which does tiling on any windowmanager (Perfectly on pekwm and openbox. Partly on compiz due to the fact that compiz says it has a single desktop even if there are 4 virtual desktops, which means all the windows you have will be tiled). +It uses wmctrl to get the info and manage the windows. Bind it to a key or to autowhatever-on-window-creation-hook. + +Currently options are +simple - The basic tiling layout . 1 Main + all other at the side. + +left,right - Does the new windows7 ish style of sticking to the sides. + +You can change the main window factor BottomPadding TopPadding LeftPadding RightPadding though it detects most of the panels. You may have to change wintitle and border according to your theme. + +If you need other layouts modify get_simple_tile diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..edf7c15 --- /dev/null +++ b/manage.py @@ -0,0 +1,104 @@ +#!/usr/bin/python +import sys +import os +import commands + +BottomPadding = 0 +TopPadding = 0 +LeftPadding = 0 +RightPadding = 0 +WinTitle = 21 +WinBorder = 1 + +def get_desktop(): + output = commands.getoutput("wmctrl -d").split("\n") + current = filter(lambda x: x.split()[1] == "*" , output)[0].split() + print current + desktop = current[0] + width = current[8].split("x")[0] + height = current[8].split("x")[1] + orig_x = current[7].split(",")[0] + orig_y = current[7].split(",")[1] + return (desktop,orig_x,orig_y,width,height) + +(DESKTOP,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr) = get_desktop() +MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding +MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding +OrigX = int(OrigXstr) + LeftPadding +OrigY = int(OrigYstr) + TopPadding + +MwFactor = 0.5 + +def get_windows(desktop): + output = commands.getoutput("wmctrl -lG").split("\n") + return filter(lambda x: x.split()[1] == desktop, output ) + +def get_simple_tile(wincount): + rows = wincount - 1 + layout = [] + if rows == 0: + layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder)) + return layout + else: + layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder)) + + x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder)) + width=int((MaxWidth*(1-MwFactor))-2*WinBorder) + height=int(MaxHeight/rows - WinTitle-WinBorder) + + + for n in range(0,rows): + y= OrigY+int((MaxHeight/rows)*(n)) + layout.append((x,y,width,height)) + + return layout + +def move_active(PosX,PosY,Width,Height): + command = " wmctrl -r :ACTIVE: -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) + os.system(command) + +def move_window(windowid,PosX,PosY,Width,Height): + command = " wmctrl -i -r " + windowid + " -e 0," + str(PosX) + "," + str(PosY)+ "," + str(Width) + "," + str(Height) + print command + os.system(command) + command = "wmctrl -i -r " + windowid + " -b remove,hidden,shaded" + print command + os.system(command) + +def left(): + Width=MaxWidth/2-1 + Height=MaxHeight + PosX=0 + PosY=0 + move_active(PosX,PosY,Width,Height) + +def right(): + Width=MaxWidth/2-1 + Height=MaxHeight + PosX=MaxWidth/2 + PosY=0 + move_active(PosX,PosY,Width,Height) + +def simple(): + Windows = get_windows(DESKTOP) + WinCount = len(Windows) + Layout = get_simple_tile(WinCount) + + for n in range(0,WinCount): + window = Windows[n].split()[0] + x = Layout[n][0] + y = Layout[n][1] + w = Layout[n][2] + h = Layout[n][3] + move_window(window,x,y,w,h) + + + +if sys.argv[1] == "left": + left() +elif sys.argv[1] == "right": + right() +elif sys.argv[1] == "simple": + simple() + +
nsyee/tinyblog
e4fd73c3cc8b660d91f829edc2dd61e7730deed5
add a .gitignore
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..791762d --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.swp +*.swo +*.o +*.hi +*.pid +*.fcgi +*.exe +*.log +/db +/dist +Main
nsyee/tinyblog
77135528a48e787b582e9f430c102206fbd74eec
add a useGravatar option.
diff --git a/src/TinyBlog.hs b/src/TinyBlog.hs index ae670b3..7c4be81 100644 --- a/src/TinyBlog.hs +++ b/src/TinyBlog.hs @@ -1,90 +1,101 @@ module TinyBlog( module TinyBlog.Config, TinyBlog.app ) where import TinyBlog.Config import TinyBlog.Entry import Data.Maybe +import Network.Gravatar import Network.Loli import Network.Loli.Template.TextTemplate import Network.Loli.Utils --import Hack.Contrib.Request import Hack.Contrib.Response import Hack --import Control.Monad.Reader -- | *application main app :: Config -> Hack.Env -> IO Hack.Response app cfg = loli $ do layout "layout.html" -- | JSON response get "/json/entries" $ do -- get count from querystring --env <- ask --let count = getCount env -- get recent entries files <- io $ getEntryFiles entries <- io $ readEntries files no_layout $ do update $ set_content_type "application/json; charset=utf-8" update $ set_body $ toJSON entries -- | RSS response get "/rss" $ do -- get recent entries files <- io $ getEntryFiles entries <- io $ readEntries files no_layout $ do update $ set_content_type "application/xml; charset=utf-8" update $ set_body $ toRSS entries cfg -- | HTML response get "/:entry" $ do ps <- captures let entryCode = fromJust $ lookup "entry" ps maybeEntry <- io $ readEntry $ "data/" ++ entryCode ++ ".txt" update $ set_content_type "text/html" case maybeEntry of Just entry -> do - context ((entryToKV entry) ++ [ - ("metaTitle", eTitle entry ++ " - " ++ (cBlogName cfg)) + let gravatarImage = getGravatarImage (cUseGravatar cfg) (cEmail cfg) + context ((entryToKV entry) ++ + [ ("metaTitle", eTitle entry ++ " - " ++ (cBlogName cfg)) + , ("gravatar", gravatarImage) ]) $ do output $ text_template "entry.html" Nothing -> do update $ set_status 404 no_layout $ output $ text_template "404.html" get "/" $ do -- get a latest entry files <- io $ getEntryFiles entries <- io $ readEntries files let entry = head entries + let gravatarImage = getGravatarImage (cUseGravatar cfg) (cEmail cfg) update $ set_content_type "text/html" - context ((entryToKV entry) ++ [ - ("metaTitle", cBlogName cfg) + context ((entryToKV entry) ++ + [ ("metaTitle", cBlogName cfg) + , ("gravatar", gravatarImage) ]) $ do - output $ text_template "entry.html" - + output $ text_template "index.html" public (Just ".") ["/static"] + +-- | get a gravatar image +getGravatarImage :: Bool -> String -> String +getGravatarImage True email = gravatar email +getGravatarImage False _ = "" + + -- | get count from querystring {- getCount :: Hack.Env -> Int getCount env = let ps = params env in case lookup "count" ps of Just count -> read count _ -> 20 -} diff --git a/src/TinyBlog/Config.hs b/src/TinyBlog/Config.hs index 9a3da3a..1c2ee5f 100644 --- a/src/TinyBlog/Config.hs +++ b/src/TinyBlog/Config.hs @@ -1,12 +1,13 @@ module TinyBlog.Config( Config(..) ) where data Config = Config { cBlogName :: String -- ^ blog name , cHostName :: String -- ^ host name , cAuthorName :: String -- ^ author name , cCopyright :: String -- ^ copyright , cEmail :: String -- ^ email , cDescription :: String -- ^ description of this blog + , cUseGravatar :: Bool -- ^ use gravatar image or not (http://gravatar.com) } deriving (Eq, Show) diff --git a/tinyblog.cabal b/tinyblog.cabal index 6efa10d..68077c1 100644 --- a/tinyblog.cabal +++ b/tinyblog.cabal @@ -1,40 +1,41 @@ Name: tinyblog -Version: 2010.1.4.1 +Version: 2010.1.11.1 Synopsis: a simple blog tool Description: a simple blog tool. Author: Nishiyama Yuya <[email protected]> Maintainer: Nishiyama Yuya <[email protected]> Build-Depends: base Cabal-Version: >= 1.2 License: BSD3 Category: Web -homepage: http://madvib.es +homepage: http://madvib.es/ Build-Type: Simple library ghc-options: -Wall -hide-package monads-fd build-depends: base , bytestring , convertible-text , data-object-json , directory + , gravatar , hack , hack-contrib , hack-handler-simpleserver , loli , mtl , network , old-time , regex-compat , regex-posix , rss , unix , utf8-string , xhtml hs-source-dirs: src/ exposed-modules: TinyBlog other-modules: TinyBlog.Config TinyBlog.Entry
nsyee/tinyblog
2ed15317b60c0fe99e52cd8ef4777ba2c6ecfe10
add an install document.
diff --git a/README b/README index e69de29..5a899f6 100644 --- a/README +++ b/README @@ -0,0 +1,44 @@ +# tinyblog + +A simple blog tool written with Haskell. + +## Install and compile: + + %git git://github.com/nsyee/tinyblog.git + %cd tinyblog + %runghc Setup.hs configure + %runghc Setup.hs build + %runghc Setup.hs install + +## Make your app like this: + + -- myapp.hs + module Main where + import TinyBlog + import Hack.Handler.SimpleServer -- use any Hack.Handler you like. + + main :: IO () + main = do + let cfg = Config + { cBlogName = "Sample Blog" -- ^ blog name + , cHostName = "sample.com"-- ^ host name + , cAuthorName = "your name"-- ^ author name + , cCopyright = "copyright 2010 foo name all rights reserved." -- ^ copyright + , cEmail = "[email protected]" -- ^ email + , cDescription = "On Loving Lambda" -- ^ description of this blog + , cUseGravatar = True -- ^ use gravatar image or not (http://gravatar.com) + } + let port = 3000 -- port number + run port $ TinyBlog.app cfg + -- /myapp.hs + + %ghc --make myapp.hs + %./myapp + +## Make html templates. See app/views dir. They are samples. + +check: <http://localhost:3000> + + +## See also +* tinyblog is using [loli](http://github.com/nfjinjing/loli) (Web Application Framework). diff --git a/app/Main.hs b/app/Main.hs index 6f89478..5af6cef 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,15 +1,17 @@ module Main where import TinyBlog -import Hack.Handler.Hyena +import Hack.Handler.SimpleServer main :: IO () main = do let cfg = Config - { cBlogName = "Sample Blog" - , cHostName = "sample.com" - , cAuthorName = "foo name" - , cCopyright = "copyright 2010 foo name all rights reserved." - , cEmail = "[email protected]" + { cBlogName = "Sample Blog" + , cHostName = "sample.com" + , cAuthorName = "your name" + , cCopyright = "copyright 2010 foo name all rights reserved." + , cEmail = "[email protected]" , cDescription = "On Loving Lambda" + , cUseGravatar = True } - run $ TinyBlog.app cfg + let port = 3000 -- port number + run port $ TinyBlog.app cfg
nsyee/tinyblog
7fe4e424d9852093ebc2247a4e93347658157412
fix a sort bug.
diff --git a/src/TinyBlog/Entry.hs b/src/TinyBlog/Entry.hs index d8fcb01..14a90c1 100644 --- a/src/TinyBlog/Entry.hs +++ b/src/TinyBlog/Entry.hs @@ -1,153 +1,158 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeSynonymInstances #-} module TinyBlog.Entry( Entry(..), getEntryFiles, readEntry, readEntries, entryToKV, sortByName, toJSON, toRSS ) where import TinyBlog.Config import qualified Data.ByteString.Lazy.UTF8 as B import qualified Data.Object.Json as J import System.Directory import System.Posix.Files import System.Time import Data.Maybe import Network.URI import qualified System.IO.UTF8 as U import qualified Text.RSS as R data Entry = Entry { eCode :: String -- ^ entry code , eTitle :: String -- ^ entry title , eBody :: String -- ^ entry body , eMtime :: CalendarTime -- ^ entry mtime , eUrl :: String -- ^ entry url } deriving (Eq, Show) -- | get entry file list getEntryFiles :: IO [FilePath] getEntryFiles = do curDir <- getCurrentDirectory cs <- getDirectoryContents $ curDir ++ "/data" let fs = map ("data/" ++) $ removeSwapFile $ removeDotFile cs stats <- mapM getFileStatus fs let results = sortByName $ zip stats fs return $ map (\(_, f) -> f) results where removeSwapFile = filter ((/=) '.' . head) removeDotFile = filter (`notElem` [".", ".."]) -- | read and make entry object readEntry :: FilePath -> IO (Maybe Entry) readEntry file = do exist <- doesFileExist file if exist then do ct <- U.readFile file stat <- getFileStatus file let cs = lines ct c = getCode file t = head cs b = (unlines . tail . tail) cs m = getMtime stat u = "/" ++ c ++ "/" return $ Just $ Entry c t b m u else return $ Nothing where getCode = takeWhile (/= '.') . tail . dropWhile (/= '/') getMtime s = toUTCTime $ TOD (truncate $ toRational $ modificationTime s) 0 readEntries :: [FilePath] -> IO [Entry] readEntries files = do mEntries <- mapM readEntry files return $ map fromJust $ filter isJust mEntries entryToKV :: Entry -> [(String, String)] entryToKV (Entry c t b m u) = [ ("code" ,c) , ("title",t) , ("body" ,b) , ("mtime",calendarTimeToString m) , ("url" ,u) ] -- | make entry list listKV :: [Entry] -> [[(String, String)]] listKV entries = map mkEntry entries where mkEntry (Entry c t b m u) = [ ("code", c) , ("title" , t) , ("mtime" ,calendarTimeToString m) , ("url", u) ] -- | sort entries by name sortByName :: [(FileStatus, FilePath)] -> [(FileStatus, FilePath)] -sortByName = reverse +sortByName [] = [] +sortByName (x@(_, xpath):xs) = greater ++ x:lesser + where lesser = + sortByName [y | y@(_, ypath) <- xs, ypath < xpath] + greater = + sortByName [y | y@(_, ypath) <- xs, ypath >= xpath] -- | sort entries by mtime {-- sortByMtime :: [(FileStatus, FilePath)] -> [(FileStatus, FilePath)] sortByMtime [] = [] sortByMtime (x@(xstat, _):xs) = greater ++ x:lesser where lesser = sortByMtime [y | y@(ystat, _) <- xs, (modificationTime ystat) < (modificationTime xstat) ] greater = sortByMtime [y | y@(ystat, _) <- xs, (modificationTime ystat) >= (modificationTime xstat) ] --} -- | get a JSON of entries toJSON :: [Entry] -> B.ByteString toJSON entries = J.encode $ J.toJsonObject $ map J.toJsonObject $ listKV entries -- | get a RSS of entries toRSS :: [Entry] -> Config -> B.ByteString toRSS entries cfg = (B.fromString . R.showXML . R.rssToXML) rss where rss = R.RSS title link description channel items title = cBlogName cfg link = URI { uriScheme = "http://" , uriPath = cHostName cfg , uriAuthority = Nothing , uriQuery = "" , uriFragment = "" } description = cDescription cfg channel = [ R.Copyright $ cCopyright cfg , R.WebMaster $ cEmail cfg , R.LastBuildDate $ eMtime $ head entries ] items = map mkItem $ take 20 entries mkItem e = [ R.Title $ eTitle e , R.Description $ eBody e , R.Author $ cAuthorName cfg , R.Link entryLink , R.Guid True (show entryLink) , R.PubDate $ eMtime e ] where entryLink = URI { uriScheme = "http://" , uriPath = (cHostName cfg) ++ "/" ++ (eCode e) , uriAuthority = Nothing , uriQuery = "" , uriFragment = "" }
ivh/TmyCMS
611d1f03ffb5c74426fc159d0a8000b620558c28
use markupfield instead of plain textile
diff --git a/blog/models.py b/blog/models.py index b1c463a..7b1b680 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,68 +1,70 @@ from django.utils.translation import ugettext_lazy as _ -from django.db import models as m from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from django.contrib.auth.models import User from django.contrib.comments.moderation import CommentModerator, moderator +from django.db.models import * +from markupfield.fields import MarkupField + LANGUAGES=( ('g',_('German')), ('s',_('Swedish')), ('e',_('English')), ) -class Tag(m.Model): - slug=m.SlugField(primary_key=True,unique=True) - name=m.CharField(max_length=128) - site=m.ManyToManyField(Site) +class Tag(Model): + slug=SlugField(primary_key=True,unique=True) + name=CharField(max_length=128) + site=ManyToManyField(Site) def __unicode__(self): return u'Tag: %s'%self.name - @m.permalink + @permalink def get_absolute_url(self): return ('tag', [self.slug]) class Meta: ordering = ["name"] -class Entry(m.Model): - pub_date=m.DateTimeField(null=True,blank=True) - mod_date=m.DateTimeField(auto_now=True) - author=m.ForeignKey(User,related_name='entries') - lang=m.CharField(max_length=1,choices=LANGUAGES) - title=m.CharField(max_length=512) - slug=m.SlugField() - body=m.TextField() - enable_comments = m.BooleanField(default=True) - tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) - site = m.ManyToManyField(Site) - objects = m.Manager() +class Entry(Model): + pub_date=DateTimeField(null=True,blank=True) + mod_date=DateTimeField(auto_now=True) + author=ForeignKey(User,related_name='entries') + lang=CharField(max_length=1,choices=LANGUAGES) + title=CharField(max_length=512) + slug=SlugField() + body=MarkupField(markup_type='textile') + enable_comments = BooleanField(default=True) + tags=ManyToManyField(Tag,related_name='entries',null=True,blank=True) + site = ManyToManyField(Site) + objects = Manager() on_site = CurrentSiteManager() def publish(self): pass def __unicode__(self): return u'Entry %s: %s'%(self.id,self.title) - @m.permalink + @permalink def get_absolute_url(self): return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) class Meta: ordering = ["-pub_date"] # see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ class EntryModerator(CommentModerator): email_notification = True enable_field = 'enable_comments' auto_moderate_field = 'pub_date' moderate_after = 31 moderator.register(Entry, EntryModerator) diff --git a/blog/views.py b/blog/views.py index 0a43774..c4b3c46 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,104 +1,102 @@ from django.http import Http404 from django.views.generic import list_detail from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext from models import Tag,Entry -import textile - import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tag_view(request, slug, page=1): tag = get_object_or_404(Tag,slug=slug) cursite=Site.objects.get_current() paginator = Paginator(tag.entries.filter(site=cursite),15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('tag.html', {"entries": entries, 'tag':tag}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): entry = get_object_or_404(Entry,pk=id) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): entry = get_object_or_404(Entry,pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return textile.textile(item.body) + return item.body.rendered def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/templates/base/entry.html b/templates/base/entry.html index 16e5b4d..84f5ff1 100644 --- a/templates/base/entry.html +++ b/templates/base/entry.html @@ -1,60 +1,60 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} <div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"><a href="{{ object.get_absolute_url }}" rel="bookmark" title="Permalink dieses Artikels">{{ object.title }}</a></h2> <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> - {{ object.body|textile }} + {{ object.body.rendered }} </div> <p class="tagdata"><strong>Schlagworte:</strong> {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}" rel="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %} {% endfor %}</p> </div> <div id="comments-header"> <div class="clearfix"> {% get_comment_count for object as comment_count %} <h2 class="title">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</h2> <p class="comments-feed"><a href="{{ object.get_absolute_url }}feed/">RSS-Feed f&uuml;r Kommentare zu diesem Artikel</a></p> </div> </div> <ol id="comments" class="clearfix"> {% get_comment_list for object as comment_list %} {% for comment in comment_list %} <li class="comment even thread-even depth-1" id="comment-{{ comment.id }}"> <div class="comment-wrapper clearfix" id="comment-wrapper-{{ comment.id }}"> <p class="comment-meta commentmetadata"> <span class="comment-author vcard"> {% if comment.user_url %}<a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %}</span> am <span class="comment-permalink"> <a title="Permalink zu diesem Kommentar" href="{{ object.get_absolute_url }}#comment-65045">2010-05-04 um 17:31</a></span> </p> <div class="comment-content content"> - {{ comment.comment|textile }} + {{ comment.comment }} </div> </div> </li> {% endfor %} </ol> <div id="respond"> <div id="respond-header" class="clearfix"> <h2 class="title">Kommentieren</h2> </div> {% render_comment_form for object %} </div> </div> {% endblock %} diff --git a/templates/base/search.html b/templates/base/search.html index 339e413..61ed765 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,36 +1,35 @@ {% extends "index.html" %} -{% load markup %} {% load comments %} {% block content %} <form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} {% block footsidebar %} {% if results %} <h1>Suchergebnisse</h1> {% endif %} {% endblock %} {% block footcontent %} {% if results %} {% for object in results %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> - {{ object.body|textile|truncatewords_html:30 }} + {{ object.body.rendered|truncatewords_html:30 }} </div> </div> {% endfor %} {% endif %} {% endblock %} diff --git a/templates/base/tag.html b/templates/base/tag.html index 12de466..27511f2 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,45 +1,44 @@ {% extends "index.html" %} -{% load markup %} {% load comments %} {% block content %} {% if entries %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> - {{ object.body|textile|truncatewords_html:30 }} + {{ object.body.rendered|truncatewords_html:30 }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="{% url tagpage slug=tag.slug page=entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="{% url tagpage slug=tag.slug page=entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %}
ivh/TmyCMS
cee0cb8393aac514830b67d93665cccbbafa343e
smaller changes, moving things around and make it work again with the testserver.
diff --git a/.gitignore b/.gitignore index 6596c23..9bf733d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc *~ *.db /pwds +*.swp diff --git a/blog/admin.py b/blog/admin.py index b41fa15..4ecff54 100644 --- a/blog/admin.py +++ b/blog/admin.py @@ -1,17 +1,17 @@ -from MyDjangoSites.blog.models import Tag,Entry +from models import Tag,Entry from django.contrib import admin class EntryAdmin(admin.ModelAdmin): list_display = ('title', 'pub_date') search_fields = ['title','body','slug'] date_hierarchy = 'pub_date' list_filter = ['pub_date'] class TagAdmin(admin.ModelAdmin): list_display = ('name', 'slug') search_fields = ['name'] admin.site.register(Entry,EntryAdmin) admin.site.register(Tag,TagAdmin) diff --git a/blog/models.py b/blog/models.py index 78f2a0b..b1c463a 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,68 +1,68 @@ from django.utils.translation import ugettext_lazy as _ from django.db import models as m from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from django.contrib.auth.models import User from django.contrib.comments.moderation import CommentModerator, moderator LANGUAGES=( ('g',_('German')), ('s',_('Swedish')), ('e',_('English')), ) class Tag(m.Model): slug=m.SlugField(primary_key=True,unique=True) name=m.CharField(max_length=128) site=m.ManyToManyField(Site) def __unicode__(self): return u'Tag: %s'%self.name @m.permalink def get_absolute_url(self): return ('tag', [self.slug]) class Meta: ordering = ["name"] class Entry(m.Model): pub_date=m.DateTimeField(null=True,blank=True) mod_date=m.DateTimeField(auto_now=True) author=m.ForeignKey(User,related_name='entries') lang=m.CharField(max_length=1,choices=LANGUAGES) title=m.CharField(max_length=512) slug=m.SlugField() body=m.TextField() enable_comments = m.BooleanField(default=True) tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) site = m.ManyToManyField(Site) objects = m.Manager() on_site = CurrentSiteManager() def publish(self): pass def __unicode__(self): return u'Entry %s: %s'%(self.id,self.title) @m.permalink def get_absolute_url(self): return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) class Meta: ordering = ["-pub_date"] - + # see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ class EntryModerator(CommentModerator): email_notification = True enable_field = 'enable_comments' auto_moderate_field = 'pub_date' moderate_after = 31 moderator.register(Entry, EntryModerator) diff --git a/blog/urls.py b/blog/urls.py new file mode 100644 index 0000000..6d547ed --- /dev/null +++ b/blog/urls.py @@ -0,0 +1,27 @@ +from django.conf.urls.defaults import * +from django.contrib.comments.feeds import LatestCommentFeed +from models import Tag,Entry +from views import LatestEntriesFeed + +feeds = { + 'comments': LatestCommentFeed, + 'posts':LatestEntriesFeed, +} + +urlpatterns = patterns('', + (r'^comments/feed/', LatestCommentFeed()), + (r'^feed/',LatestEntriesFeed()), + (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), +) + +urlpatterns += patterns('blog.views', + (r'^$', 'index'), + url(r'^page/(?P<page>\d+)/$', 'index',name='pindex'), + url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), + (r'^tags/$', 'tags'), + url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), + url(r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), + (r'^post/(?P<id>\d+)/$','entry_by_id'), + url(r'^search/$','search',name='search'), + + ) diff --git a/blog/views.py b/blog/views.py index d4a2ea3..0a43774 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,104 +1,104 @@ from django.http import Http404 from django.views.generic import list_detail -from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext +from models import Tag,Entry import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tag_view(request, slug, page=1): tag = get_object_or_404(Tag,slug=slug) - + cursite=Site.objects.get_current() paginator = Paginator(tag.entries.filter(site=cursite),15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('tag.html', {"entries": entries, 'tag':tag}) - + def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): entry = get_object_or_404(Entry,pk=id) - + return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): entry = get_object_or_404(Entry,pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) - + return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/settings.py b/settings.py index 849a3d7..f4d7bab 100644 --- a/settings.py +++ b/settings.py @@ -1,114 +1,114 @@ -# Django settings for MyDjangoSites project. +# Django settings for TmyCMS project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Thomas Marquart', '[email protected]'), ) MANAGERS = ADMINS -dbpwd=open('/home/tom/sites/MyDjangoSites/pwds').read().split()[3] +dbpwd=open('/home/tom/sites/TmyCMS/pwds').read().split()[3] DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'mydjangosites', # Or path to database file if using sqlite3. - 'USER': 'mydjangosites', # Not used with sqlite3. - 'PASSWORD': dbpwd, # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'tmycms', + 'USER': 'tmycms', + 'PASSWORD': dbpwd, + 'HOST': '', + 'PORT': '', }, 'sqlite': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', - 'USER': '', - 'PASSWORD': '', - 'HOST': '', + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/home/tom/sites/TmyCMS/mysites.db', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', 'PORT': '', - }, + }, } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'Europe/Stockholm' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'de-de' #SITE_ID = 1 from multisite.threadlocals import SiteIDHook SITE_ID = SiteIDHook() # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = False # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://all.tmy.se/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'multisite.template_loader.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'multisite.middleware.DynamicSiteMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) -ROOT_URLCONF = 'MyDjangoSites.urls' +ROOT_URLCONF = 'TmyCMS.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. - '/home/tom/sites/MyDjangoSites/templates' + '/home/tom/sites/TmyCMS/templates' ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.markup', 'django.contrib.flatpages', 'django.contrib.comments', - 'MyDjangoSites.blog', + 'blog', ) diff --git a/simple_search.py b/simple_search.py index 3e3be64..7ed8702 100644 --- a/simple_search.py +++ b/simple_search.py @@ -1,92 +1,80 @@ import re from django.db.models import Q from django import forms from django.utils.text import smart_split from django.conf import settings from django.core.exceptions import FieldError -from MyDjangoSites.blog.models import Entry +from blog.models import Entry from django.contrib.sites.models import Site class BaseSearchForm(forms.Form): q = forms.CharField(label='Suchbegriffe', required=False) def clean_q(self): return self.cleaned_data['q'].strip() - # order_by = forms.CharField( # widget=forms.HiddenInput(), # required=False, # ) - - class Meta: abstract = True base_qs = None search_fields = None fulltext_fields = None def get_text_search_query(self, query_string): filters = [] - + def construct_search(field_name): if field_name.startswith('^'): return "%s__istartswith" % field_name[1:] elif field_name.startswith('='): return "%s__iexact" % field_name[1:] elif field_name.startswith('@'): if settings.DATABASE_ENGINE == 'mysql': return "%s__search" % field_name[1:] else: return "%s__icontains" % field_name[1:] else: return "%s__icontains" % field_name - + for bit in smart_split(query_string): or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] filters.append(reduce(Q.__or__, or_queries)) - - return reduce(Q.__and__, filters) def construct_filter_args(self, cleaned_data=None): args = [] - if not cleaned_data: cleaned_data = self.cleaned_data - # construct text search if cleaned_data['q']: args.append(self.get_text_search_query(cleaned_data.pop('q'))) - # if its an instance of Q, append to filter args # otherwise assume an exact match lookup for field in cleaned_data: if isinstance(cleaned_data[field], Q): args.append(cleaned_data[field]) # elif field == 'order_by': # pass # special case - ordering handled in get_result_queryset elif cleaned_data[field]: args.append(Q(**{field: cleaned_data[field]})) - return args - - + def get_result_queryset(self): qs = self.Meta.base_qs.filter(*self.construct_filter_args()) for field_name in self.Meta.search_fields: if '__' in field_name: qs = qs.distinct() break - # if self.cleaned_data['order_by']: # qs = qs.order_by(self.cleaned_data['order_by']) - return qs class EntrySearchForm(BaseSearchForm): class Meta: base_qs = Entry.objects.filter(site=Site.objects.get_current()) search_fields = ['title','body',] diff --git a/static/admin-media b/static/admin-media index 40fba7a..289faf3 120000 --- a/static/admin-media +++ b/static/admin-media @@ -1 +1 @@ -../../../py/django/contrib/admin/media/ \ No newline at end of file +/usr/share/pyshared/django/contrib/admin/media/ \ No newline at end of file diff --git a/urls.py b/urls.py index 4031363..b364602 100644 --- a/urls.py +++ b/urls.py @@ -1,39 +1,15 @@ from django.conf.urls.defaults import * -from django.contrib.comments.feeds import LatestCommentFeed -from django.views.generic import list_detail -from MyDjangoSites.blog.models import Tag,Entry -from MyDjangoSites.blog.views import LatestEntriesFeed - from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^comments/', include('django.contrib.comments.urls')), ) -feeds = { - 'comments': LatestCommentFeed, - 'posts':LatestEntriesFeed, -} - urlpatterns += patterns('', - (r'^comments/feed/', LatestCommentFeed()), - (r'^feed/',LatestEntriesFeed()), - (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), -) - -urlpatterns += patterns('MyDjangoSites.blog.views', - (r'^$', 'index'), - url(r'^page/(?P<page>\d+)/$', 'index',name='pindex'), - url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), - (r'^tags/$', 'tags'), - url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), - url(r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), - (r'^post/(?P<id>\d+)/$','entry_by_id'), - url(r'^search/$','search',name='search'), - - ) + (r'', include('blog.urls')), + )
ivh/TmyCMS
7b8204fa30b3d30485f82a9c22d8546abc45edc5
name search url, update TODO
diff --git a/README b/README index 092d66e..233f60e 100644 --- a/README +++ b/README @@ -1,25 +1,26 @@ This is for serving several of my sites which currently run with Wordpress or Drupal. TODO: best-of categoy from Fiket why are some tags like eu-preasidentschaft broken fix language when importing apparentbrightness fix textile conversion, maybe abandoning it. fix the rss-feeds add second sidebar block for having both common and custom widgets between sites import the WP-pages! pagination liks for tag pages. +fix language in html declaration, make it dynamic write sidebar-"widgets" for last commented 1/2/3 years ago best of blogroll links In the longer run: -internationalize +internationalize all strings import tmy.se as well (drupal) add counter field to tags to order them by popularity diff --git a/templates/tarski.html b/templates/tarski.html index c856e2d..6e6ba1d 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,127 +1,127 @@ {% load markup %} {% load comments %} {% autoescape off %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> -<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> -<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> +<link rel="alternate" type="application/rss+xml" title="Feed" href="" /> +<link rel="alternate" type="application/rss+xml" title="Comments Feed" href="" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Base Template</h1> <p id="tagline">bla bla</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#comments" class="comments-link" title="Kommentare lesen oder selbst kommentieren">{% get_comment_count for object as comment_count %}{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} -<a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> +<a href="{% url pindex page=entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} -<a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> +<a href="{% url pindex page=entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% if tags %} <h3>Schlagworte</h3> <p>{% for tag in tags %} <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %} </p> {% endif %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} -<form action="/search/" method="get"> +<form action="{% url search %}" method="get"> <p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html> {% endautoescape %} diff --git a/urls.py b/urls.py index c50ec3e..4031363 100644 --- a/urls.py +++ b/urls.py @@ -1,39 +1,39 @@ from django.conf.urls.defaults import * from django.contrib.comments.feeds import LatestCommentFeed from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from MyDjangoSites.blog.views import LatestEntriesFeed from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^comments/', include('django.contrib.comments.urls')), ) feeds = { 'comments': LatestCommentFeed, 'posts':LatestEntriesFeed, } urlpatterns += patterns('', (r'^comments/feed/', LatestCommentFeed()), (r'^feed/',LatestEntriesFeed()), (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), ) urlpatterns += patterns('MyDjangoSites.blog.views', (r'^$', 'index'), - (r'^page/(?P<page>\d+)/$', 'index'), + url(r'^page/(?P<page>\d+)/$', 'index',name='pindex'), url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), (r'^tags/$', 'tags'), url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), url(r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), (r'^post/(?P<id>\d+)/$','entry_by_id'), - (r'^search/$','search'), + url(r'^search/$','search',name='search'), )
ivh/TmyCMS
adc45f7ff47f5675a6f00f406831df9fab61fcac
named url in tag template
diff --git a/urls.py b/urls.py index 7db200a..c50ec3e 100644 --- a/urls.py +++ b/urls.py @@ -1,39 +1,39 @@ from django.conf.urls.defaults import * from django.contrib.comments.feeds import LatestCommentFeed from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from MyDjangoSites.blog.views import LatestEntriesFeed from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^comments/', include('django.contrib.comments.urls')), ) feeds = { 'comments': LatestCommentFeed, 'posts':LatestEntriesFeed, } urlpatterns += patterns('', (r'^comments/feed/', LatestCommentFeed()), (r'^feed/',LatestEntriesFeed()), (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), ) urlpatterns += patterns('MyDjangoSites.blog.views', (r'^$', 'index'), (r'^page/(?P<page>\d+)/$', 'index'), url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), (r'^tags/$', 'tags'), url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), - (r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), + url(r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), (r'^post/(?P<id>\d+)/$','entry_by_id'), (r'^search/$','search'), )
ivh/TmyCMS
7cdb35944cc4e6dd898066a02f065240d3d5e5d1
named url in tag template
diff --git a/templates/base/tag.html b/templates/base/tag.html index 6b2b3b6..12de466 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,45 +1,45 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if entries %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} -<a href="{% url tagpage tag.slug entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> +<a href="{% url tagpage slug=tag.slug page=entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} -<a href="{% url tagpage tag.slug entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> +<a href="{% url tagpage slug=tag.slug page=entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %}
ivh/TmyCMS
7f34ddcb55740382a2fe59772416ac5b6d4d4f89
named url in tag template
diff --git a/templates/base/tag.html b/templates/base/tag.html index 4ae62f4..6b2b3b6 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,45 +1,45 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if entries %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} -<a href="{% url blog:tagpage tag.slug entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> +<a href="{% url tagpage tag.slug entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} -<a href="{% url blog:tagpage tag.slug entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> +<a href="{% url tagpage tag.slug entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %}
ivh/TmyCMS
8808949c08b9188aeaed77866c92de587c5fbc8d
named url in tag template
diff --git a/templates/base/tag.html b/templates/base/tag.html index 0df4584..4ae62f4 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,45 +1,45 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if entries %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} -<a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> +<a href="{% url blog:tagpage tag.slug entries.next_page_number %}">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} -<a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> +<a href="{% url blog:tagpage tag.slug entries.previous_page_number %}" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %} diff --git a/urls.py b/urls.py index 49eb32e..7db200a 100644 --- a/urls.py +++ b/urls.py @@ -1,39 +1,39 @@ from django.conf.urls.defaults import * from django.contrib.comments.feeds import LatestCommentFeed from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from MyDjangoSites.blog.views import LatestEntriesFeed from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^comments/', include('django.contrib.comments.urls')), ) feeds = { 'comments': LatestCommentFeed, 'posts':LatestEntriesFeed, } urlpatterns += patterns('', (r'^comments/feed/', LatestCommentFeed()), (r'^feed/',LatestEntriesFeed()), (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), ) urlpatterns += patterns('MyDjangoSites.blog.views', (r'^$', 'index'), (r'^page/(?P<page>\d+)/$', 'index'), url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), (r'^tags/$', 'tags'), url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), - (r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view'), + (r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)/$','tag_view',name='tagpage'), (r'^post/(?P<id>\d+)/$','entry_by_id'), (r'^search/$','search'), )
ivh/TmyCMS
36225f466dc539d4402b71a7ea0b782375811b11
add pagination to tags
diff --git a/templates/base/tag.html b/templates/base/tag.html index 4823227..765915a 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,45 +1,45 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} -{% if object_list %} +{% if entries %} -{% for object in object_list %} +{% for object in entries %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %}
ivh/TmyCMS
d1658498bf6180157bd19681c5957146a45a908b
add pagination to tags
diff --git a/blog/views.py b/blog/views.py index a6c94e9..d4a2ea3 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,106 +1,104 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) +def tag_view(request, slug, page=1): + tag = get_object_or_404(Tag,slug=slug) + + cursite=Site.objects.get_current() + paginator = Paginator(tag.entries.filter(site=cursite),15) + try: + entries = paginator.page(page) + except (EmptyPage, InvalidPage): + entries = paginator.page(paginator.num_pages) + + return render_to_response('tag.html', {"entries": entries, 'tag':tag}) + + def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): entry = get_object_or_404(Entry,pk=id) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): entry = get_object_or_404(Entry,pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) -def tag_view(request, slug, page=1): - tag = get_object_or_404(Tag,slug=slug) - - cursite=Site.objects.get_current() - entries=tag.entries.filter(site=cursite) - - return list_detail.object_list( - request, - queryset = entries, - template_name = "tag.html", - extra_context = {'tag':tag}, - paginate_by = 15 - ) - - class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
b17c7a01425b6e75597a63b1e1dd36eb9a2a0bfd
add pagination to tags
diff --git a/templates/base/tag.html b/templates/base/tag.html index 1b9d38a..4823227 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,34 +1,45 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if object_list %} {% for object in object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} +<p class="pagination"> +{% if entries.has_next %} +<a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> +{% endif %} +&nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; +{% if entries.has_previous %} +<a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> +{% endif %} +</p> + {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} + {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %}
ivh/TmyCMS
c029d44a2293f6ebe923af41ce84eeff7b360568
add autoescape off to tarski.html, also add admindocs in settings
diff --git a/settings.py b/settings.py index d5dba98..849a3d7 100644 --- a/settings.py +++ b/settings.py @@ -1,113 +1,114 @@ # Django settings for MyDjangoSites project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Thomas Marquart', '[email protected]'), ) MANAGERS = ADMINS dbpwd=open('/home/tom/sites/MyDjangoSites/pwds').read().split()[3] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'mydjangosites', # Or path to database file if using sqlite3. 'USER': 'mydjangosites', # Not used with sqlite3. 'PASSWORD': dbpwd, # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }, 'sqlite': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', }, } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'Europe/Stockholm' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'de-de' #SITE_ID = 1 from multisite.threadlocals import SiteIDHook SITE_ID = SiteIDHook() # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = False # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://all.tmy.se/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'multisite.template_loader.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'multisite.middleware.DynamicSiteMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) ROOT_URLCONF = 'MyDjangoSites.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/home/tom/sites/MyDjangoSites/templates' ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', + 'django.contrib.admindocs', 'django.contrib.markup', 'django.contrib.flatpages', 'django.contrib.comments', 'MyDjangoSites.blog', ) diff --git a/templates/tarski.html b/templates/tarski.html index 933c401..c856e2d 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,125 +1,127 @@ {% load markup %} {% load comments %} +{% autoescape off %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Base Template</h1> <p id="tagline">bla bla</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#comments" class="comments-link" title="Kommentare lesen oder selbst kommentieren">{% get_comment_count for object as comment_count %}{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% if tags %} <h3>Schlagworte</h3> <p>{% for tag in tags %} <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %} </p> {% endif %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} <form action="/search/" method="get"> <p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html> +{% endautoescape %}
ivh/TmyCMS
a145c202ea68ae295808b7b8080c7d1062bb5573
add pagination to tags
diff --git a/blog/views.py b/blog/views.py index cca183a..3486754 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,105 +1,105 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): entry = get_object_or_404(Entry,pk=id) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): entry = get_object_or_404(Entry,pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) -def tag_view(request, slug): +def tag_view(request, slug, page=1): tag = get_object_or_404(Tag,slug=slug) cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", extra_context = {'tag':tag} ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/urls.py b/urls.py index 9804380..27db7d4 100644 --- a/urls.py +++ b/urls.py @@ -1,38 +1,39 @@ from django.conf.urls.defaults import * from django.contrib.comments.feeds import LatestCommentFeed from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from MyDjangoSites.blog.views import LatestEntriesFeed from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^comments/', include('django.contrib.comments.urls')), ) feeds = { 'comments': LatestCommentFeed, 'posts':LatestEntriesFeed, } urlpatterns += patterns('', (r'^comments/feed/', LatestCommentFeed()), (r'^feed/',LatestEntriesFeed()), (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), ) urlpatterns += patterns('MyDjangoSites.blog.views', (r'^$', 'index'), (r'^page/(?P<page>\d+)/$', 'index'), url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), (r'^tags/$', 'tags'), url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), + (r'^tag/(?P<slug>\w+)/page/(?P<page>\d+)$','tag_view') (r'^post/(?P<id>\d+)/$','entry_by_id'), (r'^search/$','search'), )
ivh/TmyCMS
024131bd5660c12c45799ef3835bbfb5a00d25f9
get plurals right for comment numbers
diff --git a/templates/base/tag.html b/templates/base/tag.html index 0a32d8f..1b9d38a 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,34 +1,34 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if object_list %} {% for object in object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> - <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} {% block sidebar %} <p>Alle Artikel zum Schlagwort</p> <h2>{{ tag.name }}</h2> {% endblock %} diff --git a/templates/tarski.html b/templates/tarski.html index d2ae0a6..933c401 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,125 +1,125 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Base Template</h1> <p id="tagline">bla bla</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> - <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#comments" class="comments-link" title="Kommentare lesen oder selbst kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#comments" class="comments-link" title="Kommentare lesen oder selbst kommentieren">{% get_comment_count for object as comment_count %}{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% if tags %} <h3>Schlagworte</h3> <p>{% for tag in tags %} <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %} </p> {% endif %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} <form action="/search/" method="get"> <p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
488543e3691f4eb733916252e1f9be9da740700c
get plurals right for comment numbers
diff --git a/templates/base/entry.html b/templates/base/entry.html index 60b8d24..16e5b4d 100644 --- a/templates/base/entry.html +++ b/templates/base/entry.html @@ -1,60 +1,60 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} <div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"><a href="{{ object.get_absolute_url }}" rel="bookmark" title="Permalink dieses Artikels">{{ object.title }}</a></h2> - <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">Keine Kommentare</a></p> + <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</a></p> </div> <div class="content"> {{ object.body|textile }} </div> <p class="tagdata"><strong>Schlagworte:</strong> {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}" rel="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %} {% endfor %}</p> </div> <div id="comments-header"> <div class="clearfix"> {% get_comment_count for object as comment_count %} - <h2 class="title">{{ comment_count }} Kommentare</h2> + <h2 class="title">{% if comment_count %}{{ comment_count }} Kommentar{{ comment_count|pluralize:"e" }}{% else %}Keine Kommentare{% endif %}</h2> <p class="comments-feed"><a href="{{ object.get_absolute_url }}feed/">RSS-Feed f&uuml;r Kommentare zu diesem Artikel</a></p> </div> </div> <ol id="comments" class="clearfix"> {% get_comment_list for object as comment_list %} {% for comment in comment_list %} <li class="comment even thread-even depth-1" id="comment-{{ comment.id }}"> <div class="comment-wrapper clearfix" id="comment-wrapper-{{ comment.id }}"> <p class="comment-meta commentmetadata"> <span class="comment-author vcard"> {% if comment.user_url %}<a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %}</span> am <span class="comment-permalink"> <a title="Permalink zu diesem Kommentar" href="{{ object.get_absolute_url }}#comment-65045">2010-05-04 um 17:31</a></span> </p> <div class="comment-content content"> {{ comment.comment|textile }} </div> </div> </li> {% endfor %} </ol> <div id="respond"> <div id="respond-header" class="clearfix"> <h2 class="title">Kommentieren</h2> </div> {% render_comment_form for object %} </div> </div> {% endblock %}
ivh/TmyCMS
f0eacc8596e110ecab7e76fe5e08a3c35cd3ed9f
view shortcuts
diff --git a/blog/views.py b/blog/views.py index 3f51c17..e62db25 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,114 +1,105 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): - try: - entry = Entry.objects.get(pk=id) - except Entry.DoesNotExist: - raise Http404 + entry = get_object_or_404(Entry,pk=id) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): - try: - entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) - except Entry.DoesNotExist: - raise Http404 + entry = get_object_or_404(Entry,pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): - try: - tag = Tag.objects.get(slug=slug) - except Entry.DoesNotExist: - raise Http404 - + tag = get_object_or_404(Tag,slug=slug) + cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", extra_content = {'tag':tag} ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
b9776df0211eca0dd78f057ef77a38ae8faca686
better tag template
diff --git a/blog/views.py b/blog/views.py index 18238f6..3f51c17 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,113 +1,114 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() L(current_site.domain+' ; '+request.get_host()) tags=Tag.objects.filter(site=current_site) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", + extra_content = {'tag':tag} ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/templates/base/tag.html b/templates/base/tag.html index 8dbdbc5..0a32d8f 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,29 +1,34 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} {% if object_list %} {% for object in object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} {% else %} -<p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="">danach suchen</a>? (Noch nicht implementiert!)</p> +<p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="/search/?q={{ tag.name }}">danach suchen</a>?</p> {% endif %} {% endblock %} + +{% block sidebar %} +<p>Alle Artikel zum Schlagwort</p> +<h2>{{ tag.name }}</h2> +{% endblock %}
ivh/TmyCMS
a6bb0c547846ac2726e8b03b87fea2a8f7161e08
better tag template
diff --git a/templates/base/tag.html b/templates/base/tag.html index 5d4360d..8dbdbc5 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,27 +1,29 @@ {% extends "index.html" %} +{% load markup %} +{% load comments %} {% block content %} {% if object_list %} {% for object in object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %} {% else %} <p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="">danach suchen</a>? (Noch nicht implementiert!)</p> {% endif %} {% endblock %}
ivh/TmyCMS
439ff77239e2703e06d3412558f0e3421e85b4af
better tag template
diff --git a/templates/base/search.html b/templates/base/search.html index c44d379..339e413 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,36 +1,36 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} <form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} {% block footsidebar %} {% if results %} <h1>Suchergebnisse</h1> {% endif %} {% endblock %} {% block footcontent %} {% if results %} {% for object in results %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> -{% endfor %}<ul> +{% endfor %} {% endif %} {% endblock %} diff --git a/templates/base/tag.html b/templates/base/tag.html index d5b053e..5d4360d 100644 --- a/templates/base/tag.html +++ b/templates/base/tag.html @@ -1,11 +1,27 @@ {% extends "index.html" %} {% block content %} +{% if object_list %} + +{% for object in object_list %} +<div class="post-{{ object.id }} post entry "> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"> + <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> + </h2> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile|truncatewords_html:30 }} + + </div> + </div> -<ul> -{% for entry in object_list %} -<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> {% endfor %} -</ul> +{% else %} +<p>Keine Artikel zu diesem Schlagwort gefunden. Stattdessen <a href="">danach suchen</a>? (Noch nicht implementiert!)</p> +{% endif %} {% endblock %}
ivh/TmyCMS
81ea21440608da12b90aaeb9e6d0e7a27a267215
add AllBlog, both im import and as template
diff --git a/import_wp.py b/import_wp.py index 97a61ce..267498b 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,123 +1,138 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag unic= lambda x: x #.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, {'sitename':'ApparentBrightness','dbuser':'appbright','dbname':'appbright','pwd':pwds[4]}, {'sitename':'Erderhitzung','dbuser':'erderhitzung','dbname':'erderhitzung','pwd':pwds[5]}, ] +######################## def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:49],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) try: comm.save(force_insert=True) except Exception, e: print comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content print Exception, e if 'Incorrect string value' in e: comm.comment=comment_content.decode('latin1') comm.save(force_insert=True) def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name[:50]) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() if 'Incorrect string value' in e: entry.body=post_content.decode('latin1') entry.save(force_insert=True) cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) +## MAIN LOOP STARTS HERE + for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus) + + +ALLSITE=Site.objects.get(name='AllBlog') + +for tag in Tag.objects.all(): + tag.site.add(ALLSITE) + tag.save() + + +for entry in Entry.objects.all(): + entry.site.add(ALLSITE) + entry.save() diff --git a/templates/blog.tmy.se/entry.html b/templates/blog.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/blog.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/blog.tmy.se/index.html b/templates/blog.tmy.se/index.html new file mode 100644 index 0000000..4824df2 --- /dev/null +++ b/templates/blog.tmy.se/index.html @@ -0,0 +1,22 @@ +{% extends "tarski.html" %} + +{% block title %}Thomas' Blog{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Thomas' Blog</h1> + <p id="tagline">Ein Sammelsurium aus mehreren anderen Blogs</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> + <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + diff --git a/templates/blog.tmy.se/page.html b/templates/blog.tmy.se/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/blog.tmy.se/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/blog.tmy.se/search.html b/templates/blog.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/blog.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/blog.tmy.se/tag.html b/templates/blog.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/blog.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/blog.tmy.se/tags.html b/templates/blog.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/blog.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/tarski.html b/templates/tarski.html index 2da5fc1..d2ae0a6 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,125 +1,125 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Base Template</h1> <p id="tagline">bla bla</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> - <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#comments" class="comments-link" title="Kommentare lesen oder selbst kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% if tags %} <h3>Schlagworte</h3> <p>{% for tag in tags %} <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %} </p> {% endif %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} <form action="/search/" method="get"> <p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
a8a6cd0d5f080c1e4f167f09888d16fca064ce37
add ordering to tag model, write to-dos in README
diff --git a/README b/README index bc6f047..8701d4d 100644 --- a/README +++ b/README @@ -1,2 +1,23 @@ This is for serving several of my sites which currently run with Wordpress or Drupal. + + +TODO: +best-of categoy from Fiket +why are some tags like eu-preasidentschaft broken +fix language when importing apparentbrightness +fix textile conversion, maybe abandoning it. +fix the rss-feeds +add second sidebar block +import the pages! +add counter field to tags + +write sidebar-"widgets" for + last commented + 1/2/3 years ago + best of + blogroll + links + +internationalize +import tmy.se as well (drupal) diff --git a/blog/models.py b/blog/models.py index b177227..78f2a0b 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,65 +1,68 @@ from django.utils.translation import ugettext_lazy as _ from django.db import models as m from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from django.contrib.auth.models import User from django.contrib.comments.moderation import CommentModerator, moderator LANGUAGES=( ('g',_('German')), ('s',_('Swedish')), ('e',_('English')), ) class Tag(m.Model): slug=m.SlugField(primary_key=True,unique=True) name=m.CharField(max_length=128) site=m.ManyToManyField(Site) def __unicode__(self): return u'Tag: %s'%self.name @m.permalink def get_absolute_url(self): return ('tag', [self.slug]) + class Meta: + ordering = ["name"] + class Entry(m.Model): pub_date=m.DateTimeField(null=True,blank=True) mod_date=m.DateTimeField(auto_now=True) author=m.ForeignKey(User,related_name='entries') lang=m.CharField(max_length=1,choices=LANGUAGES) title=m.CharField(max_length=512) slug=m.SlugField() body=m.TextField() enable_comments = m.BooleanField(default=True) tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) site = m.ManyToManyField(Site) objects = m.Manager() on_site = CurrentSiteManager() def publish(self): pass def __unicode__(self): return u'Entry %s: %s'%(self.id,self.title) @m.permalink def get_absolute_url(self): return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) class Meta: ordering = ["-pub_date"] # see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ class EntryModerator(CommentModerator): email_notification = True enable_field = 'enable_comments' auto_moderate_field = 'pub_date' moderate_after = 31 moderator.register(Entry, EntryModerator)
ivh/TmyCMS
db9b2c059af195ddc410eed3a3d330a18e3ed31a
don't link if there is no user url
diff --git a/templates/base/entry.html b/templates/base/entry.html index bdf01e1..60b8d24 100644 --- a/templates/base/entry.html +++ b/templates/base/entry.html @@ -1,60 +1,60 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} <div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"><a href="{{ object.get_absolute_url }}" rel="bookmark" title="Permalink dieses Artikels">{{ object.title }}</a></h2> <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">Keine Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> <p class="tagdata"><strong>Schlagworte:</strong> {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}" rel="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %} {% endfor %}</p> </div> <div id="comments-header"> <div class="clearfix"> {% get_comment_count for object as comment_count %} <h2 class="title">{{ comment_count }} Kommentare</h2> <p class="comments-feed"><a href="{{ object.get_absolute_url }}feed/">RSS-Feed f&uuml;r Kommentare zu diesem Artikel</a></p> </div> </div> <ol id="comments" class="clearfix"> {% get_comment_list for object as comment_list %} {% for comment in comment_list %} <li class="comment even thread-even depth-1" id="comment-{{ comment.id }}"> <div class="comment-wrapper clearfix" id="comment-wrapper-{{ comment.id }}"> <p class="comment-meta commentmetadata"> <span class="comment-author vcard"> - <a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a></span> am <span class="comment-permalink"> + {% if comment.user_url %}<a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %}</span> am <span class="comment-permalink"> <a title="Permalink zu diesem Kommentar" href="{{ object.get_absolute_url }}#comment-65045">2010-05-04 um 17:31</a></span> </p> <div class="comment-content content"> {{ comment.comment|textile }} </div> </div> </li> {% endfor %} </ol> <div id="respond"> <div id="respond-header" class="clearfix"> <h2 class="title">Kommentieren</h2> </div> {% render_comment_form for object %} </div> </div> {% endblock %}
ivh/TmyCMS
958b57f6ca37bf14b13a3a32ad591d0de2902ee1
two new headers in templ, also add two DBs to the import script
diff --git a/import_wp.py b/import_wp.py index 8259b93..97a61ce 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,121 +1,123 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag unic= lambda x: x #.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, + {'sitename':'ApparentBrightness','dbuser':'appbright','dbname':'appbright','pwd':pwds[4]}, + {'sitename':'Erderhitzung','dbuser':'erderhitzung','dbname':'erderhitzung','pwd':pwds[5]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:49],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) try: comm.save(force_insert=True) except Exception, e: print comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content print Exception, e if 'Incorrect string value' in e: comm.comment=comment_content.decode('latin1') comm.save(force_insert=True) def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name[:50]) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() if 'Incorrect string value' in e: entry.body=post_content.decode('latin1') entry.save(force_insert=True) cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus) diff --git a/templates/apparentbrightness.net/index.html b/templates/apparentbrightness.net/index.html index 0605d15..d425c2c 100644 --- a/templates/apparentbrightness.net/index.html +++ b/templates/apparentbrightness.net/index.html @@ -1,24 +1,20 @@ {% extends "tarski.html" %} -{% block title %}Fiket{% endblock %} +{% block title %}Apparent Brightness{% endblock %} {% block header %} <div id="title"> - <h1 id="blog-title">Fiket</h1> - <p id="tagline">das Blog aus und über Schweden</p></div> + <h1 id="blog-title">Apparent Brightness</h1> + <p id="tagline">a (almost dead) blog about astronony</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> - <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> - <li><a id="nav-2-about" href="/ueber-fiket/">Über Fiket</a></li> - <li><a id="nav-933-dies-und-das" href="/dies-und-das/">Dies Und Das</a></li> - <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> - <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> + <li><a id="nav-home" class="nav-current" href="/" rel="home">Home</a></li> </ul> <div class="secondary"> - <p><a class="feed" href="/feed/">Feed abonnieren</a></p> + <p><a class="feed" href="/feed/">Subscribe</a></p> </div> </div> {% endblock %} diff --git a/templates/www.erderhitzung.de/index.html b/templates/www.erderhitzung.de/index.html index 0605d15..9e15dfb 100644 --- a/templates/www.erderhitzung.de/index.html +++ b/templates/www.erderhitzung.de/index.html @@ -1,24 +1,21 @@ {% extends "tarski.html" %} -{% block title %}Fiket{% endblock %} +{% block title %}Erderhitzung{% endblock %} {% block header %} <div id="title"> - <h1 id="blog-title">Fiket</h1> - <p id="tagline">das Blog aus und über Schweden</p></div> + <h1 id="blog-title">Erderhitzung</h1> + <p id="tagline">Ein Blog über den Klimawandel</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> - <li><a id="nav-2-about" href="/ueber-fiket/">Über Fiket</a></li> - <li><a id="nav-933-dies-und-das" href="/dies-und-das/">Dies Und Das</a></li> - <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> - <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> + <li><a id="nav-home" class="nav-current" href="/impressum/" rel="home">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div> </div> {% endblock %}
ivh/TmyCMS
0085198050968bf491e109fdc53cfac157dd4b6d
fix a template, add two new sites
diff --git a/templates/apparentbrightness.net/entry.html b/templates/apparentbrightness.net/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/apparentbrightness.net/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/apparentbrightness.net/index.html b/templates/apparentbrightness.net/index.html new file mode 100644 index 0000000..0605d15 --- /dev/null +++ b/templates/apparentbrightness.net/index.html @@ -0,0 +1,24 @@ +{% extends "tarski.html" %} + +{% block title %}Fiket{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="/ueber-fiket/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + diff --git a/templates/apparentbrightness.net/page.html b/templates/apparentbrightness.net/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/apparentbrightness.net/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/apparentbrightness.net/search.html b/templates/apparentbrightness.net/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/apparentbrightness.net/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/apparentbrightness.net/tag.html b/templates/apparentbrightness.net/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/apparentbrightness.net/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/apparentbrightness.net/tags.html b/templates/apparentbrightness.net/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/apparentbrightness.net/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/www.erderhitzung.de/entry.html b/templates/www.erderhitzung.de/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/www.erderhitzung.de/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/www.erderhitzung.de/index.html b/templates/www.erderhitzung.de/index.html new file mode 100644 index 0000000..0605d15 --- /dev/null +++ b/templates/www.erderhitzung.de/index.html @@ -0,0 +1,24 @@ +{% extends "tarski.html" %} + +{% block title %}Fiket{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="/ueber-fiket/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + diff --git a/templates/www.erderhitzung.de/page.html b/templates/www.erderhitzung.de/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/www.erderhitzung.de/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/www.erderhitzung.de/search.html b/templates/www.erderhitzung.de/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/www.erderhitzung.de/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/www.erderhitzung.de/tag.html b/templates/www.erderhitzung.de/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/www.erderhitzung.de/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/www.erderhitzung.de/tags.html b/templates/www.erderhitzung.de/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/www.erderhitzung.de/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file
ivh/TmyCMS
84c04401500d4d117bb1be0d589570e68a6635ce
fix a template, add two new sites
diff --git a/templates/fiket.tmy.se/index.html b/templates/fiket.tmy.se/index.html index bcda32a..0605d15 100644 --- a/templates/fiket.tmy.se/index.html +++ b/templates/fiket.tmy.se/index.html @@ -1,24 +1,24 @@ {% extends "tarski.html" %} {% block title %}Fiket{% endblock %} {% block header %} <div id="title"> <h1 id="blog-title">Fiket</h1> <p id="tagline">das Blog aus und über Schweden</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> - <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> - <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> - <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> - <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> - <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + <li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="/ueber-fiket/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> - <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div> </div> {% endblock %}
ivh/TmyCMS
cf68915c4af30e2a0021735b38b98a9ff064f2a2
add tag cloud
diff --git a/blog/views.py b/blog/views.py index 1de917d..18238f6 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,109 +1,113 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) -l=logging.debug +L=logging.debug def index(request,page=1): current_site = Site.objects.get_current() - l(current_site.domain+' ; '+request.get_host()) + L(current_site.domain+' ; '+request.get_host()) + + tags=Tag.objects.filter(site=current_site) + paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) - return render_to_response('index.html', {"entries": entries}) + + return render_to_response('index.html', {"entries": entries, 'tags':tags}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/templates/tarski.html b/templates/tarski.html index 300a512..2da5fc1 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,122 +1,125 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> - <h1 id="blog-title">Fiket</h1> - <p id="tagline">das Blog aus und über Schweden</p></div> + <h1 id="blog-title">Base Template</h1> + <p id="tagline">bla bla</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> -<li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> -<li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> -<li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> -<li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> -<li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> +<li><a id="nav-home" class="nav-current" href="/" rel="home">Startseite</a></li> +<li><a id="nav-11-impressum" href="/impressum/">Impressum</a></li> </ul> <div class="secondary"> - <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + <p><a class="feed" href="/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> -{% block sidebar %} - +{% block sidebar %} +{% if tags %} +<h3>Schlagworte</h3> +<p>{% for tag in tags %} +<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> +{% endfor %} +</p> +{% endif %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} <form action="/search/" method="get"> <p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
4b95ae8f78a3e459035990ce571ba7639210793a
add search feild to main template
diff --git a/templates/tarski.html b/templates/tarski.html index a967f4f..300a512 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,119 +1,122 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Fiket</h1> <p id="tagline">das Blog aus und über Schweden</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} <div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} +<form action="/search/" method="get"> +<p><input type="text" name="q" value="" id="id_q" /><input type="submit" value="Suchen" /> </p> + {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
9490e83c5fbf4a998c4f639a5b1952c9bb742295
small bug in css
diff --git a/templates/base/search.html b/templates/base/search.html index 655cccf..c44d379 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,36 +1,36 @@ {% extends "index.html" %} {% load markup %} {% load comments %} {% block content %} <form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} {% block footsidebar %} {% if results %} <h1>Suchergebnisse</h1> {% endif %} {% endblock %} {% block footcontent %} {% if results %} {% for object in results %} -<div class="post-{{ object.id }} post hentry "> +<div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %}<ul> {% endif %} {% endblock %} diff --git a/templates/tarski.html b/templates/tarski.html index 8670292..a967f4f 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,119 +1,119 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Fiket</h1> <p id="tagline">das Blog aus und über Schweden</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} {% for object in entries.object_list %} -<div class="post-{{ object.id }} post hentry "> +<div class="post-{{ object.id }} post entry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
871f9df1ac14659c46318557235dedf75e081f74
better search results
diff --git a/templates/base/search.html b/templates/base/search.html index b0fefeb..655cccf 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,33 +1,36 @@ {% extends "index.html" %} +{% load markup %} +{% load comments %} + {% block content %} <form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} {% block footsidebar %} {% if results %} <h1>Suchergebnisse</h1> {% endif %} {% endblock %} {% block footcontent %} {% if results %} {% for object in results %} <div class="post-{{ object.id }} post hentry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile|truncatewords_html:30 }} </div> </div> {% endfor %}<ul> {% endif %} {% endblock %}
ivh/TmyCMS
b37a90b5ac925d9e18d5928e06d2bafb392b41e9
error handling in import_wp; works with mysql now
diff --git a/import_wp.py b/import_wp.py index b1648a9..8259b93 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,110 +1,121 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag -unic= lambda x: x.decode('latin1') +unic= lambda x: x #.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: - comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:50],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) - comm.save(force_insert=True) - + comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:49],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) + try: comm.save(force_insert=True) + except Exception, e: + print comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content + print Exception, e + if 'Incorrect string value' in e: + comm.comment=comment_content.decode('latin1') + comm.save(force_insert=True) + def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name[:50]) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() + if 'Incorrect string value' in e: + entry.body=post_content.decode('latin1') + entry.save(force_insert=True) + + cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus)
ivh/TmyCMS
ddfb39a52091ff53903a3262dd337d079affcb72
better search results
diff --git a/templates/base/search.html b/templates/base/search.html index 3c0ee76..b0fefeb 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,22 +1,33 @@ {% extends "index.html" %} {% block content %} <form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} {% block footsidebar %} {% if results %} <h1>Suchergebnisse</h1> {% endif %} {% endblock %} {% block footcontent %} {% if results %} -<ul> -{% for entry in results %} -<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> -{% endfor %} -</ul> +{% for object in results %} +<div class="post-{{ object.id }} post hentry "> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"> + <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> + </h2> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile|truncatewords_html:30 }} + + </div> + </div> +{% endfor %}<ul> {% endif %} {% endblock %} diff --git a/templates/tarski.html b/templates/tarski.html index 3108e77..8670292 100644 --- a/templates/tarski.html +++ b/templates/tarski.html @@ -1,119 +1,119 @@ {% load markup %} {% load comments %} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> <head><title>{% block title %}Title{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="My custom Django application." /> <meta name="description" content="Writings about various topics by Thomas Marquart" /> <meta name="robots" content="all" /> <link rel="stylesheet" href="/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> <script type="text/javascript" src="tarski.js"></script> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> <link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> </head> <body id="home" class="centre classic"><div id="wrapper"> <div id="header"> {% block header %} <div id="title"> <h1 id="blog-title">Fiket</h1> <p id="tagline">das Blog aus und über Schweden</p></div> <div id="navigation" class="clearfix"> <ul class="primary xoxo"> <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> </ul> <div class="secondary"> <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> </div></div> {% endblock %} </div> <div id="content" class="clearfix"> <div class="primary posts"> {% block content %} -{% for object in entries.object_list%} -<div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> +{% for object in entries.object_list %} +<div class="post-{{ object.id }} post hentry "> <div class="meta"> <h2 class="title entry-title" id="post-{{ object.id }}"> <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> </h2> <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> </div> <div class="content"> {{ object.body|textile }} </div> </div> {% endfor %} <p class="pagination"> {% if entries.has_next %} <a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> {% endif %} &nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; {% if entries.has_previous %} <a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> {% endif %} </p> {% endblock %} </div> <div id="sidebar" class="secondary"> {% block sidebar %} {% endblock %} </div> </div> <!-- /main content --> <div id="footer" class="clearfix"> <div class="secondary"> {% block footsidebar %} {% endblock %} </div> <!-- /secondary --> <div class="primary"> {% block footcontent %} {% endblock %} </div> <!-- /primary --> <div id="theme-info" class="clearfix"> {% block themeinfo %} {% endblock %} </div> <!-- /theme-info --> </div> <!-- /footer --> </div> </body></html>
ivh/TmyCMS
be8345b8c697c076847a6232969c88a0edb2937f
try decoding first when importing again
diff --git a/import_wp.py b/import_wp.py index ea66704..b1648a9 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,110 +1,110 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag -unic= lambda x: x #u'%s'%x.decode('latin1') +unic= lambda x: x.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:50],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) comm.save(force_insert=True) def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name[:50]) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus)
ivh/TmyCMS
4a513f8ea53a703fde1d61952cad710b9a685a5b
truncate slug too
diff --git a/import_wp.py b/import_wp.py index 3782886..ea66704 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,110 +1,110 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag unic= lambda x: x #u'%s'%x.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: - comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:49],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) + comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:50],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) comm.save(force_insert=True) def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, - body=unic(post_content),author=AUTHOR,slug=post_name) + body=unic(post_content),author=AUTHOR,slug=post_name[:50]) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus)
ivh/TmyCMS
a847cf8b31ca83d298ed44b7d07aab7ac22a1cb8
truncate comment user_name
diff --git a/import_wp.py b/import_wp.py index c81ad4f..3782886 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,110 +1,110 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag unic= lambda x: x #u'%s'%x.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: - comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author),user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) + comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author)[:49],user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) comm.save(force_insert=True) def do_entries(cursor): cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus)
ivh/TmyCMS
3dd333984506663b0eb251bc14f4fa4e941b1833
make body a text-field
diff --git a/blog/models.py b/blog/models.py index 0c8c8e4..b177227 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,65 +1,65 @@ from django.utils.translation import ugettext_lazy as _ from django.db import models as m from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from django.contrib.auth.models import User from django.contrib.comments.moderation import CommentModerator, moderator LANGUAGES=( ('g',_('German')), ('s',_('Swedish')), ('e',_('English')), ) class Tag(m.Model): slug=m.SlugField(primary_key=True,unique=True) name=m.CharField(max_length=128) site=m.ManyToManyField(Site) def __unicode__(self): return u'Tag: %s'%self.name @m.permalink def get_absolute_url(self): return ('tag', [self.slug]) class Entry(m.Model): pub_date=m.DateTimeField(null=True,blank=True) mod_date=m.DateTimeField(auto_now=True) author=m.ForeignKey(User,related_name='entries') lang=m.CharField(max_length=1,choices=LANGUAGES) title=m.CharField(max_length=512) slug=m.SlugField() - body=m.CharField(max_length=100000) + body=m.TextField() enable_comments = m.BooleanField(default=True) tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) site = m.ManyToManyField(Site) objects = m.Manager() on_site = CurrentSiteManager() def publish(self): pass def __unicode__(self): return u'Entry %s: %s'%(self.id,self.title) @m.permalink def get_absolute_url(self): return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) class Meta: ordering = ["-pub_date"] # see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ class EntryModerator(CommentModerator): email_notification = True enable_field = 'enable_comments' auto_moderate_field = 'pub_date' moderate_after = 31 moderator.register(Entry, EntryModerator)
ivh/TmyCMS
3dee42458d006a572de1e02ee7db15d741267e85
increase body field length
diff --git a/blog/models.py b/blog/models.py index 1030d6c..0c8c8e4 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,65 +1,65 @@ from django.utils.translation import ugettext_lazy as _ from django.db import models as m from django.contrib.sites.models import Site from django.contrib.sites.managers import CurrentSiteManager from django.contrib.auth.models import User from django.contrib.comments.moderation import CommentModerator, moderator LANGUAGES=( ('g',_('German')), ('s',_('Swedish')), ('e',_('English')), ) class Tag(m.Model): slug=m.SlugField(primary_key=True,unique=True) name=m.CharField(max_length=128) site=m.ManyToManyField(Site) def __unicode__(self): return u'Tag: %s'%self.name @m.permalink def get_absolute_url(self): return ('tag', [self.slug]) class Entry(m.Model): pub_date=m.DateTimeField(null=True,blank=True) mod_date=m.DateTimeField(auto_now=True) author=m.ForeignKey(User,related_name='entries') lang=m.CharField(max_length=1,choices=LANGUAGES) title=m.CharField(max_length=512) slug=m.SlugField() - body=m.CharField(max_length=512) + body=m.CharField(max_length=100000) enable_comments = m.BooleanField(default=True) tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) site = m.ManyToManyField(Site) objects = m.Manager() on_site = CurrentSiteManager() def publish(self): pass def __unicode__(self): return u'Entry %s: %s'%(self.id,self.title) @m.permalink def get_absolute_url(self): return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) class Meta: ordering = ["-pub_date"] # see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ class EntryModerator(CommentModerator): email_notification = True enable_field = 'enable_comments' auto_moderate_field = 'pub_date' moderate_after = 31 moderator.register(Entry, EntryModerator)
ivh/TmyCMS
73a1747e1f5992647c6c987c27a3c015957f48da
mysql db in settings
diff --git a/settings.py b/settings.py index 42207f7..d5dba98 100644 --- a/settings.py +++ b/settings.py @@ -1,104 +1,113 @@ # Django settings for MyDjangoSites project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Thomas Marquart', '[email protected]'), ) MANAGERS = ADMINS +dbpwd=open('/home/tom/sites/MyDjangoSites/pwds').read().split()[3] DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. + 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'mydjangosites', # Or path to database file if using sqlite3. + 'USER': 'mydjangosites', # Not used with sqlite3. + 'PASSWORD': dbpwd, # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }, + 'sqlite': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', + 'PORT': '', + }, } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'Europe/Stockholm' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'de-de' #SITE_ID = 1 from multisite.threadlocals import SiteIDHook SITE_ID = SiteIDHook() # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = False # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://all.tmy.se/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'multisite.template_loader.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'multisite.middleware.DynamicSiteMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) ROOT_URLCONF = 'MyDjangoSites.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/home/tom/sites/MyDjangoSites/templates' ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.markup', 'django.contrib.flatpages', 'django.contrib.comments', 'MyDjangoSites.blog', )
ivh/TmyCMS
ff938abb956e30b0b650f60ab928ef818449cb16
leave pages out of import for now
diff --git a/blog/views.py b/blog/views.py index a1d3cdf..1de917d 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,109 +1,109 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return textile.textile(item.body,encoding='utf8') + return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) ) diff --git a/import_wp.py b/import_wp.py index b3cfb4e..c81ad4f 100755 --- a/import_wp.py +++ b/import_wp.py @@ -1,110 +1,110 @@ #!/usr/bin/python import MySQLdb import sys,os import string as s os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' from datetime import datetime from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.contrib.comments.models import Comment from django.db.utils import IntegrityError from MyDjangoSites.blog.models import Entry, Tag unic= lambda x: x #u'%s'%x.decode('latin1') from random import choice def RandStr(length=3, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) pwds=open('pwds').readlines() pwds=map(s.strip,pwds) blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, ] def do_tags(cursor): cursor.execute('select name,slug from wp_terms;') for name,slug in cursor.fetchall(): print name, slug t=Tag(slug=slug) t.name=name t.save() t.site.add(SITE) t.save() def do_comments(cursor,ID,entry): cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) comments=cursor.fetchall() for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author),user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) comm.save(force_insert=True) def do_entries(cursor): - cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post" or post_type="page");') + cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post");') posts=cursor.fetchall() for ID,post_date,post_title,post_content,post_name in posts: entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, body=unic(post_content),author=AUTHOR,slug=post_name) entry.save(force_insert=True) entry.site.add(SITE) try: entry.save() except IntegrityError,e: print e if 'column slug is not unique' in e: entry.slug=entry.slug+RandStr() entry.save() cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) tags=cursor.fetchall() for tag_name,tag_slug in tags: tag=Tag.objects.get(slug=tag_slug) entry.tags.add(tag) entry.save() do_comments(cursor,ID,entry) for blog in blogs: conn = MySQLdb.connect (host = "localhost", user = blog['dbuser'], passwd = blog['pwd'], db = blog['dbname']) cursor = conn.cursor () LANG='g' SITE=Site.objects.get(name=blog['sitename']) AUTHOR=User.objects.get(pk=1) do_tags(cursor) do_entries(cursor) ####### special operations # get entries tagged Europa into the EU-site # and the other tags too. et=Tag.objects.get(slug='europa') eus=Site.objects.get(name='EU') ee=Entry.objects.filter(tags=et) for e in ee: e.site.add(eus) e.save() for t in e.tags.all(): if t.slug != 'europa': t.site.add(eus)
ivh/TmyCMS
fd43943d67f0bc2fd947f0ae773d4396e5b4055c
add textile to feed
diff --git a/blog/views.py b/blog/views.py index 1de917d..a1d3cdf 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,109 +1,109 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return textile.textile(item.body) + return textile.textile(item.body,encoding='utf8') def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
64d71a611ed1ca1e75939d09c4f947dd7d1a7f1b
add textile to feed
diff --git a/blog/views.py b/blog/views.py index f90c76c..1de917d 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,109 +1,109 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return textile.textile(item.body,encoding='utf8',output='utf8') + return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
2b36bce92e18f0f60858af892e47f9cea6992f53
add textile to feed
diff --git a/blog/views.py b/blog/views.py index 1de917d..f90c76c 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,109 +1,109 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import textile import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return textile.textile(item.body) + return textile.textile(item.body,encoding='utf8',output='utf8') def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
06556316e3407a6e63f089813fc3d7a16101d35a
add textile to feed
diff --git a/blog/views.py b/blog/views.py index 262245f..1de917d 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,107 +1,109 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext +import textile + import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.filter(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): - return item.body + return textile.textile(item.body) def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
8a619501f9777c5f94711eec5c1af40befdd5c1d
divide feeds by site
diff --git a/blog/views.py b/blog/views.py index 1e60d5d..14f0147 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,107 +1,107 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain+' ; '+request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): - return Entry.objects.all()[:15] + return Entry.objects.all(site=Site.objects.get_current())[:15] def item_title(self, item): return item.title def item_description(self, item): return item.body def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
ecaf7c91c12d839ece427e19715432519219da2c
work on search
diff --git a/simple_search.py b/simple_search.py index 7a9fbe5..3e3be64 100644 --- a/simple_search.py +++ b/simple_search.py @@ -1,91 +1,92 @@ import re from django.db.models import Q from django import forms from django.utils.text import smart_split from django.conf import settings from django.core.exceptions import FieldError from MyDjangoSites.blog.models import Entry - +from django.contrib.sites.models import Site + class BaseSearchForm(forms.Form): q = forms.CharField(label='Suchbegriffe', required=False) def clean_q(self): return self.cleaned_data['q'].strip() # order_by = forms.CharField( # widget=forms.HiddenInput(), # required=False, # ) class Meta: abstract = True base_qs = None search_fields = None fulltext_fields = None def get_text_search_query(self, query_string): filters = [] def construct_search(field_name): if field_name.startswith('^'): return "%s__istartswith" % field_name[1:] elif field_name.startswith('='): return "%s__iexact" % field_name[1:] elif field_name.startswith('@'): if settings.DATABASE_ENGINE == 'mysql': return "%s__search" % field_name[1:] else: return "%s__icontains" % field_name[1:] else: return "%s__icontains" % field_name for bit in smart_split(query_string): or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] filters.append(reduce(Q.__or__, or_queries)) return reduce(Q.__and__, filters) def construct_filter_args(self, cleaned_data=None): args = [] if not cleaned_data: cleaned_data = self.cleaned_data # construct text search if cleaned_data['q']: args.append(self.get_text_search_query(cleaned_data.pop('q'))) # if its an instance of Q, append to filter args # otherwise assume an exact match lookup for field in cleaned_data: if isinstance(cleaned_data[field], Q): args.append(cleaned_data[field]) # elif field == 'order_by': # pass # special case - ordering handled in get_result_queryset elif cleaned_data[field]: args.append(Q(**{field: cleaned_data[field]})) return args def get_result_queryset(self): qs = self.Meta.base_qs.filter(*self.construct_filter_args()) for field_name in self.Meta.search_fields: if '__' in field_name: qs = qs.distinct() break # if self.cleaned_data['order_by']: # qs = qs.order_by(self.cleaned_data['order_by']) return qs class EntrySearchForm(BaseSearchForm): class Meta: - base_qs = Entry.objects + base_qs = Entry.objects.filter(site=Site.objects.get_current()) search_fields = ['title','body',]
ivh/TmyCMS
20e6eb0a0b03d566d5c1310b81d2db5cc8ff896b
work on search
diff --git a/simple_search.py b/simple_search.py index 562cd9c..7a9fbe5 100644 --- a/simple_search.py +++ b/simple_search.py @@ -1,91 +1,91 @@ import re from django.db.models import Q from django import forms from django.utils.text import smart_split from django.conf import settings from django.core.exceptions import FieldError from MyDjangoSites.blog.models import Entry class BaseSearchForm(forms.Form): q = forms.CharField(label='Suchbegriffe', required=False) def clean_q(self): return self.cleaned_data['q'].strip() - order_by = forms.CharField( - widget=forms.HiddenInput(), - required=False, - ) +# order_by = forms.CharField( +# widget=forms.HiddenInput(), +# required=False, +# ) class Meta: abstract = True base_qs = None search_fields = None fulltext_fields = None def get_text_search_query(self, query_string): filters = [] def construct_search(field_name): if field_name.startswith('^'): return "%s__istartswith" % field_name[1:] elif field_name.startswith('='): return "%s__iexact" % field_name[1:] elif field_name.startswith('@'): if settings.DATABASE_ENGINE == 'mysql': return "%s__search" % field_name[1:] else: return "%s__icontains" % field_name[1:] else: return "%s__icontains" % field_name for bit in smart_split(query_string): or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] filters.append(reduce(Q.__or__, or_queries)) return reduce(Q.__and__, filters) def construct_filter_args(self, cleaned_data=None): args = [] if not cleaned_data: cleaned_data = self.cleaned_data # construct text search if cleaned_data['q']: args.append(self.get_text_search_query(cleaned_data.pop('q'))) # if its an instance of Q, append to filter args # otherwise assume an exact match lookup for field in cleaned_data: if isinstance(cleaned_data[field], Q): args.append(cleaned_data[field]) - elif field == 'order_by': - pass # special case - ordering handled in get_result_queryset +# elif field == 'order_by': +# pass # special case - ordering handled in get_result_queryset elif cleaned_data[field]: args.append(Q(**{field: cleaned_data[field]})) return args def get_result_queryset(self): qs = self.Meta.base_qs.filter(*self.construct_filter_args()) for field_name in self.Meta.search_fields: if '__' in field_name: qs = qs.distinct() break - if self.cleaned_data['order_by']: - qs = qs.order_by(self.cleaned_data['order_by']) +# if self.cleaned_data['order_by']: +# qs = qs.order_by(self.cleaned_data['order_by']) return qs class EntrySearchForm(BaseSearchForm): class Meta: base_qs = Entry.objects search_fields = ['title','body',] diff --git a/templates/base/search.html b/templates/base/search.html index 1f8029b..3c0ee76 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,14 +1,22 @@ {% extends "index.html" %} {% block content %} -<form action="." method="get"> +<form action="/search/" method="get"> {{ form.as_p }}<input type="submit" value="Suchen" /> {% endblock %} + +{% block footsidebar %} +{% if results %} +<h1>Suchergebnisse</h1> +{% endif %} +{% endblock %} + + {% block footcontent %} {% if results %} <ul> {% for entry in results %} <li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> {% endfor %} </ul> {% endif %} {% endblock %}
ivh/TmyCMS
48e3662764de632942d439eb8863a7c5ed5f5d02
work on search
diff --git a/templates/base/search.html b/templates/base/search.html index d07e362..1f8029b 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,12 +1,14 @@ {% extends "index.html" %} {% block content %} <form action="." method="get"> -{% csrf_token %} -<table>{{ form.as_table }}</table><input type="submit" value="Suchen" /> - +{{ form.as_p }}<input type="submit" value="Suchen" /> +{% endblock %} +{% block footcontent %} +{% if results %} <ul> {% for entry in results %} <li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> {% endfor %} </ul> +{% endif %} {% endblock %}
ivh/TmyCMS
92becb4d2f24d6edab4db937ffaced2d34fb0a9f
work on search
diff --git a/simple_search.py b/simple_search.py index 6d37ee5..562cd9c 100644 --- a/simple_search.py +++ b/simple_search.py @@ -1,91 +1,91 @@ import re from django.db.models import Q from django import forms from django.utils.text import smart_split from django.conf import settings from django.core.exceptions import FieldError from MyDjangoSites.blog.models import Entry class BaseSearchForm(forms.Form): - q = forms.CharField(label='Search', required=False) + q = forms.CharField(label='Suchbegriffe', required=False) def clean_q(self): return self.cleaned_data['q'].strip() order_by = forms.CharField( widget=forms.HiddenInput(), required=False, ) class Meta: abstract = True base_qs = None search_fields = None fulltext_fields = None def get_text_search_query(self, query_string): filters = [] def construct_search(field_name): if field_name.startswith('^'): return "%s__istartswith" % field_name[1:] elif field_name.startswith('='): return "%s__iexact" % field_name[1:] elif field_name.startswith('@'): if settings.DATABASE_ENGINE == 'mysql': return "%s__search" % field_name[1:] else: return "%s__icontains" % field_name[1:] else: return "%s__icontains" % field_name for bit in smart_split(query_string): or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] filters.append(reduce(Q.__or__, or_queries)) return reduce(Q.__and__, filters) def construct_filter_args(self, cleaned_data=None): args = [] if not cleaned_data: cleaned_data = self.cleaned_data # construct text search if cleaned_data['q']: args.append(self.get_text_search_query(cleaned_data.pop('q'))) # if its an instance of Q, append to filter args # otherwise assume an exact match lookup for field in cleaned_data: if isinstance(cleaned_data[field], Q): args.append(cleaned_data[field]) elif field == 'order_by': pass # special case - ordering handled in get_result_queryset elif cleaned_data[field]: args.append(Q(**{field: cleaned_data[field]})) return args def get_result_queryset(self): qs = self.Meta.base_qs.filter(*self.construct_filter_args()) for field_name in self.Meta.search_fields: if '__' in field_name: qs = qs.distinct() break if self.cleaned_data['order_by']: qs = qs.order_by(self.cleaned_data['order_by']) return qs class EntrySearchForm(BaseSearchForm): class Meta: base_qs = Entry.objects search_fields = ['title','body',] diff --git a/templates/base/search.html b/templates/base/search.html index 2331312..d07e362 100644 --- a/templates/base/search.html +++ b/templates/base/search.html @@ -1,14 +1,12 @@ {% extends "index.html" %} {% block content %} -<form action="." method="post"> +<form action="." method="get"> {% csrf_token %} -{{ form.as_p }} -<input type="submit" value="Suchen" /> - +<table>{{ form.as_table }}</table><input type="submit" value="Suchen" /> <ul> {% for entry in results %} <li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> {% endfor %} </ul> {% endblock %}
ivh/TmyCMS
e605be8d22df056e0aa62fc732014abeca4bbf39
add (flat) page template
diff --git a/templates/atheist.tmy.se/page.html b/templates/atheist.tmy.se/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/atheist.tmy.se/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/base/page.html b/templates/base/page.html new file mode 100644 index 0000000..65d7142 --- /dev/null +++ b/templates/base/page.html @@ -0,0 +1,5 @@ +{% extends "index.html" %} + +{% block content %} +{{ flatpage.content }} +{% endblock %} diff --git a/templates/blogblog.tmy.se/page.html b/templates/blogblog.tmy.se/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/blogblog.tmy.se/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/page.html b/templates/fiket.tmy.se/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/fiket.tmy.se/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file diff --git a/templates/www.betreff.eu/page.html b/templates/www.betreff.eu/page.html new file mode 120000 index 0000000..019b8e8 --- /dev/null +++ b/templates/www.betreff.eu/page.html @@ -0,0 +1 @@ +../base/page.html \ No newline at end of file
ivh/TmyCMS
f9da38cee22bead8ee0f205edbec2e7e1cf8c1d5
add flatpages middleware
diff --git a/settings.py b/settings.py index f2c05c0..42207f7 100644 --- a/settings.py +++ b/settings.py @@ -1,103 +1,104 @@ # Django settings for MyDjangoSites project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Thomas Marquart', '[email protected]'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }, } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'Europe/Stockholm' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'de-de' #SITE_ID = 1 from multisite.threadlocals import SiteIDHook SITE_ID = SiteIDHook() # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = False # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://all.tmy.se/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'multisite.template_loader.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'multisite.middleware.DynamicSiteMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) ROOT_URLCONF = 'MyDjangoSites.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/home/tom/sites/MyDjangoSites/templates' ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.markup', 'django.contrib.flatpages', 'django.contrib.comments', 'MyDjangoSites.blog', )
ivh/TmyCMS
22799773dfdbfa139d5e2ac95f6598abd217dcbf
debug info
diff --git a/blog/views.py b/blog/views.py index af830ff..2f5bfd2 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,107 +1,107 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import logging logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() - l(current_site.domain) + l(current_site.domain,request.get_host()) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.all()[:15] def item_title(self, item): return item.title def item_description(self, item): return item.body def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
5a62fd741fa67a2e728c489fc036fdea53204b94
proper logging in views
diff --git a/blog/views.py b/blog/views.py index 59817c4..af830ff 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,107 +1,107 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext import logging -logging.basicConfig(filename='/tmp/mydjangodebug.log'level=logging.DEBUG) +logging.basicConfig(filename='/tmp/mydjangodebug.log',level=logging.DEBUG) l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() l(current_site.domain) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.all()[:15] def item_title(self, item): return item.title def item_description(self, item): return item.body def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
4c0833a5c87fae6a2b51ead0f5c9580a39f5935d
proper logging in views
diff --git a/blog/views.py b/blog/views.py index cc6028c..59817c4 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,103 +1,107 @@ from django.http import Http404 from django.views.generic import list_detail from MyDjangoSites.blog.models import Tag,Entry from django.contrib.sites.models import Site from django.contrib.syndication.views import Feed from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import render_to_response,get_object_or_404 from simple_search import EntrySearchForm from django.template import RequestContext +import logging +logging.basicConfig(filename='/tmp/mydjangodebug.log'level=logging.DEBUG) +l=logging.debug def index(request,page=1): current_site = Site.objects.get_current() + l(current_site.domain) paginator = Paginator(Entry.objects.filter(site=current_site), 15) try: entries = paginator.page(page) except (EmptyPage, InvalidPage): entries = paginator.page(paginator.num_pages) return render_to_response('index.html', {"entries": entries}) def tags(request): current_site = Site.objects.get_current() return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') def entry_by_id(request, id): try: entry = Entry.objects.get(pk=id) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=id ) def entry_by_permalink(request, yr,mon,day,slug): try: entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) except Entry.DoesNotExist: raise Http404 return list_detail.object_detail( request, queryset = Entry.objects.all(), template_name = "entry.html", object_id=entry.id ) def tag_view(request, slug): try: tag = Tag.objects.get(slug=slug) except Entry.DoesNotExist: raise Http404 cursite=Site.objects.get_current() entries=tag.entries.filter(site=cursite) return list_detail.object_list( request, queryset = entries, template_name = "tag.html", ) class LatestEntriesFeed(Feed): title = Site.objects.get_current().name link = "http://%s"%Site.objects.get_current().domain description = "" def items(self): return Entry.objects.all()[:15] def item_title(self, item): return item.title def item_description(self, item): return item.body def search(request): # from http://gregbrown.co.nz/code/django-simple-search/ if request.GET: form = EntrySearchForm(request.GET) if form.is_valid(): - print 'bla' + results = form.get_result_queryset() else: results = [] else: form = EntrySearchForm() results = [] return render_to_response( 'search.html', RequestContext(request, { 'form': form, 'results': results, }) )
ivh/TmyCMS
f8260e5e10f7cdfebc7ecc92cbf8e384656597a7
rename eu-templates
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6596c23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyc +*~ +*.db +/pwds diff --git a/README b/README new file mode 100644 index 0000000..bc6f047 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +This is for serving several of my sites +which currently run with Wordpress or Drupal. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apache.conf b/apache.conf new file mode 100644 index 0000000..5cad43a --- /dev/null +++ b/apache.conf @@ -0,0 +1,29 @@ +<VirtualHost *:80> +ServerName all.tmy.se +ServerAlias blogblog.tmy.se +ServerAlias fiket.tmy.se +ServerAlias atheist.tmy.se +ServerAlias eu.tmy.se + +CustomLog /var/log/apache2/django.access.log combined env=!dontlog + +Alias /robots.txt /home/tom/sites/MyDjangoSites/static/robots.txt +Alias /favicon.ico /home/tom/sites/MyDjangoSites/static/favicon.ico + +Alias /admin-media/ /home/tom/sites/MyDjangoSites/static/admin-media/ +Alias /images/ /home/tom/sites/MyDjangoSites/static/images/ + +AliasMatch /([^/]*\.css) /home/tom/sites/MyDjangoSites/static/css/$1 +AliasMatch /([^/]*\.js) /home/tom/sites/MyDjangoSites/static/js/$1 + + +<Directory /home/tom/sites/MyDjangoSites/static> +Options FollowSymLinks +Order deny,allow +Allow from all +</Directory> + +WSGIScriptAlias / /home/tom/sites/MyDjangoSites/django.wsgi + +</VirtualHost> + diff --git a/blog/__init__.py b/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/blog/admin.py b/blog/admin.py new file mode 100644 index 0000000..b41fa15 --- /dev/null +++ b/blog/admin.py @@ -0,0 +1,17 @@ +from MyDjangoSites.blog.models import Tag,Entry +from django.contrib import admin + +class EntryAdmin(admin.ModelAdmin): + list_display = ('title', 'pub_date') + search_fields = ['title','body','slug'] + date_hierarchy = 'pub_date' + list_filter = ['pub_date'] + +class TagAdmin(admin.ModelAdmin): + list_display = ('name', 'slug') + search_fields = ['name'] + + + +admin.site.register(Entry,EntryAdmin) +admin.site.register(Tag,TagAdmin) diff --git a/blog/models.py b/blog/models.py new file mode 100644 index 0000000..1030d6c --- /dev/null +++ b/blog/models.py @@ -0,0 +1,65 @@ +from django.utils.translation import ugettext_lazy as _ +from django.db import models as m +from django.contrib.sites.models import Site +from django.contrib.sites.managers import CurrentSiteManager +from django.contrib.auth.models import User +from django.contrib.comments.moderation import CommentModerator, moderator + +LANGUAGES=( +('g',_('German')), +('s',_('Swedish')), +('e',_('English')), +) + +class Tag(m.Model): + slug=m.SlugField(primary_key=True,unique=True) + name=m.CharField(max_length=128) + site=m.ManyToManyField(Site) + def __unicode__(self): + return u'Tag: %s'%self.name + + @m.permalink + def get_absolute_url(self): + return ('tag', [self.slug]) + +class Entry(m.Model): + pub_date=m.DateTimeField(null=True,blank=True) + mod_date=m.DateTimeField(auto_now=True) + author=m.ForeignKey(User,related_name='entries') + lang=m.CharField(max_length=1,choices=LANGUAGES) + title=m.CharField(max_length=512) + slug=m.SlugField() + body=m.CharField(max_length=512) + enable_comments = m.BooleanField(default=True) + tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) + site = m.ManyToManyField(Site) + objects = m.Manager() + on_site = CurrentSiteManager() + + def publish(self): + pass + + def __unicode__(self): + return u'Entry %s: %s'%(self.id,self.title) + + @m.permalink + def get_absolute_url(self): + return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) + + class Meta: + ordering = ["-pub_date"] + + + +# see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ +class EntryModerator(CommentModerator): + email_notification = True + enable_field = 'enable_comments' + auto_moderate_field = 'pub_date' + moderate_after = 31 + +moderator.register(Entry, EntryModerator) + + + + diff --git a/blog/tests.py b/blog/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/blog/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/blog/views.py b/blog/views.py new file mode 100644 index 0000000..cc6028c --- /dev/null +++ b/blog/views.py @@ -0,0 +1,103 @@ +from django.http import Http404 +from django.views.generic import list_detail +from MyDjangoSites.blog.models import Tag,Entry +from django.contrib.sites.models import Site +from django.contrib.syndication.views import Feed +from django.core.paginator import Paginator, InvalidPage, EmptyPage +from django.shortcuts import render_to_response,get_object_or_404 +from simple_search import EntrySearchForm +from django.template import RequestContext + + +def index(request,page=1): + current_site = Site.objects.get_current() + paginator = Paginator(Entry.objects.filter(site=current_site), 15) + try: + entries = paginator.page(page) + except (EmptyPage, InvalidPage): + entries = paginator.page(paginator.num_pages) + return render_to_response('index.html', {"entries": entries}) + +def tags(request): + current_site = Site.objects.get_current() + return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') + +def entry_by_id(request, id): + try: + entry = Entry.objects.get(pk=id) + except Entry.DoesNotExist: + raise Http404 + + return list_detail.object_detail( + request, + queryset = Entry.objects.all(), + template_name = "entry.html", + object_id=id + ) + +def entry_by_permalink(request, yr,mon,day,slug): + try: + entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) + except Entry.DoesNotExist: + raise Http404 + + return list_detail.object_detail( + request, + queryset = Entry.objects.all(), + template_name = "entry.html", + object_id=entry.id + ) + +def tag_view(request, slug): + try: + tag = Tag.objects.get(slug=slug) + except Entry.DoesNotExist: + raise Http404 + + cursite=Site.objects.get_current() + entries=tag.entries.filter(site=cursite) + + return list_detail.object_list( + request, + queryset = entries, + template_name = "tag.html", + ) + + + +class LatestEntriesFeed(Feed): + title = Site.objects.get_current().name + link = "http://%s"%Site.objects.get_current().domain + description = "" + + def items(self): + return Entry.objects.all()[:15] + + def item_title(self, item): + return item.title + + def item_description(self, item): + return item.body + + +def search(request): +# from http://gregbrown.co.nz/code/django-simple-search/ + if request.GET: + form = EntrySearchForm(request.GET) + if form.is_valid(): + print 'bla' + results = form.get_result_queryset() + else: + results = [] + else: + form = EntrySearchForm() + results = [] + + + return render_to_response( + 'search.html', + RequestContext(request, { + 'form': form, + 'results': results, + }) + ) diff --git a/django.wsgi b/django.wsgi new file mode 100644 index 0000000..bf6ca32 --- /dev/null +++ b/django.wsgi @@ -0,0 +1,11 @@ +import os +import sys +sys.path.append('/home/tom/py/') +sys.path.append('/home/tom/sites/') +sys.path.append('/home/tom/sites/MyDjangoSites') + +os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' + + +import django.core.handlers.wsgi +application = django.core.handlers.wsgi.WSGIHandler() diff --git a/import_wp.py b/import_wp.py new file mode 100755 index 0000000..b3cfb4e --- /dev/null +++ b/import_wp.py @@ -0,0 +1,110 @@ +#!/usr/bin/python + +import MySQLdb +import sys,os +import string as s +os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' +from datetime import datetime + +from django.contrib.sites.models import Site +from django.contrib.auth.models import User +from django.contrib.comments.models import Comment +from django.db.utils import IntegrityError +from MyDjangoSites.blog.models import Entry, Tag + +unic= lambda x: x #u'%s'%x.decode('latin1') + +from random import choice +def RandStr(length=3, chars=s.letters + s.digits): + return ''.join([choice(chars) for i in xrange(length)]) + +pwds=open('pwds').readlines() +pwds=map(s.strip,pwds) + +blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, + {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, + {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, + ] + + +def do_tags(cursor): + cursor.execute('select name,slug from wp_terms;') + for name,slug in cursor.fetchall(): + print name, slug + t=Tag(slug=slug) + t.name=name + t.save() + t.site.add(SITE) + t.save() + + +def do_comments(cursor,ID,entry): + cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) + comments=cursor.fetchall() + for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: + comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author),user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) + comm.save(force_insert=True) + + +def do_entries(cursor): + cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post" or post_type="page");') + posts=cursor.fetchall() + + for ID,post_date,post_title,post_content,post_name in posts: + entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, + body=unic(post_content),author=AUTHOR,slug=post_name) + entry.save(force_insert=True) + entry.site.add(SITE) + + try: entry.save() + except IntegrityError,e: + print e + if 'column slug is not unique' in e: + entry.slug=entry.slug+RandStr() + entry.save() + + + + cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) + tags=cursor.fetchall() + for tag_name,tag_slug in tags: + tag=Tag.objects.get(slug=tag_slug) + entry.tags.add(tag) + + entry.save() + do_comments(cursor,ID,entry) + + + +for blog in blogs: + conn = MySQLdb.connect (host = "localhost", + user = blog['dbuser'], + passwd = blog['pwd'], + db = blog['dbname']) + + cursor = conn.cursor () + + + LANG='g' + SITE=Site.objects.get(name=blog['sitename']) + AUTHOR=User.objects.get(pk=1) + + + do_tags(cursor) + do_entries(cursor) + + +####### special operations + +# get entries tagged Europa into the EU-site +# and the other tags too. +et=Tag.objects.get(slug='europa') +eus=Site.objects.get(name='EU') +ee=Entry.objects.filter(tags=et) +for e in ee: + e.site.add(eus) + e.save() + for t in e.tags.all(): + if t.slug != 'europa': + t.site.add(eus) + diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..37cef68 --- /dev/null +++ b/manage.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +import sys +sys.path.append('/home/tom/py/') +sys.path.append('/home/tom/sites/') +sys.path.append('/home/tom/sites/MyDjangoSites') + +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + execute_manager(settings) diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..f2c05c0 --- /dev/null +++ b/settings.py @@ -0,0 +1,103 @@ +# Django settings for MyDjangoSites project. + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + ('Thomas Marquart', '[email protected]'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + }, +} + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'Europe/Stockholm' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'de-de' + +#SITE_ID = 1 +from multisite.threadlocals import SiteIDHook +SITE_ID = SiteIDHook() + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = False + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale +USE_L10N = True + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = 'http://all.tmy.se/media/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/admin-media/' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + 'multisite.template_loader.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.Loader', +) +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'multisite.middleware.DynamicSiteMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +) + +ROOT_URLCONF = 'MyDjangoSites.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + '/home/tom/sites/MyDjangoSites/templates' +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.admin', + 'django.contrib.markup', + 'django.contrib.flatpages', + 'django.contrib.comments', + + 'MyDjangoSites.blog', +) diff --git a/simple_search.py b/simple_search.py new file mode 100644 index 0000000..6d37ee5 --- /dev/null +++ b/simple_search.py @@ -0,0 +1,91 @@ +import re +from django.db.models import Q +from django import forms + +from django.utils.text import smart_split +from django.conf import settings +from django.core.exceptions import FieldError + +from MyDjangoSites.blog.models import Entry + +class BaseSearchForm(forms.Form): + q = forms.CharField(label='Search', required=False) + def clean_q(self): + return self.cleaned_data['q'].strip() + + order_by = forms.CharField( + widget=forms.HiddenInput(), + required=False, + ) + + + class Meta: + abstract = True + base_qs = None + search_fields = None + fulltext_fields = None + + def get_text_search_query(self, query_string): + filters = [] + + def construct_search(field_name): + if field_name.startswith('^'): + return "%s__istartswith" % field_name[1:] + elif field_name.startswith('='): + return "%s__iexact" % field_name[1:] + elif field_name.startswith('@'): + if settings.DATABASE_ENGINE == 'mysql': + return "%s__search" % field_name[1:] + else: + return "%s__icontains" % field_name[1:] + else: + return "%s__icontains" % field_name + + for bit in smart_split(query_string): + or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] + filters.append(reduce(Q.__or__, or_queries)) + + + return reduce(Q.__and__, filters) + + + def construct_filter_args(self, cleaned_data=None): + args = [] + + if not cleaned_data: + cleaned_data = self.cleaned_data + + # construct text search + if cleaned_data['q']: + args.append(self.get_text_search_query(cleaned_data.pop('q'))) + + # if its an instance of Q, append to filter args + # otherwise assume an exact match lookup + for field in cleaned_data: + if isinstance(cleaned_data[field], Q): + args.append(cleaned_data[field]) + elif field == 'order_by': + pass # special case - ordering handled in get_result_queryset + elif cleaned_data[field]: + args.append(Q(**{field: cleaned_data[field]})) + + return args + + + def get_result_queryset(self): + qs = self.Meta.base_qs.filter(*self.construct_filter_args()) + for field_name in self.Meta.search_fields: + if '__' in field_name: + qs = qs.distinct() + break + + if self.cleaned_data['order_by']: + qs = qs.order_by(self.cleaned_data['order_by']) + + return qs + + +class EntrySearchForm(BaseSearchForm): + class Meta: + base_qs = Entry.objects + search_fields = ['title','body',] diff --git a/static/admin-media b/static/admin-media new file mode 120000 index 0000000..40fba7a --- /dev/null +++ b/static/admin-media @@ -0,0 +1 @@ +../../../py/django/contrib/admin/media/ \ No newline at end of file diff --git a/static/css/classic.css b/static/css/classic.css new file mode 100644 index 0000000..ffcda1b --- /dev/null +++ b/static/css/classic.css @@ -0,0 +1,54 @@ +/* +classic.css +'Classic' style for the Tarski theme - http://tarskitheme.com/ +Designed by Benedict Eastaugh, http://extralogical.net/ +*/ + + +/* Navigation +----------------------------------------------- */ +body.classic #wrapper .nav-current:link, body.classic #wrapper .nav-current:visited, body.classic #wrapper .nav-current:active { color: #bf6030; } +body.classic #wrapper .nav-current:hover { color: #e59900; } + +/* Content +----------------------------------------------- */ +body.classic abbr, body.classic acronym { border-bottom: 1px solid #bf8060; } + + /* Headers + --------------------------------------- */ + body.classic h3 { color: #bf6030; } + + /* Post content + --------------------------------------- */ + body.classic .articlenav { background: #fcfeff; } + + /* Inserts + --------------------------------------- */ + body.classic .insert { background: #fcfeff; margin: 0 0 1em 0; border: 1px solid #cfdde5; padding: 9px; } + body.classic .insert h3 { border-bottom: 1px solid #cfdde5; } + + /* Downloads + --------------------------------------- */ + body.classic .content a.download:link, body.classic .content a.download:visited, body.classic .content a.download:active { background-color: #fcfeff; border: 1px solid #cfdde5; } + + /* Images + --------------------------------------- */ + body.classic a img { border: 1px solid #0f6b99; } + body.classic a:hover img, body.classic .comment a:hover .avatar { border: 1px solid #e59900; } + +/* Links +----------------------------------------------- */ +body.classic a:link, body.classic a:active, body.classic a:visited { color: #0f6b99; } +body.classic a:hover { color: #e59900; } + +body.classic .content a:link, body.classic .content a:active, body.classic .content a:visited, body.classic .link-pages a:link, body.classic .link-pages a:active, body.classic .link-pages a:visited, body.classic .tagdata a:link, body.classic .tagdata a:active, body.classic .tagdata a:visited, body.classic .widget_tag_cloud a:link, body.classic .widget_tag_cloud a:active, body.classic .widget_tag_cloud a:visited { border-bottom: 1px solid #cfdde5; } +body.classic .content a:hover, body.classic .link-pages a:hover, body.classic .tagdata a:hover, body.classic .widget_tag_cloud a:hover { border-bottom: 1px solid #e59900; } + +/* Widgets +----------------------------------------------- */ + + /* Calendar widget + ------------------------------------------- */ + body.classic .widget_calendar tbody td a { color: #fff; background: #8bb6cc; } + body.classic .widget_calendar tbody td a:hover { color: #fff; background: #cca352; } + \ No newline at end of file diff --git a/static/css/print.css b/static/css/print.css new file mode 100644 index 0000000..35440fd --- /dev/null +++ b/static/css/print.css @@ -0,0 +1,38 @@ +/* +Tarski print stylesheet +*/ + +#header-image, #navigation, #sidebar, #footer { display: none; } + +body { border: none; padding: 0; text-align: left; font-size: 10pt; line-height: normal; font-family: Verdana, sans-serif; color: #000; background: #fff; } + body.rtl { text-align: right; direction: rtl; } + +#blog-title { font-size: 18pt; font-weight: bold; margin: 1em 0 0.5em 0; } + #blog-title a:link, #blog-title a:visited, #blog-title a:hover, #blog-title a:active { color: #000; text-decoration: none; } + + + h1, h2, h4 { font-family: "Times New Roman", Times, serif; } + h1 { font-size: 24pt; font-weight: normal; margin: 1em 0; } + h2 { font-size: 18pt; font-weight: normal; margin: 0.5em 0; } + h3 { font-size: 10pt; font-weight: normal; text-transform: uppercase; margin: 0 0 1em 0; border-bottom: 1px dotted #000; padding: 0 0 0.2em 0; } + h4 { font-size: 12px; font-weight: normal; margin: 0 0 0.5em 0; } + + body .entry { margin: 0 0 2em 0; } + body .entry .meta { margin: 0 0 1em 0; } + body .entry .meta .title { margin: 0 0 0.1em 0; } + body .entry .meta .metadata { margin: 0; font-size: 9pt; } + + ul, ol { margin: 0 0 1em 0; } + ul { list-style: circle; } + + p { margin: 0 0 1em 0; } + blockquote { margin: 0 2em 1em 2em; } + strong { font-weight: bold; } + em { font-style: italic; } + cite { font-style: italic; } + code { font-family: Courier, "Courier New", monospace; } + +a img { border: none; } + +a:link, a:visited, a:hover, a:active { color: #000; text-decoration: underline; } + body .content a[href]:after { font-size: 9pt; content: " (" attr(href) ") "; } \ No newline at end of file diff --git a/static/css/screen.css b/static/css/screen.css new file mode 100644 index 0000000..d658777 --- /dev/null +++ b/static/css/screen.css @@ -0,0 +1,27 @@ +/* +Tarski screen stylesheet +*/ + +/* Main structure +----------------------------------------------- */ +body { min-width: 760px; } +#wrapper { width: 760px; } + +/* Positioning +----------------------------------------------- */ +body .primary { width: 500px; float: right; } + body.janus .primary { float: left; } +body .primary-span { padding-left: 220px; clear: both; } + body.janus .primary-span { padding-left: 0; padding-right: 220px; } + +body .secondary { width: 200px; float: left; } + body.janus .secondary { float: right; } +body .secondary-span { padding-left: 520px; clear: both; } + body.janus .secondary-span { padding-left: 0; padding-right: 520px; } + +body { text-align: left; } +body.rtl { text-align: right; } +body.centre { text-align: center; } +body #wrapper { margin: 0 auto 0 0; } +body.rtl #wrapper { margin: 0 0 0 auto; } +body.centre #wrapper { margin: 0 auto; } diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..f6444e7 --- /dev/null +++ b/static/css/style.css @@ -0,0 +1,426 @@ +/* +Theme Name: Tarski +Theme URI: http://tarskitheme.com/ +Description: An elegant, flexible theme developed by <a href="http://extralogical.net/">Ben Eastaugh</a> and <a href="http://ceejayoz.com/">Chris Sternal-Johnson</a>. +Author: Benedict Eastaugh and Chris Sternal-Johnson +Author URI: http://tarskitheme.com/about/ +Tags: white, two-columns, fixed-width, custom-colors, custom-header, theme-options, left-sidebar, right-sidebar, threaded-comments, sticky-post, microformats +Version: 2.5 +. +Released under the <a href="http://www.opensource.org/licenses/gpl-license.php">GPL</a>. +. +*/ + +/*----------------------------------------------- +READ THIS FIRST! + +Please do not edit this file unless you absolutely have to. +To customise your CSS styles, create an alternate stylesheet +as per the instructions at the following URL: + +http://tarskitheme.com/help/styles/ + +Using this method will preserve your changes when +you upgrade to a newer version of Tarski. +----------------------------------------------- */ + +/* Initial cleanup +----------------------------------------------- */ +html, body, form, fieldset { margin: 0; padding: 0; } +form label { cursor: pointer; } +fieldset { border: none; } + +/* Main structure +----------------------------------------------- */ +body { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 76%; line-height: 120%; color: #404040; background: #fff; } +#wrapper { text-align: left; } +body.rtl #wrapper { text-align: right; direction: rtl; } + #header, #content { margin-bottom: 2em; padding-left: 20px; padding-right: 20px; } + #footer, #theme-info, #footer-include { clear: both; } + +/* Fix floats +----------------------------------------------- */ +.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.clearfix { display: inline-block; } +/* Hides from IE-mac \*/ +* html .clearfix { height: 1%; } +.clearfix { display: block; } +/* End hide from IE-mac */ + +/* Header +----------------------------------------------- */ +#header-image { overflow: hidden; margin: 0 0 -20px 0; } + #header-image a { text-decoration: none; border: none; } + #header-image a img { border: none; } +#title { margin: 20px 0 -20px; border-bottom: 1px solid #ccc; } +#navigation { margin: 20px 0 0 0; border-bottom: 1px solid #ccc; } + +/* Navigation +----------------------------------------------- */ +#navigation ul.primary { list-style: none; margin: 0; padding: 0.5em 0; } +body.rtl #navigation ul.primary { direction: ltr; } + #navigation ul.primary li { display: inline; margin: 0 1em 0 0; } + body.rtl #navigation ul.primary li { display: inline; margin: 0 0 0 1em; } +#navigation div.secondary { padding: 0.5em 0; } + #navigation div.secondary p { margin: 0; } + body.janus #navigation .secondary p, body.janus #theme-info .secondary p { text-align: right; } + +#wrapper .nav-current:link, #wrapper .nav-current:visited, #wrapper .nav-current:active { color: #8fbf60; } +#wrapper .nav-current:hover { color: #a8001c; } + + /* Feed icon + ------------------------------------------- */ + body .feed { display: block; float: left; padding: 1px 0 1px 20px; min-height: 15px; font-size: 0.8em; background: url('/images/icons.png') no-repeat 0 1px; } + body.janus .feed, body.rtl .feed { float: right; padding: 1px 20px 1px 0; background-position: 100% 1px; } + +/* Content +----------------------------------------------- */ + + /* HTML element control + --------------------------------------- */ + p { margin: 0 0 1em 0; } + blockquote { margin: 0 0 1em 0; padding: 0 30px; color: #808080; } + strong { font-weight: bold; } + em { font-style: italic; } + acronym, abbr { border-bottom: 1px solid #8fb7bf; } + small { font-size: 0.8em; } + sup, sub { font-size: 75%; } + sup { vertical-align: super; } + sub { vertical-align: sub; } + hr { width: 100%; height: 1px; background: #ccc; color: #ccc; margin: 1em 0; border: none; padding: 0; } + pre, code, tt { font-family: 'Courier', 'Courier New', monospace; font-size: 1em; line-height:1.8; color: #4d4d4d; } + pre { margin: 0 0 1em 0; border: 1px solid #e5e5e5; padding: 0.5em 1em; white-space: pre-wrap; overflow: hidden; background: #fafafa; } + code, tt { background: #efefef; } + pre code, pre tt { background: none; } + html > body code, html > body tt, html > body pre { font-size:12px; } + h3 code { text-transform: none; } + ul, ol { margin: 0 0 1em 15px; padding: 0; } + ul { list-style: disc; } + li { margin: 0 0 0.25em 0; } + body.rtl ul, body.rtl ol { margin: 0 15px 1em 0; padding: 0; } + + /* Global content control + --------------------------------------- */ + body .content p { line-height: 1.4; } + body .content li { line-height: 1.4; } + + /* Headers + --------------------------------------- */ + #blog-title { font-family: 'Times New Roman', Times, serif; font-size: 2.5em; font-weight: normal; margin: 0; border: none; padding: 0; line-height: 120%; } + #tagline { font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; font-style: italic; color: #808080; margin: 0.1em 0 0.3em 0; border: none; padding: 0; line-height: 120%; } + + h1, body .entry .title { font-family: 'Times New Roman', Times, serif; font-size: 2em; font-weight: normal; line-height: 120%; margin: 0; border-bottom: 1px solid #ccc; padding: 0 0 0.1em 0; } + h2 { font-family: 'Times New Roman', Times, serif; font-size: 2em; font-weight: normal; line-height: 120%; margin: 0 0 0.5em 0; } + h3 { font-size: 0.8em; font-weight: normal; color: #8fbf60; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.8em 0; border-bottom: 1px solid #e5e5e5; padding: 0 0 0.4em 0; } + h4 { font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; line-height: 120%; margin: 0 0 0.3em 0; } + h5 { font-size: 1em; font-weight: bold; line-height: 120%; margin: 0 0 0.3em 0; padding: 0; } + h6 { font-size: 0.8em; font-weight: bold; line-height: 120%; margin: 0 0 0.3em 0; padding: 0; } + + /* Post content + --------------------------------------- */ + body .articlenav { margin: 0 0 2em 0; border-bottom: 1px solid #e5e5e5; padding-top: 0.75em; padding-bottom: 0.75em; background: #fcffff; color: #808080; } + body.janus .articlenav { text-align: right; } + body.rtl .articlenav { border-bottom: 1px solid #e5e5e5; } + body .entry { margin: 0 0 2em 0; clear: both; } + body .posts .entry { margin: 0 0 4em 0; } + body .entry .meta { margin: 0 0 1em 0; } + body .entry .metadata { font-size: 0.8em; color: #808080; margin: 0; padding: 0; } + body .entry .meta .metadata { margin: 0; padding: 0.3em 0 0 0; } + body .aside { margin: 0 0 4em 0; } + body .aside .meta { margin: -0.8em 0 0 0; border-top: 1px dotted #d9d9d9; padding: 0.2em 0 0 0; color: #808080; font-size: 0.8em; text-align: right; clear: both; } + body .archive { margin: 0 0 2em 0; } + body .archive .meta { margin: 0 0 1em 0; } + body .link-pages { font-size: 0.8em; color: #808080; clear: both; } + body .pagination { margin: 0; font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; line-height: 120%; color: #808080; clear: both; } + + /* Inserts + --------------------------------------- */ + body .insertright { margin: 0 0 20px 20px; width: 220px; float: right; } + body .insertleft { margin: 0 20px 20px 0; width: 220px; float: left; } + body .insert { background: #fcffff; margin: 0 0 1em 0; border: 1px solid #cfe2e5; padding: 9px; } + body .insert h3 { border-bottom: 1px solid #cfe2e5; } + + /* Downloads + --------------------------------------- */ + body a.download { display: block; margin: 1em 0; padding: 5px 5px 5px 28px; min-height: 15px; } + body .content a.download:link, body .content a.download:visited, body .content a.download:active { background:#fcffff url('/images/icons.png') no-repeat 5px -295px; border: 1px solid #cfe2e5; } + body .content a.download:hover { text-decoration: underline; } + + /* Images + --------------------------------------- */ + a img { border: 1px solid #006a80; } + a:hover img, body .comment a:hover .avatar { border: 1px solid #a8001c; } + #wrapper .gallery a:link, #wrapper .gallery-item a:visited, #wrapper .gallery-item a:hover, #wrapper .gallery-item a:active, #wrapper a.imagelink2 img, #wrapper a.imagelink2:hover img, #wrapper a.imagelink:link, #wrapper a.imagelink:visited, #wrapper a.imagelink:hover, #wrapper a.imagelink:active, #wrapper a.imagelink2:link, #wrapper a.imagelink2:visited, #wrapper a.imagelink2:hover, #wrapper a.imagelink2:active { border: none; } + body .imageleft, body .alignleft { float: left; margin: 0 10px 10px 0; } + body .imageright, body .alignright { float: right; margin: 0 0 10px 10px; } + body .imageblock { display: block; margin: 0 0 1em 0; } + body .imagecentre, body .imagecenter, body .centered, body .aligncenter { display: block; text-align: center; margin: 0 auto 1em auto; } + + body .gallery { margin: 0 auto 1em 0; } + body .gallery-item { float: left; margin-top: 10px; text-align: center; } + body #wrapper .content .gallery-item a, body #wrapper .content .attachment a { border-bottom:none; } + body .gallery-caption { margin-left: 0; } + + /* Tags & Tags page + --------------------------------------- */ + body .tagdata { font-size: 0.8em; color: #808080; clear: both; } + body .tagcloud {} + body .tagcloud a { margin: 0 2px 0 0; } + + /* Search content + --------------------------------------- */ + body .post-brief { margin: 0 0 2em 0; } + body .post-brief h3 { margin: 0 0 0.2em 0; } + body .post-brief p.post-metadata { color: #808080; margin: 0 0 0.2em 0; border: none; padding: 0; } + body .post-brief p.excerpt { margin: 0; } + + /** + * Comments layout & style + * + * Designed to work for comments which are threaded, unthreaded, paginated + * and unpaginated. Trackbacks are now included inline rather than being + * rendered at the top. Comments also sit directly below the post or page + * content, rather than taking the entire width of the site. This increases + * their flexibility (given column swapping etc.) and maintainability + * (since fewer permutations reduce the likelihood of bugs.) + * + * @since 2.4 + */ + #comments { clear: both; margin: 0; padding: 0; } + body .comment, body .trackback, body .pingback { padding: 0; list-style: none; } + body .comment .comment { margin: 0; } + li.comment, li.trackback, li.pingback { margin: 0; border-top: 1px solid #ccc; padding: 0; } + body .comment ol.children, body .trackback ol.children, body .pingback ol.children { clear: both; margin: 0; border-top: 1px solid #ccc; padding: 0 0 0 20px; } + body.rtl .comment ol.children, body.rtl .trackback ol.children, body.rtl .pingback ol.children { padding: 0 20px 0 0 ; } + body p.pingdata { margin: 0; font-size: 0.8em; color: #808080; } + li.comment-lvl-first { border-top: none; } + body .comment .reply { clear: both; } + body .comment .reply a { padding-left: 13px; background: url('/images/icons.png') no-repeat -7px -398px; } + body.rtl .comment .reply a { background: url('/images/icons.png') no-repeat -7px -598px; } + + body .comment-wrapper { padding: 0.66em 0; } + body .moderated { border-bottom: 1px solid #e5e5e5; padding-bottom: 0.66em; background: url('/images/icons.png') no-repeat 100% -200px; } + body .comment-meta { margin: 0; float: left; font-size: 0.8em; color: #808080; } + body.rtl .comment-meta { float: right;} + body .avatar-link { display: block; float: right; margin: 0 0 10px 10px; } + body.rtl .avatar-link { float: left; margin: 0 10px 10px 0; } + body .avatar, body .comment a .avatar { display: block; float: right; margin: 0 0 10px 10px; border: 1px solid #ccc; padding: 4px; background:#fcfcfc; } + body.rtl .avatar, body.rtl .comment a .avatar { float: left; margin: 0 10px 10px 0;} + body .comment .avatar-link .avatar { float: none; margin: 0; } + body .comment-permalink, body .comment-edit {} + body .comment-author { font-weight: bold; color: #404040; } + body .comment-content { clear: left; padding-top: 0.8em; } + body.rtl .comment-content { clear: right; } + body .reply { margin: 0; font-size: 0.8em; } + body .author-comment {} + body .trackback { margin: 0; border-top: 1px solid #ccc; padding: 0.5em 0; background: #fcffff; } + body .trackback p { font-size: 0.8em; margin: 0; } + + #comments-header .title { width: 49.5%; float: left; margin: 0 0 0.1em 0; border: none; } + .rtl #comments-header .title { float: right; } + #comments-header .comments-feed { width: 49.5%; float: right; text-align: right; margin: 0; padding: 0.75em 0 0 0; } + #comments-header .comments-feed a { display: block; float:right; min-height:16px; padding: 1px 20px 1px 0; background: url('/images/icons.png') no-repeat 100% -100px; font-size: 0.8em; } + .rtl #comments-header .comments-feed a { float:left; padding: 1px 20px 1px 0; } + #comments-header .trackback-link { clear: both; margin: 0.4em 0 0 0; border-top: 1px solid #ccc; padding: 0.5em 0; font-size: 0.8em; font-weight: bold; color: #808080; } + #comments-header .trackback-link a { font-weight: normal; } + #comment-paging { padding: 0.5em 0; } + #comment-paging { margin: 0; border-top: 1px solid #ccc; font-family: 'Times New Roman', Times, serif; font-size: 1.5em; color: #808080; } + #comment-paging span.page-numbers { color: #404040; } + #comments-closed { margin: 0; border-top: 1px solid #e5e5e5; padding-top: 0.66em; } + + /* Lists + --------------------------------------- */ + body .navlist { list-style: none; margin: 0 0 1em 0; } + body .navlist li { margin: 0.5em 0; } + body .navlist ul { list-style: none; margin: 0 0 0 1em; } + body .navlist ul li { margin: 0.5em 0; } + #wrapper .navlist a:link, #wrapper .navlist a:visited, #wrapper .navlist a:hover, #wrapper .navlist a:active { border-bottom: none; } + body .archivelist { list-style: none; margin: 0.5em 0 1em 0; } + body .archivelist li { margin: 0.5em 0; } + body .archivelist ul { list-style: none; margin: 0 0 0 1.5em; } + body .archivelist ul li { margin: 0.5em 0; } + body .postspermonth { list-style: none; margin: 0.5em 0 1em 0; } + body .postspermonth li { margin: 0.5em 0; } + + /* Sidebar + --------------------------------------- */ + body .bookmarks ul { list-style: none; margin: 0 0 1em 0; } + body .bookmarks ul li { margin: 0.5em 0; } + + /* Footer + --------------------------------------- */ + #footer { margin: 0 20px 0 20px; border-top: 3px double #ccc; padding: 1em 0 0 0; } + .recent-articles {} + .recent-articles ul { list-style: none; margin: 0; } + .recent-articles li { margin: 0; } + h4.recent-title { margin: 0; } + .recent-metadata { font-size: 0.8em; color: #808080; margin: 0 0 0.5em 0; } + .recent-excerpt { line-height: 1.4; margin: 0 0 1em 0; } + #theme-info { margin: 0.5em 0 0 0; border-top: 3px double #ccc; padding: 1em 0 0.5em 0; color: #808080; } + +/* Forms +----------------------------------------------- */ +input, select, textarea { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 100%; } +input.text, input[type=text], input[type=password], textarea { border: 1px solid #ccc; padding: 2px; background: #fafafa; color: #404040; } +input.text:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus { background: #fff; } +input[type=submit]:enabled, button:enabled { border: 1px solid #ccc; padding: 2px 10px; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; background: url('/images/button_gradient.png') repeat-x 0 0; color: #404040; cursor: pointer; } +input[type=submit]:enabled:focus, input[type=submit]:enabled:hover, button:enabled:focus, button:enabled:hover { border-color: #666; } + + /* Search form + --------------------------------------- */ + body .searchbox { width: 200px; margin: 0 0 1em 0; } + #s { display: block; width: 194px; margin: 0 0 0.6em 0; border: 1px solid #ccc; padding: 2px; background: #fafafa; color: #404040; } + #s:focus { background: #fff; } + body.js #searchlabel { display: none; } + + /** + * Comment reply form layout & style. + * + * Consists of a simple header with a title and 'Cancel reply' link, + * followed by three text fields which are floated next to one another. + * Lastly, a textarea and submit button. The amount of specialised code + * is intentionally small, since the form should inherit from the general + * Tarski form styling. + * + * @since 2.4 + */ + #respond { padding-top: 0.66em; border-top: 1px solid #e5e5e5; } + #respond-header { margin-bottom: 0.66em; border-bottom: 1px solid #ccc; padding-bottom: 0.4em; } + #respond-header .title { float: left; margin: 0; } + .rtl #respond-header .title { float: right; } + #respond-header .cancel-reply { float: right; margin: 0; padding-top: 0.75em; font-size: 0.8em; } + .rtl #respond-header .cancel-reply { float: left; } + #respond-header .cancel-reply a { padding-right: 13px; background: url('/images/icons.png') no-repeat 100% -498px; } + body .response-details { margin-bottom: 1em; } + body .response-details .text-wrap { width: 31%; float: left; margin-right: 2%; } + body .response-details > .text-wrap { width: 32%; } + body .response-details .url-wrap { margin-right: 0; } + body .response { margin-bottom: 0.8em; } + body .response-details .text-wrap label, body .response label { display: block; height: 1.5em; color: #808080; } + body .response-details .text-wrap input.text { display: block; width: 98%; } + body .response textarea { display: block; width: 99%; } + body .req-notice { font-size: 0.8em; } + p.submit-wrapper { margin: 0; } + +/* Links +----------------------------------------------- */ +a { text-decoration: none; } +a:link, a:visited, a:active { color: #006a80; } +a:hover { color: #a8001c; } + +body .content a:link, body .content a:active, body .content a:visited, body .link-pages a:link, body .link-pages a:active, body .link-pages a:visited, body .tagdata a:link, body .tagdata a:active, body .tagdata a:visited, body .widget_tag_cloud a:link, body .widget_tag_cloud a:active, body .widget_tag_cloud a:visited { border-bottom: 1px solid #cfe2e5; } +body .content a:hover, body .link-pages a:hover, body .tagdata a:hover, body .widget_tag_cloud a:hover { border-bottom: 1px solid #e5cfd2; } + #wrapper .content h2 a:link, #wrapper .content h2 a:visited, #wrapper .content h2 a:hover, #wrapper .content h2 a:active, #wrapper .content h3 a:link, #wrapper .content h3 a:visited, #wrapper .content h3 a:hover, #wrapper .content h3 a:active, #wrapper .content h4 a:link, #wrapper .content h4 a:visited, #wrapper .content h4 a:hover, #wrapper .content h4 a:active { border: none; } + +/* Widgets +----------------------------------------------- */ +body .widget { margin: 0 0 2em 0; } + + /* List widgets + ------------------------------------------- */ + body .widget ul { margin: 0; list-style: none; } + body .widget ul li { margin: 0.5em 0; } + body .widget ul ul, body .widget ol ol, body .widget ol ul, body .widget ul ol { margin-left: 15px; } + body.rtl .widget ul ul, body.rtl .widget ol ol, body.rtl .widget ol ul, body.rtl .widget ul ol { margin-right: 15px; } + + /* Tag cloud widget + ------------------------------------------- */ + body .widget_tag_cloud { line-height: 1.2; } + body .widget_tag_cloud a { margin: 0 2px 0 0; } + + /* Calendar widget + ------------------------------------------- */ + body .widget_calendar {} + body .widget_calendar table { width: 100%; } + body .widget_calendar caption { margin: 0.25em 0 0.2em 0; border-bottom: 1px solid #ccc; padding: 0 0 0.5em 0; font-family: 'Times New Roman', Times, Georgia, serif; font-size:1.5em; text-align: center; } + body .widget_calendar th, body .widget_calendar td { margin: 1px; padding: 5px; text-align: center; } + body .widget_calendar th { background: #fafcfc; font-weight: bold; } + body .widget_calendar td { background: #edf1f2; } + body .widget_calendar tbody td a { display:block; margin: -5px; padding: 5px; color: #fff; background: #8bb6cc; } + body .widget_calendar tbody td a:hover { color: #fff; background: #cc8a95; } + body .widget_calendar td.pad, .widget_calendar tfoot td { background: #fff; } + body .widget_calendar tfoot td { font-family: 'Times New Roman', Times, Georgia, serif; font-size: 1.5em; } + body .widget_calendar #prev { text-align: left; } + body .widget_calendar #next { text-align: right; } + + + +/* OWN STUFF */ +.figure img { border: none;} +.figure a { + text-decoration: none; + margin: 0px; + border: none !important; + font-size: smaller; +} + +.right { float: right; margin-left: 5px; padding: 10px 10px 10px 10px; +border: thin solid silver;} +.left { float: left; margin-right: 10px; padding: 10px 10px 10px 10px; +border: thin solid silver;} + +#header-image { + width: 720px; + height: 210px; + margin-top: 5px; + } + +/* #navigation { border-top: 1px solid #ccc; } */ + +.bigger {font-size: 1.5em;} + +.aside {border-top: 1px solid #ddd; padding-top: 3px} +.aside ul { list-style: none; margin: 0 0 1em 0; } +.aside ul li { margin: 0.5em 0; } + + +table { + margin: 0.5em 0; + border-collapse: collapse; +} + +td { + padding: 0.45em; + border: 1px solid #4c8099; +} + +.sv { + background: url('/images/swehalf.gif') center right no-repeat; + padding-right: 13px; +} +.sv:hover { + background: url('/images/swefull.gif') center right no-repeat; + padding-right: 13px; +} +.de { + background: url('/images/deuhalf.gif') center right no-repeat; + padding-right: 13px; +} +.de:hover { + background: url('/images/deufull.gif') center right no-repeat; + padding-right: 13px; +} +.en { + background: url('/images/enghalf.gif') center right no-repeat; + padding-right: 13px; +} +.en:hover { + background: url('/images/engfull.gif') center right no-repeat; + padding-right: 13px; +} +.im { + background: url('/images/imghalf.gif') center right no-repeat; + padding-right: 13px; +} +.im:hover { + background: url('/images/imgfull.gif') center right no-repeat; + padding-right: 13px; +} + +.noborderimg {border: 0px !important;} + +/* overwrite from above */ +.widgets .textwidget { padding: 0 0 0 0; } +blockquote { margin: 0 0 1em 0; padding: 0 30px; color: #888888; } + + diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/static/js/tarski.js b/static/js/tarski.js new file mode 100644 index 0000000..297ebcf --- /dev/null +++ b/static/js/tarski.js @@ -0,0 +1,110 @@ +Function.prototype.bind = function(object) { + var method = this; + return function() { + return method.apply(object, arguments); + }; +}; + +function addEvent( obj, type, fn ) { + if (obj.addEventListener) { + obj.addEventListener( type, fn, false ); + EventCache.add(obj, type, fn); + } + else if (obj.attachEvent) { + obj["e"+type+fn] = fn; + obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } + obj.attachEvent( "on"+type, obj[type+fn] ); + EventCache.add(obj, type, fn); + } + else { + obj["on"+type] = obj["e"+type+fn]; + } +}; + +var EventCache = function(){ + var listEvents = []; + return { + listEvents : listEvents, + add : function(node, sEventName, fHandler){ + listEvents.push(arguments); + }, + flush : function(){ + var i, item; + for(i = listEvents.length - 1; i >= 0; i = i - 1){ + item = listEvents[i]; + if(item[0].removeEventListener){ + item[0].removeEventListener(item[1], item[2], item[3]); + }; + if(item[1].substring(0, 2) != "on"){ + item[1] = "on" + item[1]; + }; + if(item[0].detachEvent){ + item[0].detachEvent(item[1], item[2]); + }; + item[0][item[1]] = null; + }; + } + }; +}(); +addEvent(window,'unload',EventCache.flush); + +/** + * <p>Replaces element el1's empty 'value' attribute with element el2's content.</p> + * @param {Object} replaceable + * @param {Object} replacing + */ +function replaceEmpty(replaceable, replacing) { + if (/^\s*$/.test(replaceable.value)) { + replaceable.value = replacing.firstChild.nodeValue; + } +}; + +/** + * <p>Search box object, allowing us to add some default text to the search + * field which will then be removed when that field is given focus. It remains + * accessible because the default text is pulled from the search field's label + * and that label is only hidden when JavaScript is enabled.</p> + */ +var Searchbox = { + + /** + * <p>If the search box and associated label exist, hide the label and + * add the label's content to the search box. Then add two events to the + * search box, one which will reset the box's content when it's given focus + * and one which will add the label content back when it loses focus (as + * long as the box is empty).</p> + */ + init : function() { + this.sBox = document.getElementById('s'); + this.sLabel = document.getElementById('searchlabel'); + if (this.sBox && this.sLabel) { + this.sLabel.style.display = 'none'; + replaceEmpty(this.sBox, this.sLabel); + addEvent(this.sBox, 'focus', this.reset_text.bind(this)); + addEvent(this.sBox, 'blur', this.add_text.bind(this)); + } + }, + + /** + * <p>Removes the search box's default content.</p> + */ + reset_text : function() { + if (this.sBox.value == this.sLabel.firstChild.nodeValue) { + this.sBox.value = ''; + } + }, + + /** + * <p>Adds the search box's default content back in if it's empty.</p> + */ + add_text : function() { + replaceEmpty(this.sBox, this.sLabel); + } +}; + +addEvent(window, 'load', function() { + var body = document.getElementsByTagName('body')[0]; + body.className += " js"; +}); + +addEvent(window, 'load', Searchbox.init.bind(Searchbox)); \ No newline at end of file diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..e69de29 diff --git a/templates/atheist.tmy.se/entry.html b/templates/atheist.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/atheist.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/index.html b/templates/atheist.tmy.se/index.html new file mode 100644 index 0000000..8124076 --- /dev/null +++ b/templates/atheist.tmy.se/index.html @@ -0,0 +1,30 @@ +{% extends "tarski.html" %} +{% block title %}Atheist und Gut{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Atheist und Gut</h1> + <p id="tagline">ein Blog über die Welt aus der Sicht eines Gottlosen</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/atheist.tmy.se/search.html b/templates/atheist.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/atheist.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/tag.html b/templates/atheist.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/atheist.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/tags.html b/templates/atheist.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/atheist.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/base/entry.html b/templates/base/entry.html new file mode 100644 index 0000000..bdf01e1 --- /dev/null +++ b/templates/base/entry.html @@ -0,0 +1,60 @@ +{% extends "index.html" %} +{% load markup %} +{% load comments %} + + +{% block content %} + + + <div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"><a href="{{ object.get_absolute_url }}" rel="bookmark" title="Permalink dieses Artikels">{{ object.title }}</a></h2> + <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">Keine Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile }} + + </div> + <p class="tagdata"><strong>Schlagworte:</strong> {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}" rel="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %} {% endfor %}</p> + </div> + <div id="comments-header"> + <div class="clearfix"> + {% get_comment_count for object as comment_count %} + <h2 class="title">{{ comment_count }} Kommentare</h2> + <p class="comments-feed"><a href="{{ object.get_absolute_url }}feed/">RSS-Feed f&uuml;r Kommentare zu diesem Artikel</a></p> + </div> + </div> + + + <ol id="comments" class="clearfix"> + {% get_comment_list for object as comment_list %} + {% for comment in comment_list %} + <li class="comment even thread-even depth-1" id="comment-{{ comment.id }}"> + <div class="comment-wrapper clearfix" id="comment-wrapper-{{ comment.id }}"> + <p class="comment-meta commentmetadata"> + <span class="comment-author vcard"> + <a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a></span> am <span class="comment-permalink"> + <a title="Permalink zu diesem Kommentar" href="{{ object.get_absolute_url }}#comment-65045">2010-05-04 um 17:31</a></span> </p> + + <div class="comment-content content"> + {{ comment.comment|textile }} + </div> + + </div> + </li> + {% endfor %} + </ol> + + + <div id="respond"> <div id="respond-header" class="clearfix"> + <h2 class="title">Kommentieren</h2> </div> + {% render_comment_form for object %} + </div> + + </div> + + + +{% endblock %} diff --git a/templates/base/index.html b/templates/base/index.html new file mode 100644 index 0000000..c784d47 --- /dev/null +++ b/templates/base/index.html @@ -0,0 +1,28 @@ +{% extends "tarski.html" %} +{% block title %}Base title{% endblock %} + +{% block header %} + +Base header + +{% endblock %} + +{% block content %} +<ul> +{% for entry in object_list %} +<li>{{ entry.title }}</li> +{% endfor %} +</ul> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} + +{% block themeinfo %} +{% endblock %} diff --git a/templates/base/search.html b/templates/base/search.html new file mode 100644 index 0000000..2331312 --- /dev/null +++ b/templates/base/search.html @@ -0,0 +1,14 @@ +{% extends "index.html" %} +{% block content %} +<form action="." method="post"> +{% csrf_token %} +{{ form.as_p }} +<input type="submit" value="Suchen" /> + + +<ul> +{% for entry in results %} +<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> +{% endfor %} +</ul> +{% endblock %} diff --git a/templates/base/tag.html b/templates/base/tag.html new file mode 100644 index 0000000..d5b053e --- /dev/null +++ b/templates/base/tag.html @@ -0,0 +1,11 @@ +{% extends "index.html" %} + +{% block content %} + +<ul> +{% for entry in object_list %} +<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> +{% endfor %} +</ul> + +{% endblock %} diff --git a/templates/base/tags.html b/templates/base/tags.html new file mode 100644 index 0000000..e409c4e --- /dev/null +++ b/templates/base/tags.html @@ -0,0 +1,11 @@ +{% extends "index.html" %} + +{% block content %} + +<ul> +{% for tag in object_list %} +<li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li> +{% endfor %} +</ul> + +{% endblock %} diff --git a/templates/blogblog.tmy.se/entry.html b/templates/blogblog.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/blogblog.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/index.html b/templates/blogblog.tmy.se/index.html new file mode 100644 index 0000000..2831cc8 --- /dev/null +++ b/templates/blogblog.tmy.se/index.html @@ -0,0 +1,30 @@ +{% extends "tarski.html" %} +{% block title %}Das BlogBlog{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Das BlogBlog</h1> + <p id="tagline">ein reines Metablog</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/blogblog.tmy.se/search.html b/templates/blogblog.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/blogblog.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/tag.html b/templates/blogblog.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/blogblog.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/tags.html b/templates/blogblog.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/blogblog.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/comments/comment_notification_email.txt b/templates/comments/comment_notification_email.txt new file mode 100644 index 0000000..63f1493 --- /dev/null +++ b/templates/comments/comment_notification_email.txt @@ -0,0 +1,3 @@ +A comment has been posted on {{ content_object }}. +The comment reads as follows: +{{ comment }} diff --git a/templates/fiket.tmy.se/entry.html b/templates/fiket.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/fiket.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/index.html b/templates/fiket.tmy.se/index.html new file mode 100644 index 0000000..132eee4 --- /dev/null +++ b/templates/fiket.tmy.se/index.html @@ -0,0 +1,31 @@ +{% extends "tarski.html" %} +{% block title %}Fiket{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/fiket.tmy.se/search.html b/templates/fiket.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/fiket.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/tag.html b/templates/fiket.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/fiket.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/tags.html b/templates/fiket.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/fiket.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/tarski.html b/templates/tarski.html new file mode 100644 index 0000000..3108e77 --- /dev/null +++ b/templates/tarski.html @@ -0,0 +1,119 @@ +{% load markup %} +{% load comments %} +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> + +<head><title>{% block title %}Title{% endblock %}</title> + + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta name="generator" content="My custom Django application." /> + + <meta name="description" content="Writings about various topics by Thomas Marquart" /> + <meta name="robots" content="all" /> + +<link rel="stylesheet" href="/style.css" type="text/css" media="all" /> +<link rel="stylesheet" href="/screen.css" type="text/css" media="screen,projection" /> +<link rel="stylesheet" href="/print.css" type="text/css" media="print" /> +<link rel="stylesheet" href="/classic.css" type="text/css" media="all" /> + +<script type="text/javascript" src="tarski.js"></script> +<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> +<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> + +</head> + +<body id="home" class="centre classic"><div id="wrapper"> +<div id="header"> +{% block header %} + + <div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> +<ul class="primary xoxo"> +<li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> +<li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> +<li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> +<li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> +<li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> +</ul> + +<div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> +</div></div> +{% endblock %} +</div> +<div id="content" class="clearfix"> +<div class="primary posts"> + + +{% block content %} +{% for object in entries.object_list%} +<div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"> + <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> + </h2> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile }} + + </div> + </div> +{% endfor %} + +<p class="pagination"> +{% if entries.has_next %} +<a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> +{% endif %} +&nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; +{% if entries.has_previous %} +<a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> +{% endif %} +</p> + +{% endblock %} + +</div> + +<div id="sidebar" class="secondary"> +{% block sidebar %} + +{% endblock %} + +</div> + +</div> <!-- /main content --> + + +<div id="footer" class="clearfix"> + + <div class="secondary"> + {% block footsidebar %} + + {% endblock %} + + </div> <!-- /secondary --> + + <div class="primary"> + {% block footcontent %} + + {% endblock %} + + + </div> <!-- /primary --> + + <div id="theme-info" class="clearfix"> + {% block themeinfo %} + + {% endblock %} + + </div> <!-- /theme-info --> + +</div> <!-- /footer --> + +</div> +</body></html> diff --git a/templates/www.betreff.eu/entry.html b/templates/www.betreff.eu/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/www.betreff.eu/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/www.betreff.eu/index.html b/templates/www.betreff.eu/index.html new file mode 100644 index 0000000..991dcfb --- /dev/null +++ b/templates/www.betreff.eu/index.html @@ -0,0 +1,31 @@ +{% extends "tarski.html" %} +{% block title %}Betreff: EU{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Betreff: EU</h1> + <p id="tagline">Texte zur Europäischen Union</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/www.betreff.eu/search.html b/templates/www.betreff.eu/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/www.betreff.eu/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/www.betreff.eu/tag.html b/templates/www.betreff.eu/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/www.betreff.eu/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/www.betreff.eu/tags.html b/templates/www.betreff.eu/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/www.betreff.eu/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/urls.py b/urls.py new file mode 100644 index 0000000..9804380 --- /dev/null +++ b/urls.py @@ -0,0 +1,38 @@ +from django.conf.urls.defaults import * +from django.contrib.comments.feeds import LatestCommentFeed +from django.views.generic import list_detail +from MyDjangoSites.blog.models import Tag,Entry +from MyDjangoSites.blog.views import LatestEntriesFeed + + +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns('', + (r'^admin/doc/', include('django.contrib.admindocs.urls')), + (r'^admin/', include(admin.site.urls)), + (r'^comments/', include('django.contrib.comments.urls')), +) + + +feeds = { + 'comments': LatestCommentFeed, + 'posts':LatestEntriesFeed, +} + +urlpatterns += patterns('', + (r'^comments/feed/', LatestCommentFeed()), + (r'^feed/',LatestEntriesFeed()), + (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), +) + +urlpatterns += patterns('MyDjangoSites.blog.views', + (r'^$', 'index'), + (r'^page/(?P<page>\d+)/$', 'index'), + url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), + (r'^tags/$', 'tags'), + url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), + (r'^post/(?P<id>\d+)/$','entry_by_id'), + (r'^search/$','search'), + + )
ivh/TmyCMS
9c5ac14f3218078f7674ce046b6cc9cbc16ac154
eu-template
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6596c23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyc +*~ +*.db +/pwds diff --git a/README b/README new file mode 100644 index 0000000..bc6f047 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +This is for serving several of my sites +which currently run with Wordpress or Drupal. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apache.conf b/apache.conf new file mode 100644 index 0000000..5cad43a --- /dev/null +++ b/apache.conf @@ -0,0 +1,29 @@ +<VirtualHost *:80> +ServerName all.tmy.se +ServerAlias blogblog.tmy.se +ServerAlias fiket.tmy.se +ServerAlias atheist.tmy.se +ServerAlias eu.tmy.se + +CustomLog /var/log/apache2/django.access.log combined env=!dontlog + +Alias /robots.txt /home/tom/sites/MyDjangoSites/static/robots.txt +Alias /favicon.ico /home/tom/sites/MyDjangoSites/static/favicon.ico + +Alias /admin-media/ /home/tom/sites/MyDjangoSites/static/admin-media/ +Alias /images/ /home/tom/sites/MyDjangoSites/static/images/ + +AliasMatch /([^/]*\.css) /home/tom/sites/MyDjangoSites/static/css/$1 +AliasMatch /([^/]*\.js) /home/tom/sites/MyDjangoSites/static/js/$1 + + +<Directory /home/tom/sites/MyDjangoSites/static> +Options FollowSymLinks +Order deny,allow +Allow from all +</Directory> + +WSGIScriptAlias / /home/tom/sites/MyDjangoSites/django.wsgi + +</VirtualHost> + diff --git a/blog/__init__.py b/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/blog/admin.py b/blog/admin.py new file mode 100644 index 0000000..b41fa15 --- /dev/null +++ b/blog/admin.py @@ -0,0 +1,17 @@ +from MyDjangoSites.blog.models import Tag,Entry +from django.contrib import admin + +class EntryAdmin(admin.ModelAdmin): + list_display = ('title', 'pub_date') + search_fields = ['title','body','slug'] + date_hierarchy = 'pub_date' + list_filter = ['pub_date'] + +class TagAdmin(admin.ModelAdmin): + list_display = ('name', 'slug') + search_fields = ['name'] + + + +admin.site.register(Entry,EntryAdmin) +admin.site.register(Tag,TagAdmin) diff --git a/blog/models.py b/blog/models.py new file mode 100644 index 0000000..1030d6c --- /dev/null +++ b/blog/models.py @@ -0,0 +1,65 @@ +from django.utils.translation import ugettext_lazy as _ +from django.db import models as m +from django.contrib.sites.models import Site +from django.contrib.sites.managers import CurrentSiteManager +from django.contrib.auth.models import User +from django.contrib.comments.moderation import CommentModerator, moderator + +LANGUAGES=( +('g',_('German')), +('s',_('Swedish')), +('e',_('English')), +) + +class Tag(m.Model): + slug=m.SlugField(primary_key=True,unique=True) + name=m.CharField(max_length=128) + site=m.ManyToManyField(Site) + def __unicode__(self): + return u'Tag: %s'%self.name + + @m.permalink + def get_absolute_url(self): + return ('tag', [self.slug]) + +class Entry(m.Model): + pub_date=m.DateTimeField(null=True,blank=True) + mod_date=m.DateTimeField(auto_now=True) + author=m.ForeignKey(User,related_name='entries') + lang=m.CharField(max_length=1,choices=LANGUAGES) + title=m.CharField(max_length=512) + slug=m.SlugField() + body=m.CharField(max_length=512) + enable_comments = m.BooleanField(default=True) + tags=m.ManyToManyField(Tag,related_name='entries',null=True,blank=True) + site = m.ManyToManyField(Site) + objects = m.Manager() + on_site = CurrentSiteManager() + + def publish(self): + pass + + def __unicode__(self): + return u'Entry %s: %s'%(self.id,self.title) + + @m.permalink + def get_absolute_url(self): + return ('permalink', [str(self.pub_date.year),str(self.pub_date.month).zfill(2),str(self.pub_date.day).zfill(2),self.slug]) + + class Meta: + ordering = ["-pub_date"] + + + +# see http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/ +class EntryModerator(CommentModerator): + email_notification = True + enable_field = 'enable_comments' + auto_moderate_field = 'pub_date' + moderate_after = 31 + +moderator.register(Entry, EntryModerator) + + + + diff --git a/blog/tests.py b/blog/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/blog/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/blog/views.py b/blog/views.py new file mode 100644 index 0000000..cc6028c --- /dev/null +++ b/blog/views.py @@ -0,0 +1,103 @@ +from django.http import Http404 +from django.views.generic import list_detail +from MyDjangoSites.blog.models import Tag,Entry +from django.contrib.sites.models import Site +from django.contrib.syndication.views import Feed +from django.core.paginator import Paginator, InvalidPage, EmptyPage +from django.shortcuts import render_to_response,get_object_or_404 +from simple_search import EntrySearchForm +from django.template import RequestContext + + +def index(request,page=1): + current_site = Site.objects.get_current() + paginator = Paginator(Entry.objects.filter(site=current_site), 15) + try: + entries = paginator.page(page) + except (EmptyPage, InvalidPage): + entries = paginator.page(paginator.num_pages) + return render_to_response('index.html', {"entries": entries}) + +def tags(request): + current_site = Site.objects.get_current() + return list_detail.object_list(request,queryset=Tag.objects.filter(site=current_site), template_name='tags.html') + +def entry_by_id(request, id): + try: + entry = Entry.objects.get(pk=id) + except Entry.DoesNotExist: + raise Http404 + + return list_detail.object_detail( + request, + queryset = Entry.objects.all(), + template_name = "entry.html", + object_id=id + ) + +def entry_by_permalink(request, yr,mon,day,slug): + try: + entry = Entry.objects.get(pub_date__year=yr, pub_date__month=mon,pub_date__day=day,slug=slug) + except Entry.DoesNotExist: + raise Http404 + + return list_detail.object_detail( + request, + queryset = Entry.objects.all(), + template_name = "entry.html", + object_id=entry.id + ) + +def tag_view(request, slug): + try: + tag = Tag.objects.get(slug=slug) + except Entry.DoesNotExist: + raise Http404 + + cursite=Site.objects.get_current() + entries=tag.entries.filter(site=cursite) + + return list_detail.object_list( + request, + queryset = entries, + template_name = "tag.html", + ) + + + +class LatestEntriesFeed(Feed): + title = Site.objects.get_current().name + link = "http://%s"%Site.objects.get_current().domain + description = "" + + def items(self): + return Entry.objects.all()[:15] + + def item_title(self, item): + return item.title + + def item_description(self, item): + return item.body + + +def search(request): +# from http://gregbrown.co.nz/code/django-simple-search/ + if request.GET: + form = EntrySearchForm(request.GET) + if form.is_valid(): + print 'bla' + results = form.get_result_queryset() + else: + results = [] + else: + form = EntrySearchForm() + results = [] + + + return render_to_response( + 'search.html', + RequestContext(request, { + 'form': form, + 'results': results, + }) + ) diff --git a/django.wsgi b/django.wsgi new file mode 100644 index 0000000..bf6ca32 --- /dev/null +++ b/django.wsgi @@ -0,0 +1,11 @@ +import os +import sys +sys.path.append('/home/tom/py/') +sys.path.append('/home/tom/sites/') +sys.path.append('/home/tom/sites/MyDjangoSites') + +os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' + + +import django.core.handlers.wsgi +application = django.core.handlers.wsgi.WSGIHandler() diff --git a/import_wp.py b/import_wp.py new file mode 100755 index 0000000..b3cfb4e --- /dev/null +++ b/import_wp.py @@ -0,0 +1,110 @@ +#!/usr/bin/python + +import MySQLdb +import sys,os +import string as s +os.environ['DJANGO_SETTINGS_MODULE'] = 'MyDjangoSites.settings' +from datetime import datetime + +from django.contrib.sites.models import Site +from django.contrib.auth.models import User +from django.contrib.comments.models import Comment +from django.db.utils import IntegrityError +from MyDjangoSites.blog.models import Entry, Tag + +unic= lambda x: x #u'%s'%x.decode('latin1') + +from random import choice +def RandStr(length=3, chars=s.letters + s.digits): + return ''.join([choice(chars) for i in xrange(length)]) + +pwds=open('pwds').readlines() +pwds=map(s.strip,pwds) + +blogs=[{'sitename':'BlogBlog','dbuser':'blogblog','dbname':'blogblog','pwd':pwds[0]}, + {'sitename':'Fiket','dbuser':'fiket','dbname':'fiket','pwd':pwds[1]}, + {'sitename':'Atheist','dbuser':'atheist','dbname':'atheistundgut','pwd':pwds[2]}, + ] + + +def do_tags(cursor): + cursor.execute('select name,slug from wp_terms;') + for name,slug in cursor.fetchall(): + print name, slug + t=Tag(slug=slug) + t.name=name + t.save() + t.site.add(SITE) + t.save() + + +def do_comments(cursor,ID,entry): + cursor.execute('select comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content from wp_comments where comment_approved=1 and comment_post_ID=%s'%ID) + comments=cursor.fetchall() + for comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content in comments: + comm=Comment(content_object=entry,site=SITE,user_name=unic(comment_author),user_email=comment_author_email,user_url=comment_author_url,comment=unic(comment_content),ip_address='127.0.0.1',submit_date=comment_date,is_public=True,is_removed=False) + comm.save(force_insert=True) + + +def do_entries(cursor): + cursor.execute('select ID,post_date,post_title,post_content,post_name from wp_posts where post_status="publish" and (post_type="post" or post_type="page");') + posts=cursor.fetchall() + + for ID,post_date,post_title,post_content,post_name in posts: + entry=Entry(pub_date=post_date,title=unic(post_title),lang=LANG, + body=unic(post_content),author=AUTHOR,slug=post_name) + entry.save(force_insert=True) + entry.site.add(SITE) + + try: entry.save() + except IntegrityError,e: + print e + if 'column slug is not unique' in e: + entry.slug=entry.slug+RandStr() + entry.save() + + + + cursor.execute('select name,slug from wp_terms, wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.ID="%s" AND wp_posts.ID=wp_term_relationships.object_ID AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id AND wp_term_taxonomy.term_id=wp_terms.term_id'%ID) + tags=cursor.fetchall() + for tag_name,tag_slug in tags: + tag=Tag.objects.get(slug=tag_slug) + entry.tags.add(tag) + + entry.save() + do_comments(cursor,ID,entry) + + + +for blog in blogs: + conn = MySQLdb.connect (host = "localhost", + user = blog['dbuser'], + passwd = blog['pwd'], + db = blog['dbname']) + + cursor = conn.cursor () + + + LANG='g' + SITE=Site.objects.get(name=blog['sitename']) + AUTHOR=User.objects.get(pk=1) + + + do_tags(cursor) + do_entries(cursor) + + +####### special operations + +# get entries tagged Europa into the EU-site +# and the other tags too. +et=Tag.objects.get(slug='europa') +eus=Site.objects.get(name='EU') +ee=Entry.objects.filter(tags=et) +for e in ee: + e.site.add(eus) + e.save() + for t in e.tags.all(): + if t.slug != 'europa': + t.site.add(eus) + diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..5e78ea9 --- /dev/null +++ b/manage.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + execute_manager(settings) diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..f2c05c0 --- /dev/null +++ b/settings.py @@ -0,0 +1,103 @@ +# Django settings for MyDjangoSites project. + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + ('Thomas Marquart', '[email protected]'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': '/home/tom/sites/MyDjangoSites/mysites.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + }, +} + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'Europe/Stockholm' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'de-de' + +#SITE_ID = 1 +from multisite.threadlocals import SiteIDHook +SITE_ID = SiteIDHook() + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = False + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale +USE_L10N = True + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = 'http://all.tmy.se/media/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/admin-media/' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'd$@gw87j$(u#hfqm150*2rhkum1giv*zh2wp8lfn-6_0gfr97c' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + 'multisite.template_loader.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.Loader', +) +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'multisite.middleware.DynamicSiteMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +) + +ROOT_URLCONF = 'MyDjangoSites.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + '/home/tom/sites/MyDjangoSites/templates' +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.admin', + 'django.contrib.markup', + 'django.contrib.flatpages', + 'django.contrib.comments', + + 'MyDjangoSites.blog', +) diff --git a/simple_search.py b/simple_search.py new file mode 100644 index 0000000..6d37ee5 --- /dev/null +++ b/simple_search.py @@ -0,0 +1,91 @@ +import re +from django.db.models import Q +from django import forms + +from django.utils.text import smart_split +from django.conf import settings +from django.core.exceptions import FieldError + +from MyDjangoSites.blog.models import Entry + +class BaseSearchForm(forms.Form): + q = forms.CharField(label='Search', required=False) + def clean_q(self): + return self.cleaned_data['q'].strip() + + order_by = forms.CharField( + widget=forms.HiddenInput(), + required=False, + ) + + + class Meta: + abstract = True + base_qs = None + search_fields = None + fulltext_fields = None + + def get_text_search_query(self, query_string): + filters = [] + + def construct_search(field_name): + if field_name.startswith('^'): + return "%s__istartswith" % field_name[1:] + elif field_name.startswith('='): + return "%s__iexact" % field_name[1:] + elif field_name.startswith('@'): + if settings.DATABASE_ENGINE == 'mysql': + return "%s__search" % field_name[1:] + else: + return "%s__icontains" % field_name[1:] + else: + return "%s__icontains" % field_name + + for bit in smart_split(query_string): + or_queries = [Q(**{construct_search(str(field_name)): bit}) for field_name in self.Meta.search_fields] + filters.append(reduce(Q.__or__, or_queries)) + + + return reduce(Q.__and__, filters) + + + def construct_filter_args(self, cleaned_data=None): + args = [] + + if not cleaned_data: + cleaned_data = self.cleaned_data + + # construct text search + if cleaned_data['q']: + args.append(self.get_text_search_query(cleaned_data.pop('q'))) + + # if its an instance of Q, append to filter args + # otherwise assume an exact match lookup + for field in cleaned_data: + if isinstance(cleaned_data[field], Q): + args.append(cleaned_data[field]) + elif field == 'order_by': + pass # special case - ordering handled in get_result_queryset + elif cleaned_data[field]: + args.append(Q(**{field: cleaned_data[field]})) + + return args + + + def get_result_queryset(self): + qs = self.Meta.base_qs.filter(*self.construct_filter_args()) + for field_name in self.Meta.search_fields: + if '__' in field_name: + qs = qs.distinct() + break + + if self.cleaned_data['order_by']: + qs = qs.order_by(self.cleaned_data['order_by']) + + return qs + + +class EntrySearchForm(BaseSearchForm): + class Meta: + base_qs = Entry.objects + search_fields = ['title','body',] diff --git a/static/admin-media b/static/admin-media new file mode 120000 index 0000000..40fba7a --- /dev/null +++ b/static/admin-media @@ -0,0 +1 @@ +../../../py/django/contrib/admin/media/ \ No newline at end of file diff --git a/static/css/classic.css b/static/css/classic.css new file mode 100644 index 0000000..ffcda1b --- /dev/null +++ b/static/css/classic.css @@ -0,0 +1,54 @@ +/* +classic.css +'Classic' style for the Tarski theme - http://tarskitheme.com/ +Designed by Benedict Eastaugh, http://extralogical.net/ +*/ + + +/* Navigation +----------------------------------------------- */ +body.classic #wrapper .nav-current:link, body.classic #wrapper .nav-current:visited, body.classic #wrapper .nav-current:active { color: #bf6030; } +body.classic #wrapper .nav-current:hover { color: #e59900; } + +/* Content +----------------------------------------------- */ +body.classic abbr, body.classic acronym { border-bottom: 1px solid #bf8060; } + + /* Headers + --------------------------------------- */ + body.classic h3 { color: #bf6030; } + + /* Post content + --------------------------------------- */ + body.classic .articlenav { background: #fcfeff; } + + /* Inserts + --------------------------------------- */ + body.classic .insert { background: #fcfeff; margin: 0 0 1em 0; border: 1px solid #cfdde5; padding: 9px; } + body.classic .insert h3 { border-bottom: 1px solid #cfdde5; } + + /* Downloads + --------------------------------------- */ + body.classic .content a.download:link, body.classic .content a.download:visited, body.classic .content a.download:active { background-color: #fcfeff; border: 1px solid #cfdde5; } + + /* Images + --------------------------------------- */ + body.classic a img { border: 1px solid #0f6b99; } + body.classic a:hover img, body.classic .comment a:hover .avatar { border: 1px solid #e59900; } + +/* Links +----------------------------------------------- */ +body.classic a:link, body.classic a:active, body.classic a:visited { color: #0f6b99; } +body.classic a:hover { color: #e59900; } + +body.classic .content a:link, body.classic .content a:active, body.classic .content a:visited, body.classic .link-pages a:link, body.classic .link-pages a:active, body.classic .link-pages a:visited, body.classic .tagdata a:link, body.classic .tagdata a:active, body.classic .tagdata a:visited, body.classic .widget_tag_cloud a:link, body.classic .widget_tag_cloud a:active, body.classic .widget_tag_cloud a:visited { border-bottom: 1px solid #cfdde5; } +body.classic .content a:hover, body.classic .link-pages a:hover, body.classic .tagdata a:hover, body.classic .widget_tag_cloud a:hover { border-bottom: 1px solid #e59900; } + +/* Widgets +----------------------------------------------- */ + + /* Calendar widget + ------------------------------------------- */ + body.classic .widget_calendar tbody td a { color: #fff; background: #8bb6cc; } + body.classic .widget_calendar tbody td a:hover { color: #fff; background: #cca352; } + \ No newline at end of file diff --git a/static/css/print.css b/static/css/print.css new file mode 100644 index 0000000..35440fd --- /dev/null +++ b/static/css/print.css @@ -0,0 +1,38 @@ +/* +Tarski print stylesheet +*/ + +#header-image, #navigation, #sidebar, #footer { display: none; } + +body { border: none; padding: 0; text-align: left; font-size: 10pt; line-height: normal; font-family: Verdana, sans-serif; color: #000; background: #fff; } + body.rtl { text-align: right; direction: rtl; } + +#blog-title { font-size: 18pt; font-weight: bold; margin: 1em 0 0.5em 0; } + #blog-title a:link, #blog-title a:visited, #blog-title a:hover, #blog-title a:active { color: #000; text-decoration: none; } + + + h1, h2, h4 { font-family: "Times New Roman", Times, serif; } + h1 { font-size: 24pt; font-weight: normal; margin: 1em 0; } + h2 { font-size: 18pt; font-weight: normal; margin: 0.5em 0; } + h3 { font-size: 10pt; font-weight: normal; text-transform: uppercase; margin: 0 0 1em 0; border-bottom: 1px dotted #000; padding: 0 0 0.2em 0; } + h4 { font-size: 12px; font-weight: normal; margin: 0 0 0.5em 0; } + + body .entry { margin: 0 0 2em 0; } + body .entry .meta { margin: 0 0 1em 0; } + body .entry .meta .title { margin: 0 0 0.1em 0; } + body .entry .meta .metadata { margin: 0; font-size: 9pt; } + + ul, ol { margin: 0 0 1em 0; } + ul { list-style: circle; } + + p { margin: 0 0 1em 0; } + blockquote { margin: 0 2em 1em 2em; } + strong { font-weight: bold; } + em { font-style: italic; } + cite { font-style: italic; } + code { font-family: Courier, "Courier New", monospace; } + +a img { border: none; } + +a:link, a:visited, a:hover, a:active { color: #000; text-decoration: underline; } + body .content a[href]:after { font-size: 9pt; content: " (" attr(href) ") "; } \ No newline at end of file diff --git a/static/css/screen.css b/static/css/screen.css new file mode 100644 index 0000000..d658777 --- /dev/null +++ b/static/css/screen.css @@ -0,0 +1,27 @@ +/* +Tarski screen stylesheet +*/ + +/* Main structure +----------------------------------------------- */ +body { min-width: 760px; } +#wrapper { width: 760px; } + +/* Positioning +----------------------------------------------- */ +body .primary { width: 500px; float: right; } + body.janus .primary { float: left; } +body .primary-span { padding-left: 220px; clear: both; } + body.janus .primary-span { padding-left: 0; padding-right: 220px; } + +body .secondary { width: 200px; float: left; } + body.janus .secondary { float: right; } +body .secondary-span { padding-left: 520px; clear: both; } + body.janus .secondary-span { padding-left: 0; padding-right: 520px; } + +body { text-align: left; } +body.rtl { text-align: right; } +body.centre { text-align: center; } +body #wrapper { margin: 0 auto 0 0; } +body.rtl #wrapper { margin: 0 0 0 auto; } +body.centre #wrapper { margin: 0 auto; } diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..f6444e7 --- /dev/null +++ b/static/css/style.css @@ -0,0 +1,426 @@ +/* +Theme Name: Tarski +Theme URI: http://tarskitheme.com/ +Description: An elegant, flexible theme developed by <a href="http://extralogical.net/">Ben Eastaugh</a> and <a href="http://ceejayoz.com/">Chris Sternal-Johnson</a>. +Author: Benedict Eastaugh and Chris Sternal-Johnson +Author URI: http://tarskitheme.com/about/ +Tags: white, two-columns, fixed-width, custom-colors, custom-header, theme-options, left-sidebar, right-sidebar, threaded-comments, sticky-post, microformats +Version: 2.5 +. +Released under the <a href="http://www.opensource.org/licenses/gpl-license.php">GPL</a>. +. +*/ + +/*----------------------------------------------- +READ THIS FIRST! + +Please do not edit this file unless you absolutely have to. +To customise your CSS styles, create an alternate stylesheet +as per the instructions at the following URL: + +http://tarskitheme.com/help/styles/ + +Using this method will preserve your changes when +you upgrade to a newer version of Tarski. +----------------------------------------------- */ + +/* Initial cleanup +----------------------------------------------- */ +html, body, form, fieldset { margin: 0; padding: 0; } +form label { cursor: pointer; } +fieldset { border: none; } + +/* Main structure +----------------------------------------------- */ +body { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 76%; line-height: 120%; color: #404040; background: #fff; } +#wrapper { text-align: left; } +body.rtl #wrapper { text-align: right; direction: rtl; } + #header, #content { margin-bottom: 2em; padding-left: 20px; padding-right: 20px; } + #footer, #theme-info, #footer-include { clear: both; } + +/* Fix floats +----------------------------------------------- */ +.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.clearfix { display: inline-block; } +/* Hides from IE-mac \*/ +* html .clearfix { height: 1%; } +.clearfix { display: block; } +/* End hide from IE-mac */ + +/* Header +----------------------------------------------- */ +#header-image { overflow: hidden; margin: 0 0 -20px 0; } + #header-image a { text-decoration: none; border: none; } + #header-image a img { border: none; } +#title { margin: 20px 0 -20px; border-bottom: 1px solid #ccc; } +#navigation { margin: 20px 0 0 0; border-bottom: 1px solid #ccc; } + +/* Navigation +----------------------------------------------- */ +#navigation ul.primary { list-style: none; margin: 0; padding: 0.5em 0; } +body.rtl #navigation ul.primary { direction: ltr; } + #navigation ul.primary li { display: inline; margin: 0 1em 0 0; } + body.rtl #navigation ul.primary li { display: inline; margin: 0 0 0 1em; } +#navigation div.secondary { padding: 0.5em 0; } + #navigation div.secondary p { margin: 0; } + body.janus #navigation .secondary p, body.janus #theme-info .secondary p { text-align: right; } + +#wrapper .nav-current:link, #wrapper .nav-current:visited, #wrapper .nav-current:active { color: #8fbf60; } +#wrapper .nav-current:hover { color: #a8001c; } + + /* Feed icon + ------------------------------------------- */ + body .feed { display: block; float: left; padding: 1px 0 1px 20px; min-height: 15px; font-size: 0.8em; background: url('/images/icons.png') no-repeat 0 1px; } + body.janus .feed, body.rtl .feed { float: right; padding: 1px 20px 1px 0; background-position: 100% 1px; } + +/* Content +----------------------------------------------- */ + + /* HTML element control + --------------------------------------- */ + p { margin: 0 0 1em 0; } + blockquote { margin: 0 0 1em 0; padding: 0 30px; color: #808080; } + strong { font-weight: bold; } + em { font-style: italic; } + acronym, abbr { border-bottom: 1px solid #8fb7bf; } + small { font-size: 0.8em; } + sup, sub { font-size: 75%; } + sup { vertical-align: super; } + sub { vertical-align: sub; } + hr { width: 100%; height: 1px; background: #ccc; color: #ccc; margin: 1em 0; border: none; padding: 0; } + pre, code, tt { font-family: 'Courier', 'Courier New', monospace; font-size: 1em; line-height:1.8; color: #4d4d4d; } + pre { margin: 0 0 1em 0; border: 1px solid #e5e5e5; padding: 0.5em 1em; white-space: pre-wrap; overflow: hidden; background: #fafafa; } + code, tt { background: #efefef; } + pre code, pre tt { background: none; } + html > body code, html > body tt, html > body pre { font-size:12px; } + h3 code { text-transform: none; } + ul, ol { margin: 0 0 1em 15px; padding: 0; } + ul { list-style: disc; } + li { margin: 0 0 0.25em 0; } + body.rtl ul, body.rtl ol { margin: 0 15px 1em 0; padding: 0; } + + /* Global content control + --------------------------------------- */ + body .content p { line-height: 1.4; } + body .content li { line-height: 1.4; } + + /* Headers + --------------------------------------- */ + #blog-title { font-family: 'Times New Roman', Times, serif; font-size: 2.5em; font-weight: normal; margin: 0; border: none; padding: 0; line-height: 120%; } + #tagline { font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; font-style: italic; color: #808080; margin: 0.1em 0 0.3em 0; border: none; padding: 0; line-height: 120%; } + + h1, body .entry .title { font-family: 'Times New Roman', Times, serif; font-size: 2em; font-weight: normal; line-height: 120%; margin: 0; border-bottom: 1px solid #ccc; padding: 0 0 0.1em 0; } + h2 { font-family: 'Times New Roman', Times, serif; font-size: 2em; font-weight: normal; line-height: 120%; margin: 0 0 0.5em 0; } + h3 { font-size: 0.8em; font-weight: normal; color: #8fbf60; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.8em 0; border-bottom: 1px solid #e5e5e5; padding: 0 0 0.4em 0; } + h4 { font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; line-height: 120%; margin: 0 0 0.3em 0; } + h5 { font-size: 1em; font-weight: bold; line-height: 120%; margin: 0 0 0.3em 0; padding: 0; } + h6 { font-size: 0.8em; font-weight: bold; line-height: 120%; margin: 0 0 0.3em 0; padding: 0; } + + /* Post content + --------------------------------------- */ + body .articlenav { margin: 0 0 2em 0; border-bottom: 1px solid #e5e5e5; padding-top: 0.75em; padding-bottom: 0.75em; background: #fcffff; color: #808080; } + body.janus .articlenav { text-align: right; } + body.rtl .articlenav { border-bottom: 1px solid #e5e5e5; } + body .entry { margin: 0 0 2em 0; clear: both; } + body .posts .entry { margin: 0 0 4em 0; } + body .entry .meta { margin: 0 0 1em 0; } + body .entry .metadata { font-size: 0.8em; color: #808080; margin: 0; padding: 0; } + body .entry .meta .metadata { margin: 0; padding: 0.3em 0 0 0; } + body .aside { margin: 0 0 4em 0; } + body .aside .meta { margin: -0.8em 0 0 0; border-top: 1px dotted #d9d9d9; padding: 0.2em 0 0 0; color: #808080; font-size: 0.8em; text-align: right; clear: both; } + body .archive { margin: 0 0 2em 0; } + body .archive .meta { margin: 0 0 1em 0; } + body .link-pages { font-size: 0.8em; color: #808080; clear: both; } + body .pagination { margin: 0; font-family: 'Times New Roman', Times, serif; font-size: 1.5em; font-weight: normal; line-height: 120%; color: #808080; clear: both; } + + /* Inserts + --------------------------------------- */ + body .insertright { margin: 0 0 20px 20px; width: 220px; float: right; } + body .insertleft { margin: 0 20px 20px 0; width: 220px; float: left; } + body .insert { background: #fcffff; margin: 0 0 1em 0; border: 1px solid #cfe2e5; padding: 9px; } + body .insert h3 { border-bottom: 1px solid #cfe2e5; } + + /* Downloads + --------------------------------------- */ + body a.download { display: block; margin: 1em 0; padding: 5px 5px 5px 28px; min-height: 15px; } + body .content a.download:link, body .content a.download:visited, body .content a.download:active { background:#fcffff url('/images/icons.png') no-repeat 5px -295px; border: 1px solid #cfe2e5; } + body .content a.download:hover { text-decoration: underline; } + + /* Images + --------------------------------------- */ + a img { border: 1px solid #006a80; } + a:hover img, body .comment a:hover .avatar { border: 1px solid #a8001c; } + #wrapper .gallery a:link, #wrapper .gallery-item a:visited, #wrapper .gallery-item a:hover, #wrapper .gallery-item a:active, #wrapper a.imagelink2 img, #wrapper a.imagelink2:hover img, #wrapper a.imagelink:link, #wrapper a.imagelink:visited, #wrapper a.imagelink:hover, #wrapper a.imagelink:active, #wrapper a.imagelink2:link, #wrapper a.imagelink2:visited, #wrapper a.imagelink2:hover, #wrapper a.imagelink2:active { border: none; } + body .imageleft, body .alignleft { float: left; margin: 0 10px 10px 0; } + body .imageright, body .alignright { float: right; margin: 0 0 10px 10px; } + body .imageblock { display: block; margin: 0 0 1em 0; } + body .imagecentre, body .imagecenter, body .centered, body .aligncenter { display: block; text-align: center; margin: 0 auto 1em auto; } + + body .gallery { margin: 0 auto 1em 0; } + body .gallery-item { float: left; margin-top: 10px; text-align: center; } + body #wrapper .content .gallery-item a, body #wrapper .content .attachment a { border-bottom:none; } + body .gallery-caption { margin-left: 0; } + + /* Tags & Tags page + --------------------------------------- */ + body .tagdata { font-size: 0.8em; color: #808080; clear: both; } + body .tagcloud {} + body .tagcloud a { margin: 0 2px 0 0; } + + /* Search content + --------------------------------------- */ + body .post-brief { margin: 0 0 2em 0; } + body .post-brief h3 { margin: 0 0 0.2em 0; } + body .post-brief p.post-metadata { color: #808080; margin: 0 0 0.2em 0; border: none; padding: 0; } + body .post-brief p.excerpt { margin: 0; } + + /** + * Comments layout & style + * + * Designed to work for comments which are threaded, unthreaded, paginated + * and unpaginated. Trackbacks are now included inline rather than being + * rendered at the top. Comments also sit directly below the post or page + * content, rather than taking the entire width of the site. This increases + * their flexibility (given column swapping etc.) and maintainability + * (since fewer permutations reduce the likelihood of bugs.) + * + * @since 2.4 + */ + #comments { clear: both; margin: 0; padding: 0; } + body .comment, body .trackback, body .pingback { padding: 0; list-style: none; } + body .comment .comment { margin: 0; } + li.comment, li.trackback, li.pingback { margin: 0; border-top: 1px solid #ccc; padding: 0; } + body .comment ol.children, body .trackback ol.children, body .pingback ol.children { clear: both; margin: 0; border-top: 1px solid #ccc; padding: 0 0 0 20px; } + body.rtl .comment ol.children, body.rtl .trackback ol.children, body.rtl .pingback ol.children { padding: 0 20px 0 0 ; } + body p.pingdata { margin: 0; font-size: 0.8em; color: #808080; } + li.comment-lvl-first { border-top: none; } + body .comment .reply { clear: both; } + body .comment .reply a { padding-left: 13px; background: url('/images/icons.png') no-repeat -7px -398px; } + body.rtl .comment .reply a { background: url('/images/icons.png') no-repeat -7px -598px; } + + body .comment-wrapper { padding: 0.66em 0; } + body .moderated { border-bottom: 1px solid #e5e5e5; padding-bottom: 0.66em; background: url('/images/icons.png') no-repeat 100% -200px; } + body .comment-meta { margin: 0; float: left; font-size: 0.8em; color: #808080; } + body.rtl .comment-meta { float: right;} + body .avatar-link { display: block; float: right; margin: 0 0 10px 10px; } + body.rtl .avatar-link { float: left; margin: 0 10px 10px 0; } + body .avatar, body .comment a .avatar { display: block; float: right; margin: 0 0 10px 10px; border: 1px solid #ccc; padding: 4px; background:#fcfcfc; } + body.rtl .avatar, body.rtl .comment a .avatar { float: left; margin: 0 10px 10px 0;} + body .comment .avatar-link .avatar { float: none; margin: 0; } + body .comment-permalink, body .comment-edit {} + body .comment-author { font-weight: bold; color: #404040; } + body .comment-content { clear: left; padding-top: 0.8em; } + body.rtl .comment-content { clear: right; } + body .reply { margin: 0; font-size: 0.8em; } + body .author-comment {} + body .trackback { margin: 0; border-top: 1px solid #ccc; padding: 0.5em 0; background: #fcffff; } + body .trackback p { font-size: 0.8em; margin: 0; } + + #comments-header .title { width: 49.5%; float: left; margin: 0 0 0.1em 0; border: none; } + .rtl #comments-header .title { float: right; } + #comments-header .comments-feed { width: 49.5%; float: right; text-align: right; margin: 0; padding: 0.75em 0 0 0; } + #comments-header .comments-feed a { display: block; float:right; min-height:16px; padding: 1px 20px 1px 0; background: url('/images/icons.png') no-repeat 100% -100px; font-size: 0.8em; } + .rtl #comments-header .comments-feed a { float:left; padding: 1px 20px 1px 0; } + #comments-header .trackback-link { clear: both; margin: 0.4em 0 0 0; border-top: 1px solid #ccc; padding: 0.5em 0; font-size: 0.8em; font-weight: bold; color: #808080; } + #comments-header .trackback-link a { font-weight: normal; } + #comment-paging { padding: 0.5em 0; } + #comment-paging { margin: 0; border-top: 1px solid #ccc; font-family: 'Times New Roman', Times, serif; font-size: 1.5em; color: #808080; } + #comment-paging span.page-numbers { color: #404040; } + #comments-closed { margin: 0; border-top: 1px solid #e5e5e5; padding-top: 0.66em; } + + /* Lists + --------------------------------------- */ + body .navlist { list-style: none; margin: 0 0 1em 0; } + body .navlist li { margin: 0.5em 0; } + body .navlist ul { list-style: none; margin: 0 0 0 1em; } + body .navlist ul li { margin: 0.5em 0; } + #wrapper .navlist a:link, #wrapper .navlist a:visited, #wrapper .navlist a:hover, #wrapper .navlist a:active { border-bottom: none; } + body .archivelist { list-style: none; margin: 0.5em 0 1em 0; } + body .archivelist li { margin: 0.5em 0; } + body .archivelist ul { list-style: none; margin: 0 0 0 1.5em; } + body .archivelist ul li { margin: 0.5em 0; } + body .postspermonth { list-style: none; margin: 0.5em 0 1em 0; } + body .postspermonth li { margin: 0.5em 0; } + + /* Sidebar + --------------------------------------- */ + body .bookmarks ul { list-style: none; margin: 0 0 1em 0; } + body .bookmarks ul li { margin: 0.5em 0; } + + /* Footer + --------------------------------------- */ + #footer { margin: 0 20px 0 20px; border-top: 3px double #ccc; padding: 1em 0 0 0; } + .recent-articles {} + .recent-articles ul { list-style: none; margin: 0; } + .recent-articles li { margin: 0; } + h4.recent-title { margin: 0; } + .recent-metadata { font-size: 0.8em; color: #808080; margin: 0 0 0.5em 0; } + .recent-excerpt { line-height: 1.4; margin: 0 0 1em 0; } + #theme-info { margin: 0.5em 0 0 0; border-top: 3px double #ccc; padding: 1em 0 0.5em 0; color: #808080; } + +/* Forms +----------------------------------------------- */ +input, select, textarea { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 100%; } +input.text, input[type=text], input[type=password], textarea { border: 1px solid #ccc; padding: 2px; background: #fafafa; color: #404040; } +input.text:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus { background: #fff; } +input[type=submit]:enabled, button:enabled { border: 1px solid #ccc; padding: 2px 10px; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; background: url('/images/button_gradient.png') repeat-x 0 0; color: #404040; cursor: pointer; } +input[type=submit]:enabled:focus, input[type=submit]:enabled:hover, button:enabled:focus, button:enabled:hover { border-color: #666; } + + /* Search form + --------------------------------------- */ + body .searchbox { width: 200px; margin: 0 0 1em 0; } + #s { display: block; width: 194px; margin: 0 0 0.6em 0; border: 1px solid #ccc; padding: 2px; background: #fafafa; color: #404040; } + #s:focus { background: #fff; } + body.js #searchlabel { display: none; } + + /** + * Comment reply form layout & style. + * + * Consists of a simple header with a title and 'Cancel reply' link, + * followed by three text fields which are floated next to one another. + * Lastly, a textarea and submit button. The amount of specialised code + * is intentionally small, since the form should inherit from the general + * Tarski form styling. + * + * @since 2.4 + */ + #respond { padding-top: 0.66em; border-top: 1px solid #e5e5e5; } + #respond-header { margin-bottom: 0.66em; border-bottom: 1px solid #ccc; padding-bottom: 0.4em; } + #respond-header .title { float: left; margin: 0; } + .rtl #respond-header .title { float: right; } + #respond-header .cancel-reply { float: right; margin: 0; padding-top: 0.75em; font-size: 0.8em; } + .rtl #respond-header .cancel-reply { float: left; } + #respond-header .cancel-reply a { padding-right: 13px; background: url('/images/icons.png') no-repeat 100% -498px; } + body .response-details { margin-bottom: 1em; } + body .response-details .text-wrap { width: 31%; float: left; margin-right: 2%; } + body .response-details > .text-wrap { width: 32%; } + body .response-details .url-wrap { margin-right: 0; } + body .response { margin-bottom: 0.8em; } + body .response-details .text-wrap label, body .response label { display: block; height: 1.5em; color: #808080; } + body .response-details .text-wrap input.text { display: block; width: 98%; } + body .response textarea { display: block; width: 99%; } + body .req-notice { font-size: 0.8em; } + p.submit-wrapper { margin: 0; } + +/* Links +----------------------------------------------- */ +a { text-decoration: none; } +a:link, a:visited, a:active { color: #006a80; } +a:hover { color: #a8001c; } + +body .content a:link, body .content a:active, body .content a:visited, body .link-pages a:link, body .link-pages a:active, body .link-pages a:visited, body .tagdata a:link, body .tagdata a:active, body .tagdata a:visited, body .widget_tag_cloud a:link, body .widget_tag_cloud a:active, body .widget_tag_cloud a:visited { border-bottom: 1px solid #cfe2e5; } +body .content a:hover, body .link-pages a:hover, body .tagdata a:hover, body .widget_tag_cloud a:hover { border-bottom: 1px solid #e5cfd2; } + #wrapper .content h2 a:link, #wrapper .content h2 a:visited, #wrapper .content h2 a:hover, #wrapper .content h2 a:active, #wrapper .content h3 a:link, #wrapper .content h3 a:visited, #wrapper .content h3 a:hover, #wrapper .content h3 a:active, #wrapper .content h4 a:link, #wrapper .content h4 a:visited, #wrapper .content h4 a:hover, #wrapper .content h4 a:active { border: none; } + +/* Widgets +----------------------------------------------- */ +body .widget { margin: 0 0 2em 0; } + + /* List widgets + ------------------------------------------- */ + body .widget ul { margin: 0; list-style: none; } + body .widget ul li { margin: 0.5em 0; } + body .widget ul ul, body .widget ol ol, body .widget ol ul, body .widget ul ol { margin-left: 15px; } + body.rtl .widget ul ul, body.rtl .widget ol ol, body.rtl .widget ol ul, body.rtl .widget ul ol { margin-right: 15px; } + + /* Tag cloud widget + ------------------------------------------- */ + body .widget_tag_cloud { line-height: 1.2; } + body .widget_tag_cloud a { margin: 0 2px 0 0; } + + /* Calendar widget + ------------------------------------------- */ + body .widget_calendar {} + body .widget_calendar table { width: 100%; } + body .widget_calendar caption { margin: 0.25em 0 0.2em 0; border-bottom: 1px solid #ccc; padding: 0 0 0.5em 0; font-family: 'Times New Roman', Times, Georgia, serif; font-size:1.5em; text-align: center; } + body .widget_calendar th, body .widget_calendar td { margin: 1px; padding: 5px; text-align: center; } + body .widget_calendar th { background: #fafcfc; font-weight: bold; } + body .widget_calendar td { background: #edf1f2; } + body .widget_calendar tbody td a { display:block; margin: -5px; padding: 5px; color: #fff; background: #8bb6cc; } + body .widget_calendar tbody td a:hover { color: #fff; background: #cc8a95; } + body .widget_calendar td.pad, .widget_calendar tfoot td { background: #fff; } + body .widget_calendar tfoot td { font-family: 'Times New Roman', Times, Georgia, serif; font-size: 1.5em; } + body .widget_calendar #prev { text-align: left; } + body .widget_calendar #next { text-align: right; } + + + +/* OWN STUFF */ +.figure img { border: none;} +.figure a { + text-decoration: none; + margin: 0px; + border: none !important; + font-size: smaller; +} + +.right { float: right; margin-left: 5px; padding: 10px 10px 10px 10px; +border: thin solid silver;} +.left { float: left; margin-right: 10px; padding: 10px 10px 10px 10px; +border: thin solid silver;} + +#header-image { + width: 720px; + height: 210px; + margin-top: 5px; + } + +/* #navigation { border-top: 1px solid #ccc; } */ + +.bigger {font-size: 1.5em;} + +.aside {border-top: 1px solid #ddd; padding-top: 3px} +.aside ul { list-style: none; margin: 0 0 1em 0; } +.aside ul li { margin: 0.5em 0; } + + +table { + margin: 0.5em 0; + border-collapse: collapse; +} + +td { + padding: 0.45em; + border: 1px solid #4c8099; +} + +.sv { + background: url('/images/swehalf.gif') center right no-repeat; + padding-right: 13px; +} +.sv:hover { + background: url('/images/swefull.gif') center right no-repeat; + padding-right: 13px; +} +.de { + background: url('/images/deuhalf.gif') center right no-repeat; + padding-right: 13px; +} +.de:hover { + background: url('/images/deufull.gif') center right no-repeat; + padding-right: 13px; +} +.en { + background: url('/images/enghalf.gif') center right no-repeat; + padding-right: 13px; +} +.en:hover { + background: url('/images/engfull.gif') center right no-repeat; + padding-right: 13px; +} +.im { + background: url('/images/imghalf.gif') center right no-repeat; + padding-right: 13px; +} +.im:hover { + background: url('/images/imgfull.gif') center right no-repeat; + padding-right: 13px; +} + +.noborderimg {border: 0px !important;} + +/* overwrite from above */ +.widgets .textwidget { padding: 0 0 0 0; } +blockquote { margin: 0 0 1em 0; padding: 0 30px; color: #888888; } + + diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/static/js/tarski.js b/static/js/tarski.js new file mode 100644 index 0000000..297ebcf --- /dev/null +++ b/static/js/tarski.js @@ -0,0 +1,110 @@ +Function.prototype.bind = function(object) { + var method = this; + return function() { + return method.apply(object, arguments); + }; +}; + +function addEvent( obj, type, fn ) { + if (obj.addEventListener) { + obj.addEventListener( type, fn, false ); + EventCache.add(obj, type, fn); + } + else if (obj.attachEvent) { + obj["e"+type+fn] = fn; + obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } + obj.attachEvent( "on"+type, obj[type+fn] ); + EventCache.add(obj, type, fn); + } + else { + obj["on"+type] = obj["e"+type+fn]; + } +}; + +var EventCache = function(){ + var listEvents = []; + return { + listEvents : listEvents, + add : function(node, sEventName, fHandler){ + listEvents.push(arguments); + }, + flush : function(){ + var i, item; + for(i = listEvents.length - 1; i >= 0; i = i - 1){ + item = listEvents[i]; + if(item[0].removeEventListener){ + item[0].removeEventListener(item[1], item[2], item[3]); + }; + if(item[1].substring(0, 2) != "on"){ + item[1] = "on" + item[1]; + }; + if(item[0].detachEvent){ + item[0].detachEvent(item[1], item[2]); + }; + item[0][item[1]] = null; + }; + } + }; +}(); +addEvent(window,'unload',EventCache.flush); + +/** + * <p>Replaces element el1's empty 'value' attribute with element el2's content.</p> + * @param {Object} replaceable + * @param {Object} replacing + */ +function replaceEmpty(replaceable, replacing) { + if (/^\s*$/.test(replaceable.value)) { + replaceable.value = replacing.firstChild.nodeValue; + } +}; + +/** + * <p>Search box object, allowing us to add some default text to the search + * field which will then be removed when that field is given focus. It remains + * accessible because the default text is pulled from the search field's label + * and that label is only hidden when JavaScript is enabled.</p> + */ +var Searchbox = { + + /** + * <p>If the search box and associated label exist, hide the label and + * add the label's content to the search box. Then add two events to the + * search box, one which will reset the box's content when it's given focus + * and one which will add the label content back when it loses focus (as + * long as the box is empty).</p> + */ + init : function() { + this.sBox = document.getElementById('s'); + this.sLabel = document.getElementById('searchlabel'); + if (this.sBox && this.sLabel) { + this.sLabel.style.display = 'none'; + replaceEmpty(this.sBox, this.sLabel); + addEvent(this.sBox, 'focus', this.reset_text.bind(this)); + addEvent(this.sBox, 'blur', this.add_text.bind(this)); + } + }, + + /** + * <p>Removes the search box's default content.</p> + */ + reset_text : function() { + if (this.sBox.value == this.sLabel.firstChild.nodeValue) { + this.sBox.value = ''; + } + }, + + /** + * <p>Adds the search box's default content back in if it's empty.</p> + */ + add_text : function() { + replaceEmpty(this.sBox, this.sLabel); + } +}; + +addEvent(window, 'load', function() { + var body = document.getElementsByTagName('body')[0]; + body.className += " js"; +}); + +addEvent(window, 'load', Searchbox.init.bind(Searchbox)); \ No newline at end of file diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..e69de29 diff --git a/templates/atheist.tmy.se/entry.html b/templates/atheist.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/atheist.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/index.html b/templates/atheist.tmy.se/index.html new file mode 100644 index 0000000..8124076 --- /dev/null +++ b/templates/atheist.tmy.se/index.html @@ -0,0 +1,30 @@ +{% extends "tarski.html" %} +{% block title %}Atheist und Gut{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Atheist und Gut</h1> + <p id="tagline">ein Blog über die Welt aus der Sicht eines Gottlosen</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/atheist.tmy.se/search.html b/templates/atheist.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/atheist.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/tag.html b/templates/atheist.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/atheist.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/atheist.tmy.se/tags.html b/templates/atheist.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/atheist.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/base/entry.html b/templates/base/entry.html new file mode 100644 index 0000000..bdf01e1 --- /dev/null +++ b/templates/base/entry.html @@ -0,0 +1,60 @@ +{% extends "index.html" %} +{% load markup %} +{% load comments %} + + +{% block content %} + + + <div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"><a href="{{ object.get_absolute_url }}" rel="bookmark" title="Permalink dieses Artikels">{{ object.title }}</a></h2> + <p class="metadata"><span class="date updated">{{ object.pub_date }}</span> | <a href="{{ object.get_absolute_url }}#respond" class="comments-link" title="Kommentieren">Keine Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile }} + + </div> + <p class="tagdata"><strong>Schlagworte:</strong> {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}" rel="tag">{{ tag.name }}</a>{% if not forloop.last %},{% endif %} {% endfor %}</p> + </div> + <div id="comments-header"> + <div class="clearfix"> + {% get_comment_count for object as comment_count %} + <h2 class="title">{{ comment_count }} Kommentare</h2> + <p class="comments-feed"><a href="{{ object.get_absolute_url }}feed/">RSS-Feed f&uuml;r Kommentare zu diesem Artikel</a></p> + </div> + </div> + + + <ol id="comments" class="clearfix"> + {% get_comment_list for object as comment_list %} + {% for comment in comment_list %} + <li class="comment even thread-even depth-1" id="comment-{{ comment.id }}"> + <div class="comment-wrapper clearfix" id="comment-wrapper-{{ comment.id }}"> + <p class="comment-meta commentmetadata"> + <span class="comment-author vcard"> + <a class="url fn" href="{{ comment.user_url }}" rel="external nofollow">{{ comment.user_name }}</a></span> am <span class="comment-permalink"> + <a title="Permalink zu diesem Kommentar" href="{{ object.get_absolute_url }}#comment-65045">2010-05-04 um 17:31</a></span> </p> + + <div class="comment-content content"> + {{ comment.comment|textile }} + </div> + + </div> + </li> + {% endfor %} + </ol> + + + <div id="respond"> <div id="respond-header" class="clearfix"> + <h2 class="title">Kommentieren</h2> </div> + {% render_comment_form for object %} + </div> + + </div> + + + +{% endblock %} diff --git a/templates/base/index.html b/templates/base/index.html new file mode 100644 index 0000000..c784d47 --- /dev/null +++ b/templates/base/index.html @@ -0,0 +1,28 @@ +{% extends "tarski.html" %} +{% block title %}Base title{% endblock %} + +{% block header %} + +Base header + +{% endblock %} + +{% block content %} +<ul> +{% for entry in object_list %} +<li>{{ entry.title }}</li> +{% endfor %} +</ul> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} + +{% block themeinfo %} +{% endblock %} diff --git a/templates/base/search.html b/templates/base/search.html new file mode 100644 index 0000000..2331312 --- /dev/null +++ b/templates/base/search.html @@ -0,0 +1,14 @@ +{% extends "index.html" %} +{% block content %} +<form action="." method="post"> +{% csrf_token %} +{{ form.as_p }} +<input type="submit" value="Suchen" /> + + +<ul> +{% for entry in results %} +<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> +{% endfor %} +</ul> +{% endblock %} diff --git a/templates/base/tag.html b/templates/base/tag.html new file mode 100644 index 0000000..d5b053e --- /dev/null +++ b/templates/base/tag.html @@ -0,0 +1,11 @@ +{% extends "index.html" %} + +{% block content %} + +<ul> +{% for entry in object_list %} +<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li> +{% endfor %} +</ul> + +{% endblock %} diff --git a/templates/base/tags.html b/templates/base/tags.html new file mode 100644 index 0000000..e409c4e --- /dev/null +++ b/templates/base/tags.html @@ -0,0 +1,11 @@ +{% extends "index.html" %} + +{% block content %} + +<ul> +{% for tag in object_list %} +<li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li> +{% endfor %} +</ul> + +{% endblock %} diff --git a/templates/blogblog.tmy.se/entry.html b/templates/blogblog.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/blogblog.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/index.html b/templates/blogblog.tmy.se/index.html new file mode 100644 index 0000000..2831cc8 --- /dev/null +++ b/templates/blogblog.tmy.se/index.html @@ -0,0 +1,30 @@ +{% extends "tarski.html" %} +{% block title %}Das BlogBlog{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Das BlogBlog</h1> + <p id="tagline">ein reines Metablog</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/blogblog.tmy.se/search.html b/templates/blogblog.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/blogblog.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/tag.html b/templates/blogblog.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/blogblog.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/blogblog.tmy.se/tags.html b/templates/blogblog.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/blogblog.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/comments/comment_notification_email.txt b/templates/comments/comment_notification_email.txt new file mode 100644 index 0000000..63f1493 --- /dev/null +++ b/templates/comments/comment_notification_email.txt @@ -0,0 +1,3 @@ +A comment has been posted on {{ content_object }}. +The comment reads as follows: +{{ comment }} diff --git a/templates/eu.tmy.se/entry.html b/templates/eu.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/eu.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/eu.tmy.se/index.html b/templates/eu.tmy.se/index.html new file mode 100644 index 0000000..c98a6c3 --- /dev/null +++ b/templates/eu.tmy.se/index.html @@ -0,0 +1,30 @@ +{% extends "tarski.html" %} +{% block title %}Betreff: EU{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Betreff: EU</h1> + <p id="tagline">Texte zum geeinten Europa</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.betreff.eu/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.betreff.eu/ueber-eu/">Über Betreff.EU</a></li> + <li><a id="nav-3-archiv" href="http://www.betreff.eu/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.betreff.eu/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.betreff.eu/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/eu.tmy.se/search.html b/templates/eu.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/eu.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/eu.tmy.se/tag.html b/templates/eu.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/eu.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/eu.tmy.se/tags.html b/templates/eu.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/eu.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/entry.html b/templates/fiket.tmy.se/entry.html new file mode 120000 index 0000000..e7246f8 --- /dev/null +++ b/templates/fiket.tmy.se/entry.html @@ -0,0 +1 @@ +../base/entry.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/index.html b/templates/fiket.tmy.se/index.html new file mode 100644 index 0000000..132eee4 --- /dev/null +++ b/templates/fiket.tmy.se/index.html @@ -0,0 +1,31 @@ +{% extends "tarski.html" %} +{% block title %}Fiket{% endblock %} + +{% block header %} +<div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> + <ul class="primary xoxo"> + <li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> + <li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> + <li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> + <li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> + <li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> + </ul> + + <div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> + </div> +</div> +{% endblock %} + + +{% block sidebar %} +{% endblock %} + +{% block footsidebar %} +{% endblock %} + +{% block footcontent %} +{% endblock %} diff --git a/templates/fiket.tmy.se/search.html b/templates/fiket.tmy.se/search.html new file mode 120000 index 0000000..e2ccfcd --- /dev/null +++ b/templates/fiket.tmy.se/search.html @@ -0,0 +1 @@ +../base/search.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/tag.html b/templates/fiket.tmy.se/tag.html new file mode 120000 index 0000000..e99519b --- /dev/null +++ b/templates/fiket.tmy.se/tag.html @@ -0,0 +1 @@ +../base/tag.html \ No newline at end of file diff --git a/templates/fiket.tmy.se/tags.html b/templates/fiket.tmy.se/tags.html new file mode 120000 index 0000000..91b7a56 --- /dev/null +++ b/templates/fiket.tmy.se/tags.html @@ -0,0 +1 @@ +../base/tags.html \ No newline at end of file diff --git a/templates/tarski.html b/templates/tarski.html new file mode 100644 index 0000000..f8f26d5 --- /dev/null +++ b/templates/tarski.html @@ -0,0 +1,119 @@ +{% load markup %} +{% load comments %} +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE" xml:lang="de-DE"> + +<head><title>{% block title %}Title{% endblock %}</title> + + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta name="generator" content="My custom Django application." /> + + <meta name="description" content="Writings about various topics by Thomas Marquart" /> + <meta name="robots" content="all" /> + +<link rel="stylesheet" href="style.css" type="text/css" media="all" /> +<link rel="stylesheet" href="screen.css" type="text/css" media="screen,projection" /> +<link rel="stylesheet" href="print.css" type="text/css" media="print" /> +<link rel="stylesheet" href="classic.css" type="text/css" media="all" /> + +<script type="text/javascript" src="tarski.js"></script> +<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Feed" href="http://www.fiket.de/feed/" /> +<link rel="alternate" type="application/rss+xml" title="Fiket &raquo; Comments Feed" href="http://www.fiket.de/comments/feed/" /> + +</head> + +<body id="home" class="centre classic"><div id="wrapper"> +<div id="header"> +{% block header %} + + <div id="title"> + <h1 id="blog-title">Fiket</h1> + <p id="tagline">das Blog aus und über Schweden</p></div> +<div id="navigation" class="clearfix"> +<ul class="primary xoxo"> +<li><a id="nav-home" class="nav-current" href="http://www.fiket.de/" rel="home">Startseite</a></li> +<li><a id="nav-2-about" href="http://www.fiket.de/about/">Über Fiket</a></li> +<li><a id="nav-933-dies-und-das" href="http://www.fiket.de/dies-und-das/">Dies Und Das</a></li> +<li><a id="nav-3-archiv" href="http://www.fiket.de/archiv/">Archiv</a></li> +<li><a id="nav-11-impressum" href="http://www.fiket.de/impressum/">Impressum</a></li> +</ul> + +<div class="secondary"> + <p><a class="feed" href="http://www.fiket.de/feed/">Feed abonnieren</a></p> +</div></div> +{% endblock %} +</div> +<div id="content" class="clearfix"> +<div class="primary posts"> + + +{% block content %} +{% for object in entries.object_list%} +<div class="post-{{ object.id }} post hentry category-schweden tag-foto tag-stockholm entry"> + + <div class="meta"> + <h2 class="title entry-title" id="post-{{ object.id }}"> + <a href="{{object.get_absolute_url}}" rel="bookmark" title="Permalink für diesen Artikel">{{ object.title }}</a> + </h2> + <p class="metadata"><span class="date updated">{{ object.pub_date.date }}</span> | <a href="{{object.get_absolute_url}}#respond" class="comments-link" title="Kommentieren">{% get_comment_count for object as comment_count %}{{ comment_count }} Kommentare</a></p> + </div> + + <div class="content"> + {{ object.body|textile }} + + </div> + </div> +{% endfor %} + +<p class="pagination"> +{% if entries.has_next %} +<a href="/page/{{ entries.next_page_number }}/">&laquo; &Auml;ltere Beitr&auml;ge</a> +{% endif %} +&nbsp;(Seite {{ entries.number }} von {{ entries.paginator.num_pages }})&nbsp; +{% if entries.has_previous %} +<a href="/page/{{ entries.previous_page_number }}/" >Neuere Beitr&auml;ge &raquo;</a> +{% endif %} +</p> + +{% endblock %} + +</div> + +<div id="sidebar" class="secondary"> +{% block sidebar %} + +{% endblock %} + +</div> + +</div> <!-- /main content --> + + +<div id="footer" class="clearfix"> + + <div class="secondary"> + {% block footsidebar %} + + {% endblock %} + + </div> <!-- /secondary --> + + <div class="primary"> + {% block footcontent %} + + {% endblock %} + + + </div> <!-- /primary --> + + <div id="theme-info" class="clearfix"> + {% block themeinfo %} + + {% endblock %} + + </div> <!-- /theme-info --> + +</div> <!-- /footer --> + +</div> +</body></html> diff --git a/urls.py b/urls.py new file mode 100644 index 0000000..9804380 --- /dev/null +++ b/urls.py @@ -0,0 +1,38 @@ +from django.conf.urls.defaults import * +from django.contrib.comments.feeds import LatestCommentFeed +from django.views.generic import list_detail +from MyDjangoSites.blog.models import Tag,Entry +from MyDjangoSites.blog.views import LatestEntriesFeed + + +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns('', + (r'^admin/doc/', include('django.contrib.admindocs.urls')), + (r'^admin/', include(admin.site.urls)), + (r'^comments/', include('django.contrib.comments.urls')), +) + + +feeds = { + 'comments': LatestCommentFeed, + 'posts':LatestEntriesFeed, +} + +urlpatterns += patterns('', + (r'^comments/feed/', LatestCommentFeed()), + (r'^feed/',LatestEntriesFeed()), + (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), +) + +urlpatterns += patterns('MyDjangoSites.blog.views', + (r'^$', 'index'), + (r'^page/(?P<page>\d+)/$', 'index'), + url(r'^(?P<yr>\d{4})/(?P<mon>\d{2})/(?P<day>\d{2})/(?P<slug>[\w-]+)/$','entry_by_permalink',name='permalink'), + (r'^tags/$', 'tags'), + url(r'^tag/(?P<slug>\w+)/$','tag_view',name='tag'), + (r'^post/(?P<id>\d+)/$','entry_by_id'), + (r'^search/$','search'), + + )
pwim/emoticon
0c1d248e0e3eece386027e9386693da169a2b2c2
bump version
diff --git a/emoticon.gemspec b/emoticon.gemspec index 4a1d6ea..21171e8 100644 --- a/emoticon.gemspec +++ b/emoticon.gemspec @@ -1,35 +1,35 @@ Gem::Specification.new do |s| s.name = "emoticon" - s.version = "0.0.3" + s.version = "0.0.4" s.date = "2008-11-12" s.summary = "Emoticon (emoji) handling for Japanese mobile phones" s.email = "[email protected]" s.homepage = "http://github.com/pwim/emoticon" s.description = "Emoticon is a Ruby library for transcoding emoticons across different carriers for Japanese mobile phones. It is derived from Jpmobile, a rails plugin for building mobile sites for Japanese mobiles created by Yohji Shidara" s.has_rdoc = false s.authors = ["Paul McMahon"] s.files = ["README", "MIT-LICENSE", "emoticon.gemspec", "lib/emoticon.rb", "lib/emoticon/conversion_table.rb", "lib/emoticon/transcoder.rb", "lib/emoticon/conversion_table/au.rb", "lib/emoticon/conversion_table/docomo.rb", "lib/emoticon/conversion_table/softbank.rb", "lib/emoticon/transcoder/au.rb", "lib/emoticon/transcoder/docomo.rb", "lib/emoticon/transcoder/jphone.rb", "lib/emoticon/transcoder/null.rb", "lib/emoticon/transcoder/softbank.rb", "lib/emoticon/transcoder/vodafone.rb", ] s.test_files = ["test/emoticon_test.rb", "test/test_helper.rb", "test/emoticon/transcoder/au_test.rb", "test/emoticon/transcoder/docomo_test.rb", "test/emoticon/transcoder/jphone_test.rb", "test/emoticon/transcoder/softbank_test.rb", "test/emoticon/transcoder/vodafone_test.rb", ] end
pwim/emoticon
9a39d04816a58f05d14abfea3d3f9cd67482be77
Changed to output Shift_JIS pictograms for SoftBank
diff --git a/lib/emoticon/transcoder/jphone.rb b/lib/emoticon/transcoder/jphone.rb index 0d2c6ff..2539325 100644 --- a/lib/emoticon/transcoder/jphone.rb +++ b/lib/emoticon/transcoder/jphone.rb @@ -1,25 +1,19 @@ require File.join(File.dirname(File.dirname(__FILE__)), "transcoder", "softbank") class Emoticon::Transcoder::Jphone < Emoticon::Transcoder::Softbank # +str+のなかでWebcodeのSoftBank絵文字を(+0x1000だけシフトして)Unicode数値文字参照に変換した文字列を返す。 def external_to_unicodecr(str) # SoftBank Webcode s = str.clone # 連続したエスケープコードが省略されている場合は切りはなす。 s.gsub!(/\x1b\x24(.)(.+?)\x0f/) do |match| a = $1 $2.split(//).map{|x| "\x1b\x24#{a}#{x}\x0f"}.join('') end # Webcodeを変換 s.gsub(SOFTBANK_WEBCODE_REGEXP) do |match| unicode = SOFTBANK_WEBCODE_TO_UNICODE[match[2,2]] + 0x1000 unicode ? ("&#x%04x;"%unicode) : match end end - - private - - def to_sjis - true - end end diff --git a/lib/emoticon/transcoder/softbank.rb b/lib/emoticon/transcoder/softbank.rb index 5d462c4..7587c55 100644 --- a/lib/emoticon/transcoder/softbank.rb +++ b/lib/emoticon/transcoder/softbank.rb @@ -1,19 +1,23 @@ require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") class Emoticon::Transcoder::Softbank < Emoticon::Transcoder # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。 def external_to_unicodecr(str) # SoftBank Unicode str.gsub(SOFTBANK_UNICODE_REGEXP) do |match| unicode = match.unpack('U').first "&#x%04x;" % (unicode+0x1000) end end private + def to_sjis + true + end + def conversion_table CONVERSION_TABLE_TO_SOFTBANK end end diff --git a/test/emoticon/transcoder/softbank_test.rb b/test/emoticon/transcoder/softbank_test.rb index 969b4b4..7f13334 100644 --- a/test/emoticon/transcoder/softbank_test.rb +++ b/test/emoticon/transcoder/softbank_test.rb @@ -1,20 +1,20 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/softbank" class SoftbankTest < Test::Unit::TestCase def setup @transcoder = Emoticon::Transcoder::Softbank.instance end def test_internal_to_external assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) - assert_equal "[ドコモポイント]", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "[ドコモポイント]".tosjis, @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_UTF8) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) end end
pwim/emoticon
f0bde998ed6c08fe3170b88db6444f6bfade4e99
Bump version
diff --git a/emoticon.gemspec b/emoticon.gemspec index d1ab6f7..4a1d6ea 100644 --- a/emoticon.gemspec +++ b/emoticon.gemspec @@ -1,35 +1,35 @@ Gem::Specification.new do |s| s.name = "emoticon" - s.version = "0.0.2" + s.version = "0.0.3" s.date = "2008-11-12" s.summary = "Emoticon (emoji) handling for Japanese mobile phones" s.email = "[email protected]" s.homepage = "http://github.com/pwim/emoticon" s.description = "Emoticon is a Ruby library for transcoding emoticons across different carriers for Japanese mobile phones. It is derived from Jpmobile, a rails plugin for building mobile sites for Japanese mobiles created by Yohji Shidara" s.has_rdoc = false s.authors = ["Paul McMahon"] s.files = ["README", "MIT-LICENSE", "emoticon.gemspec", "lib/emoticon.rb", "lib/emoticon/conversion_table.rb", "lib/emoticon/transcoder.rb", "lib/emoticon/conversion_table/au.rb", "lib/emoticon/conversion_table/docomo.rb", "lib/emoticon/conversion_table/softbank.rb", "lib/emoticon/transcoder/au.rb", "lib/emoticon/transcoder/docomo.rb", "lib/emoticon/transcoder/jphone.rb", "lib/emoticon/transcoder/null.rb", "lib/emoticon/transcoder/softbank.rb", "lib/emoticon/transcoder/vodafone.rb", ] s.test_files = ["test/emoticon_test.rb", "test/test_helper.rb", "test/emoticon/transcoder/au_test.rb", "test/emoticon/transcoder/docomo_test.rb", "test/emoticon/transcoder/jphone_test.rb", "test/emoticon/transcoder/softbank_test.rb", "test/emoticon/transcoder/vodafone_test.rb", ] end
pwim/emoticon
2ad0419226ba1065dfc859b31c74d9907b0b91f8
Robustify. Fix test cases. Add method for transcoding shift jis to unicode cr for docomo.
diff --git a/lib/emoticon.rb b/lib/emoticon.rb index 8cf5222..67011a0 100644 --- a/lib/emoticon.rb +++ b/lib/emoticon.rb @@ -1,14 +1,14 @@ Dir.glob(File.join(File.dirname(__FILE__), "emoticon", "transcoder", "*.rb")) do |file| require "emoticon/transcoder/#{File.basename(file, ".rb")}" end module Emoticon def self.transcoder_for_carrier(carrier) - name = carrier.capitalize - if Transcoder.const_defined?(name) + name = carrier.to_s.capitalize + if !name.empty? && Transcoder.const_defined?(name) Transcoder.const_get(name).instance else Transcoder::Null.instance end end end diff --git a/lib/emoticon/transcoder/docomo.rb b/lib/emoticon/transcoder/docomo.rb index 0a18060..acb85de 100644 --- a/lib/emoticon/transcoder/docomo.rb +++ b/lib/emoticon/transcoder/docomo.rb @@ -1,23 +1,30 @@ require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") class Emoticon::Transcoder::Docomo < Emoticon::Transcoder # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。 def external_to_unicodecr(str) str.gsub(SJIS_REGEXP) do |match| sjis = match.unpack('n').first unicode = SJIS_TO_UNICODE[sjis] unicode ? ("&#x%04x;"%unicode) : match end end + def sjiscr_to_unicodecr(s) + s.gsub(/&#([0-9]{5});/i) do |match| + unicode = DOCOMO_SJIS_TO_UNICODE[$1.to_i].to_s(16).upcase + "&#x#{unicode};" + end + end + private def to_sjis true end def conversion_table CONVERSION_TABLE_TO_DOCOMO end end diff --git a/test/emoticon/transcoder/au_test.rb b/test/emoticon/transcoder/au_test.rb index 560741d..1621adc 100644 --- a/test/emoticon/transcoder/au_test.rb +++ b/test/emoticon/transcoder/au_test.rb @@ -1,20 +1,20 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/au" class AuTest < Test::Unit::TestCase def setup - @transcoder = Emoticon::Transcoder::Au.new + @transcoder = Emoticon::Transcoder::Au.instance end def test_internal_to_external assert_equal "\xf6\x60", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\xf6\x60", @transcoder.internal_to_external(DOCOMO_UTF8) assert_equal "[ドコモポイント]".tosjis, @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\xf6\x60", @transcoder.internal_to_external(AU_CR) assert_equal "\xf6\x60", @transcoder.internal_to_external(AU_UTF8) assert_equal "\xf6\x60", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\xf6\x60", @transcoder.internal_to_external(SOFTBANK_UTF8) end end diff --git a/test/emoticon/transcoder/docomo_test.rb b/test/emoticon/transcoder/docomo_test.rb index 0d7998b..a40beab 100644 --- a/test/emoticon/transcoder/docomo_test.rb +++ b/test/emoticon/transcoder/docomo_test.rb @@ -1,20 +1,25 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/docomo" class DocomoTest < Test::Unit::TestCase def setup - @transcoder = Emoticon::Transcoder::Docomo.new + @transcoder = Emoticon::Transcoder::Docomo.instance end def test_internal_to_external assert_equal "\xf8\x9f", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\xf8\x9f", @transcoder.internal_to_external(DOCOMO_UTF8) assert_equal "\xf9\x79", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\xf8\x9f", @transcoder.internal_to_external(AU_CR) assert_equal "\xf8\x9f", @transcoder.internal_to_external(AU_UTF8) assert_equal "\xf8\x9f", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\xf8\x9f", @transcoder.internal_to_external(SOFTBANK_UTF8) end + + def test_sjiscr_to_unicodecr + s = @transcoder.sjiscr_to_unicodecr("<P>&#63647;</P>") + assert_equal("<P>&#xE63E;</P>", s) + end end diff --git a/test/emoticon/transcoder/jphone_test.rb b/test/emoticon/transcoder/jphone_test.rb index b1807b3..bc486ad 100644 --- a/test/emoticon/transcoder/jphone_test.rb +++ b/test/emoticon/transcoder/jphone_test.rb @@ -1,18 +1,18 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/jphone" class JphoneTest < Test::Unit::TestCase def setup - @transcoder = Emoticon::Transcoder::Jphone.new + @transcoder = Emoticon::Transcoder::Jphone.instance end def test_internal_to_external assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) assert_equal "[ドコモポイント]".tosjis, @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) end end diff --git a/test/emoticon/transcoder/softbank_test.rb b/test/emoticon/transcoder/softbank_test.rb index b8b75c5..969b4b4 100644 --- a/test/emoticon/transcoder/softbank_test.rb +++ b/test/emoticon/transcoder/softbank_test.rb @@ -1,20 +1,20 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/softbank" class SoftbankTest < Test::Unit::TestCase def setup - @transcoder = Emoticon::Transcoder::Softbank.new + @transcoder = Emoticon::Transcoder::Softbank.instance end def test_internal_to_external assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) assert_equal "[ドコモポイント]", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_UTF8) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) end end diff --git a/test/emoticon/transcoder/vodafone_test.rb b/test/emoticon/transcoder/vodafone_test.rb index 5a0d78d..0e4d45b 100644 --- a/test/emoticon/transcoder/vodafone_test.rb +++ b/test/emoticon/transcoder/vodafone_test.rb @@ -1,20 +1,20 @@ require 'test/unit' require File.dirname(__FILE__) + '/../../test_helper' require "emoticon/transcoder/vodafone" class VodafoneTest < Test::Unit::TestCase def setup - @transcoder = Emoticon::Transcoder::Vodafone.new + @transcoder = Emoticon::Transcoder::Vodafone.instance end def test_internal_to_external assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) assert_equal "[ドコモポイント]", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_UTF8) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) end end diff --git a/test/emoticon_test.rb b/test/emoticon_test.rb index 3400351..38f77db 100644 --- a/test/emoticon_test.rb +++ b/test/emoticon_test.rb @@ -1,14 +1,16 @@ require File.dirname(__FILE__) + '/test_helper' require 'emoticon' class EmoticonTest < Test::Unit::TestCase def test_transcoder_for_carrier assert_instance_of(Emoticon::Transcoder::Docomo, Emoticon.transcoder_for_carrier("docomo")) assert_instance_of(Emoticon::Transcoder::Au, Emoticon.transcoder_for_carrier("au")) assert_instance_of(Emoticon::Transcoder::Softbank, Emoticon.transcoder_for_carrier("softbank")) assert_instance_of(Emoticon::Transcoder::Softbank, Emoticon.transcoder_for_carrier("vodafone")) assert_instance_of(Emoticon::Transcoder::Jphone, Emoticon.transcoder_for_carrier("jphone")) assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier("emobile")) assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier("willcom")) + assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier("")) + assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier(nil)) end end
pwim/emoticon
f1e13804366a321ef93f6576a954e0805a53d3e9
try bumping version to see if this causes gem to be built
diff --git a/emoticon.gemspec b/emoticon.gemspec index 9610fc5..d1ab6f7 100644 --- a/emoticon.gemspec +++ b/emoticon.gemspec @@ -1,35 +1,35 @@ Gem::Specification.new do |s| s.name = "emoticon" - s.version = "0.0.1" + s.version = "0.0.2" s.date = "2008-11-12" s.summary = "Emoticon (emoji) handling for Japanese mobile phones" s.email = "[email protected]" s.homepage = "http://github.com/pwim/emoticon" s.description = "Emoticon is a Ruby library for transcoding emoticons across different carriers for Japanese mobile phones. It is derived from Jpmobile, a rails plugin for building mobile sites for Japanese mobiles created by Yohji Shidara" s.has_rdoc = false s.authors = ["Paul McMahon"] s.files = ["README", "MIT-LICENSE", "emoticon.gemspec", "lib/emoticon.rb", "lib/emoticon/conversion_table.rb", "lib/emoticon/transcoder.rb", "lib/emoticon/conversion_table/au.rb", "lib/emoticon/conversion_table/docomo.rb", "lib/emoticon/conversion_table/softbank.rb", "lib/emoticon/transcoder/au.rb", "lib/emoticon/transcoder/docomo.rb", "lib/emoticon/transcoder/jphone.rb", "lib/emoticon/transcoder/null.rb", "lib/emoticon/transcoder/softbank.rb", "lib/emoticon/transcoder/vodafone.rb", ] s.test_files = ["test/emoticon_test.rb", "test/test_helper.rb", "test/emoticon/transcoder/au_test.rb", "test/emoticon/transcoder/docomo_test.rb", "test/emoticon/transcoder/jphone_test.rb", "test/emoticon/transcoder/softbank_test.rb", "test/emoticon/transcoder/vodafone_test.rb", ] end
pwim/emoticon
59590af4f4eb6f2946b1793dabf5a08f9a76e093
Convert to singleton as these objects are stateless
diff --git a/lib/emoticon.rb b/lib/emoticon.rb index 7982983..8cf5222 100644 --- a/lib/emoticon.rb +++ b/lib/emoticon.rb @@ -1,14 +1,14 @@ Dir.glob(File.join(File.dirname(__FILE__), "emoticon", "transcoder", "*.rb")) do |file| require "emoticon/transcoder/#{File.basename(file, ".rb")}" end module Emoticon def self.transcoder_for_carrier(carrier) name = carrier.capitalize if Transcoder.const_defined?(name) - Transcoder.const_get(name).new + Transcoder.const_get(name).instance else - Transcoder::Null.new + Transcoder::Null.instance end end end diff --git a/lib/emoticon/transcoder.rb b/lib/emoticon/transcoder.rb index 52ab7eb..1bd31e4 100644 --- a/lib/emoticon/transcoder.rb +++ b/lib/emoticon/transcoder.rb @@ -1,72 +1,74 @@ require "emoticon/conversion_table" require 'scanf' require "kconv" +require "singleton" module Emoticon class Transcoder include Emoticon::ConversionTable + include Singleton def unicodecr_to_external(str) str.gsub(/&#x([0-9a-f]{4});/i) do |match| unicode = $1.scanf("%x").first if conversion_table converted = conversion_table[unicode] # キャリア間変換 else converted = unicode # 変換しない end # 携帯側エンコーディングに変換する case converted when Integer # 変換先がUnicodeで指定されている。つまり対応する絵文字がある。 if sjis = UNICODE_TO_SJIS[converted] [sjis].pack('n') elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000] "\x1b\x24#{webcode}\x0f" else # キャリア変換テーブルに指定されていたUnicodeに対応する # 携帯側エンコーディングが見つからない(変換テーブルの不備の可能性あり)。 match end when String # 変換先がUnicodeで指定されている。 to_sjis ? Kconv::kconv(converted, Kconv::SJIS, Kconv::UTF8) : converted when nil # 変換先が定義されていない。 match end end end def utf8_to_unicodecr(str) str.gsub(UTF8_REGEXP) do |match| "&#x%04x;" % match.unpack('U').first end end def unicodecr_to_utf8(str) str.gsub(/&#x([0-9a-f]{4});/i) do |match| unicode = $1.scanf("%x").first if UNICODE_TO_SJIS[unicode] || SOFTBANK_UNICODE_TO_WEBCODE[unicode-0x1000] [unicode].pack('U') else match end end end def internal_to_external(s) unicodecr_to_external(utf8_to_unicodecr(s)) end private def to_sjis false end def conversion_table nil end end end
pwim/emoticon
d9252e9f74a938bda580fd8b800938c871efe3f7
Add gemspec
diff --git a/README b/README index 14fdc64..b0dd505 100644 --- a/README +++ b/README @@ -1,26 +1,31 @@ == emoticon: A library for transcoding Japanese mobile phones' emoticons (emoji) This library has been extracted and refactored from Jpmobile, a rails plugin for handling Japanese mobile phones. Most of the code in this library was written for Jpmobile. Once this library is mature, I hope to merge it back into Jpmobile. +== License + +This library is released under the same MIT License as Jpmobile, as described +in the file MIT-LICENSE. + == Author Once again, I did not do most of the work in creating this library. Most of the credit goes to Yohji Shidara (and any others) who worked on the original Jpmobile code. Paul McMahon http://github.com/pwim == Jpmobileの作者 / Author of Jpmobile Project Website: http://jpmobile-rails.org Copyright 2006 (c) Yohji Shidara, under MIT License. Yohji Shidara <[email protected]> http://d.hatena.ne.jp/darashi \ No newline at end of file diff --git a/emoticon.gemspec b/emoticon.gemspec new file mode 100644 index 0000000..9610fc5 --- /dev/null +++ b/emoticon.gemspec @@ -0,0 +1,35 @@ +Gem::Specification.new do |s| + s.name = "emoticon" + s.version = "0.0.1" + s.date = "2008-11-12" + s.summary = "Emoticon (emoji) handling for Japanese mobile phones" + s.email = "[email protected]" + s.homepage = "http://github.com/pwim/emoticon" + s.description = "Emoticon is a Ruby library for transcoding emoticons across different carriers for Japanese mobile phones. It is derived from Jpmobile, a rails plugin for building mobile sites for Japanese mobiles created by Yohji Shidara" + s.has_rdoc = false + s.authors = ["Paul McMahon"] + s.files = ["README", + "MIT-LICENSE", + "emoticon.gemspec", + "lib/emoticon.rb", + "lib/emoticon/conversion_table.rb", + "lib/emoticon/transcoder.rb", + "lib/emoticon/conversion_table/au.rb", + "lib/emoticon/conversion_table/docomo.rb", + "lib/emoticon/conversion_table/softbank.rb", + "lib/emoticon/transcoder/au.rb", + "lib/emoticon/transcoder/docomo.rb", + "lib/emoticon/transcoder/jphone.rb", + "lib/emoticon/transcoder/null.rb", + "lib/emoticon/transcoder/softbank.rb", + "lib/emoticon/transcoder/vodafone.rb", + ] + s.test_files = ["test/emoticon_test.rb", + "test/test_helper.rb", + "test/emoticon/transcoder/au_test.rb", + "test/emoticon/transcoder/docomo_test.rb", + "test/emoticon/transcoder/jphone_test.rb", + "test/emoticon/transcoder/softbank_test.rb", + "test/emoticon/transcoder/vodafone_test.rb", + ] +end
pwim/emoticon
550ddcd6d382451aa6f00ce48b708f7d5727427f
Restructure
diff --git a/lib/MIT-LICENSE b/MIT-LICENSE similarity index 100% rename from lib/MIT-LICENSE rename to MIT-LICENSE diff --git a/README b/README index 93274eb..14fdc64 100644 --- a/README +++ b/README @@ -1,16 +1,26 @@ == emoticon: A library for transcoding Japanese mobile phones' emoticons (emoji) This library has been extracted and refactored from Jpmobile, a rails plugin for handling Japanese mobile phones. Most of the code in this library was written for Jpmobile. Once this library is mature, I hope to merge it back into Jpmobile. +== Author + +Once again, I did not do most of the work in creating this library. Most of +the credit goes to Yohji Shidara (and any others) who worked on the original +Jpmobile code. + +Paul McMahon + +http://github.com/pwim + == Jpmobileの作者 / Author of Jpmobile Project Website: http://jpmobile-rails.org Copyright 2006 (c) Yohji Shidara, under MIT License. Yohji Shidara <[email protected]> http://d.hatena.ne.jp/darashi \ No newline at end of file
pwim/emoticon
4485a817562c2a4876da7b0e2bd9c1bcf0939e56
Initial extraction and refactoring of emoticon from Jpmobile
diff --git a/README b/README index e69de29..93274eb 100644 --- a/README +++ b/README @@ -0,0 +1,16 @@ +== emoticon: A library for transcoding Japanese mobile phones' emoticons (emoji) + +This library has been extracted and refactored from Jpmobile, a rails plugin +for handling Japanese mobile phones. Most of the code in this library was +written for Jpmobile. Once this library is mature, I hope to merge it back +into Jpmobile. + +== Jpmobileの作者 / Author of Jpmobile + +Project Website: http://jpmobile-rails.org + +Copyright 2006 (c) Yohji Shidara, under MIT License. + +Yohji Shidara <[email protected]> + +http://d.hatena.ne.jp/darashi \ No newline at end of file diff --git a/lib/MIT-LICENSE b/lib/MIT-LICENSE new file mode 100644 index 0000000..664f93a --- /dev/null +++ b/lib/MIT-LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2006 Yohji Shidara + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/lib/emoticon.rb b/lib/emoticon.rb new file mode 100644 index 0000000..7982983 --- /dev/null +++ b/lib/emoticon.rb @@ -0,0 +1,14 @@ +Dir.glob(File.join(File.dirname(__FILE__), "emoticon", "transcoder", "*.rb")) do |file| + require "emoticon/transcoder/#{File.basename(file, ".rb")}" +end + +module Emoticon + def self.transcoder_for_carrier(carrier) + name = carrier.capitalize + if Transcoder.const_defined?(name) + Transcoder.const_get(name).new + else + Transcoder::Null.new + end + end +end diff --git a/lib/emoticon/conversion_table.rb b/lib/emoticon/conversion_table.rb new file mode 100644 index 0000000..dccfe0f --- /dev/null +++ b/lib/emoticon/conversion_table.rb @@ -0,0 +1,3935 @@ +Dir.glob(File.join(File.dirname(__FILE__), "conversion_table", "*.rb")) do |file| + require "emoticon/conversion_table/#{File.basename(file, ".rb")}" +end + +$KCODE='u' + +module Emoticon + module ConversionTable + SJIS_TO_UNICODE = {} + SJIS_TO_UNICODE.update(DOCOMO_SJIS_TO_UNICODE) + SJIS_TO_UNICODE.update(AU_SJIS_TO_UNICODE) + SJIS_TO_UNICODE.freeze + UNICODE_TO_SJIS = SJIS_TO_UNICODE.invert.freeze + + SJIS_REGEXP = Regexp.union(*SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')}) + SOFTBANK_WEBCODE_REGEXP = Regexp.union(*([/(?!)/n]+SOFTBANK_WEBCODE_TO_UNICODE.keys.map{|x| "\x1b\x24#{x}\x0f"})) + + DOCOMO_SJIS_REGEXP = Regexp.union(*DOCOMO_SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')}) + AU_SJIS_REGEXP = Regexp.union(*AU_SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')}) + SOFTBANK_UNICODE_REGEXP = Regexp.union(*SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|x| [x].pack('U')}).freeze + + EMOTICON_UNICODES = UNICODE_TO_SJIS.keys|SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|k|k+0x1000} + UTF8_REGEXP = Regexp.union(*EMOTICON_UNICODES.map{|x| [x].pack('U')}).freeze + +CONVERSION_TABLE_TO_DOCOMO = { + 0xE63E=>0xE63E, + 0xE63F=>0xE63F, + 0xE640=>0xE640, + 0xE641=>0xE641, + 0xE642=>0xE642, + 0xE643=>0xE643, + 0xE644=>0xE644, + 0xE645=>0xE645, + 0xE646=>0xE646, + 0xE647=>0xE647, + 0xE648=>0xE648, + 0xE649=>0xE649, + 0xE64A=>0xE64A, + 0xE64B=>0xE64B, + 0xE64C=>0xE64C, + 0xE64D=>0xE64D, + 0xE64E=>0xE64E, + 0xE64F=>0xE64F, + 0xE650=>0xE650, + 0xE651=>0xE651, + 0xE652=>0xE652, + 0xE653=>0xE653, + 0xE654=>0xE654, + 0xE655=>0xE655, + 0xE656=>0xE656, + 0xE657=>0xE657, + 0xE658=>0xE658, + 0xE659=>0xE659, + 0xE65A=>0xE65A, + 0xE65B=>0xE65B, + 0xE65C=>0xE65C, + 0xE65D=>0xE65D, + 0xE65E=>0xE65E, + 0xE65F=>0xE65F, + 0xE660=>0xE660, + 0xE661=>0xE661, + 0xE662=>0xE662, + 0xE663=>0xE663, + 0xE664=>0xE664, + 0xE665=>0xE665, + 0xE666=>0xE666, + 0xE667=>0xE667, + 0xE668=>0xE668, + 0xE669=>0xE669, + 0xE66A=>0xE66A, + 0xE66B=>0xE66B, + 0xE66C=>0xE66C, + 0xE66D=>0xE66D, + 0xE66E=>0xE66E, + 0xE66F=>0xE66F, + 0xE670=>0xE670, + 0xE671=>0xE671, + 0xE672=>0xE672, + 0xE673=>0xE673, + 0xE674=>0xE674, + 0xE675=>0xE675, + 0xE676=>0xE676, + 0xE677=>0xE677, + 0xE678=>0xE678, + 0xE679=>0xE679, + 0xE67A=>0xE67A, + 0xE67B=>0xE67B, + 0xE67C=>0xE67C, + 0xE67D=>0xE67D, + 0xE67E=>0xE67E, + 0xE67F=>0xE67F, + 0xE680=>0xE680, + 0xE681=>0xE681, + 0xE682=>0xE682, + 0xE683=>0xE683, + 0xE684=>0xE684, + 0xE685=>0xE685, + 0xE686=>0xE686, + 0xE687=>0xE687, + 0xE688=>0xE688, + 0xE689=>0xE689, + 0xE68A=>0xE68A, + 0xE68B=>0xE68B, + 0xE68C=>0xE68C, + 0xE68D=>0xE68D, + 0xE68E=>0xE68E, + 0xE68F=>0xE68F, + 0xE690=>0xE690, + 0xE691=>0xE691, + 0xE692=>0xE692, + 0xE693=>0xE693, + 0xE694=>0xE694, + 0xE695=>0xE695, + 0xE696=>0xE696, + 0xE697=>0xE697, + 0xE698=>0xE698, + 0xE699=>0xE699, + 0xE69A=>0xE69A, + 0xE69B=>0xE69B, + 0xE69C=>0xE69C, + 0xE69D=>0xE69D, + 0xE69E=>0xE69E, + 0xE69F=>0xE69F, + 0xE6A0=>0xE6A0, + 0xE6A1=>0xE6A1, + 0xE6A2=>0xE6A2, + 0xE6A3=>0xE6A3, + 0xE6A4=>0xE6A4, + 0xE6A5=>0xE6A5, + 0xE6CE=>0xE6CE, + 0xE6CF=>0xE6CF, + 0xE6D0=>0xE6D0, + 0xE6D1=>0xE6D1, + 0xE6D2=>0xE6D2, + 0xE6D3=>0xE6D3, + 0xE6D4=>0xE6D4, + 0xE6D5=>0xE6D5, + 0xE6D6=>0xE6D6, + 0xE6D7=>0xE6D7, + 0xE6D8=>0xE6D8, + 0xE6D9=>0xE6D9, + 0xE6DA=>0xE6DA, + 0xE6DB=>0xE6DB, + 0xE6DC=>0xE6DC, + 0xE6DD=>0xE6DD, + 0xE6DE=>0xE6DE, + 0xE6DF=>0xE6DF, + 0xE6E0=>0xE6E0, + 0xE6E1=>0xE6E1, + 0xE6E2=>0xE6E2, + 0xE6E3=>0xE6E3, + 0xE6E4=>0xE6E4, + 0xE6E5=>0xE6E5, + 0xE6E6=>0xE6E6, + 0xE6E7=>0xE6E7, + 0xE6E8=>0xE6E8, + 0xE6E9=>0xE6E9, + 0xE6EA=>0xE6EA, + 0xE6EB=>0xE6EB, + 0xE70B=>0xE70B, + 0xE6EC=>0xE6EC, + 0xE6ED=>0xE6ED, + 0xE6EE=>0xE6EE, + 0xE6EF=>0xE6EF, + 0xE6F0=>0xE6F0, + 0xE6F1=>0xE6F1, + 0xE6F2=>0xE6F2, + 0xE6F3=>0xE6F3, + 0xE6F4=>0xE6F4, + 0xE6F5=>0xE6F5, + 0xE6F6=>0xE6F6, + 0xE6F7=>0xE6F7, + 0xE6F8=>0xE6F8, + 0xE6F9=>0xE6F9, + 0xE6FA=>0xE6FA, + 0xE6FB=>0xE6FB, + 0xE6FC=>0xE6FC, + 0xE6FD=>0xE6FD, + 0xE6FE=>0xE6FE, + 0xE6FF=>0xE6FF, + 0xE700=>0xE700, + 0xE701=>0xE701, + 0xE702=>0xE702, + 0xE703=>0xE703, + 0xE704=>0xE704, + 0xE705=>0xE705, + 0xE706=>0xE706, + 0xE707=>0xE707, + 0xE708=>0xE708, + 0xE709=>0xE709, + 0xE70A=>0xE70A, + 0xE6AC=>0xE6AC, + 0xE6AD=>0xE6AD, + 0xE6AE=>0xE6AE, + 0xE6B1=>0xE6B1, + 0xE6B2=>0xE6B2, + 0xE6B3=>0xE6B3, + 0xE6B7=>0xE6B7, + 0xE6B8=>0xE6B8, + 0xE6B9=>0xE6B9, + 0xE6BA=>0xE6BA, + 0xE70C=>0xE70C, + 0xE70D=>0xE70D, + 0xE70E=>0xE70E, + 0xE70F=>0xE70F, + 0xE710=>0xE710, + 0xE711=>0xE711, + 0xE712=>0xE712, + 0xE713=>0xE713, + 0xE714=>0xE714, + 0xE715=>0xE715, + 0xE716=>0xE716, + 0xE717=>0xE717, + 0xE718=>0xE718, + 0xE719=>0xE719, + 0xE71A=>0xE71A, + 0xE71B=>0xE71B, + 0xE71C=>0xE71C, + 0xE71D=>0xE71D, + 0xE71E=>0xE71E, + 0xE71F=>0xE71F, + 0xE720=>0xE720, + 0xE721=>0xE721, + 0xE722=>0xE722, + 0xE723=>0xE723, + 0xE724=>0xE724, + 0xE725=>0xE725, + 0xE726=>0xE726, + 0xE727=>0xE727, + 0xE728=>0xE728, + 0xE729=>0xE729, + 0xE72A=>0xE72A, + 0xE72B=>0xE72B, + 0xE72C=>0xE72C, + 0xE72D=>0xE72D, + 0xE72E=>0xE72E, + 0xE72F=>0xE72F, + 0xE730=>0xE730, + 0xE731=>0xE731, + 0xE732=>0xE732, + 0xE733=>0xE733, + 0xE734=>0xE734, + 0xE735=>0xE735, + 0xE736=>0xE736, + 0xE737=>0xE737, + 0xE738=>0xE738, + 0xE739=>0xE739, + 0xE73A=>0xE73A, + 0xE73B=>0xE73B, + 0xE73C=>0xE73C, + 0xE73D=>0xE73D, + 0xE73E=>0xE73E, + 0xE73F=>0xE73F, + 0xE740=>0xE740, + 0xE741=>0xE741, + 0xE742=>0xE742, + 0xE743=>0xE743, + 0xE744=>0xE744, + 0xE745=>0xE745, + 0xE746=>0xE746, + 0xE747=>0xE747, + 0xE748=>0xE748, + 0xE749=>0xE749, + 0xE74A=>0xE74A, + 0xE74B=>0xE74B, + 0xE74C=>0xE74C, + 0xE74D=>0xE74D, + 0xE74E=>0xE74E, + 0xE74F=>0xE74F, + 0xE750=>0xE750, + 0xE751=>0xE751, + 0xE752=>0xE752, + 0xE753=>0xE753, + 0xE754=>0xE754, + 0xE755=>0xE755, + 0xE756=>0xE756, + 0xE757=>0xE757, + 0xE481=>0xE737, + 0xE482=>0xE702, + 0xE483=>'?', + 0xE52C=>0xE6E1, + 0xE52D=>'<', + 0xE52E=>'>', + 0xE52F=>'<<', + 0xE530=>'>>', + 0xE531=>'■', + 0xE532=>'■', + 0xE533=>'[i]', + 0xE4C1=>0xE756, + 0xE511=>'[スピーカ]', + 0xE579=>0xE715, + 0xE486=>0xE69F, + 0xE487=>0xE642, + 0xE534=>'■', + 0xE535=>'■', + 0xE536=>'◆', + 0xE537=>'◆', + 0xE538=>'■', + 0xE539=>'■', + 0xE53A=>0xE69C, + 0xE53B=>0xE69C, + 0xE57A=>0xE71F, + 0xE53C=>'+', + 0xE53D=>'−', + 0xE53E=>'*', + 0xE53F=>'↑', + 0xE540=>'↓', + 0xE541=>0xE738, + 0xE542=>'▼', + 0xE543=>'▲', + 0xE544=>'▼', + 0xE545=>'▲', + 0xE546=>'◆', + 0xE547=>'◆', + 0xE548=>'■', + 0xE549=>'■', + 0xE54A=>0xE69C, + 0xE54B=>0xE69C, + 0xE54C=>0xE697, + 0xE54D=>0xE696, + 0xE488=>0xE63E, + 0xE4BA=>0xE653, + 0xE594=>0xE6BA, + 0xE489=>0xE69E, + 0xE512=>0xE713, + 0xE560=>'φ', + 0xE4FA=>0xE6F0, + 0xE595=>0xE6EC, + 0xE4C2=>0xE671, + 0xE513=>0xE741, + 0xE54E=>0xE732, + 0xE54F=>'×', + 0xE561=>0xE689, + 0xE57B=>0xE71C, + 0xE47C=>0xE71C, + 0xE562=>'[フロッピー]', + 0xE48A=>'[雪結晶]', + 0xE550=>'×', + 0xE551=>'×', + 0xE552=>'→', + 0xE553=>'←', + 0xE4C3=>0xE672, + 0xE554=>'÷', + 0xE563=>'[カレンダー]', + 0xE4FB=>0xE6F0, + 0xE48B=>'☆', + 0xE555=>0xE678, + 0xE556=>0xE6A5, + 0xE514=>0xE71B, + 0xE557=>'[チェックマーク]', + 0xE4DF=>0xE6A1, + 0xE468=>'☆彡', + 0xE46C=>0xE6FA, + 0xE476=>0xE6FB, + 0xE4E0=>0xE74F, + 0xE58F=>'[フォルダ]', + 0xE4FC=>0xE6F0, + 0xE558=>0xE731, + 0xE559=>0xE736, + 0xE49C=>0xE682, + 0xE590=>'[フォルダ]', + 0xE596=>0xE687, + 0xE4FD=>'[フキダシ]', + 0xE57C=>'[カード]', + 0xE55A=>'▲', + 0xE55B=>'▼', + 0xE573=>'[USA]', + 0xE49D=>0xE683, + 0xE564=>0xE689, + 0xE597=>0xE670, + 0xE515=>0xE681, + 0xE48C=>0xE640, + 0xE4BB=>'[フットボール]', + 0xE565=>0xE683, + 0xE484=>0xE72F, + 0xE46A=>0xE66D, + 0xE566=>0xE683, + 0xE567=>0xE683, + 0xE568=>0xE683, + 0xE569=>0xE689, + 0xE516=>0xE675, + 0xE56A=>'[カレンダー]', + 0xE49E=>0xE67E, + 0xE48D=>0xE63F, + 0xE521=>0xE6D3, + 0xE57D=>0xE6D6, + 0xE517=>0xE677, + 0xE57E=>0xE677, + 0xE4AB=>0xE663, + 0xE4E4=>0xE743, + 0xE57F=>'[包丁]', + 0xE580=>'[ビデオ]', + 0xE4FE=>0xE69A, + 0xE55C=>'└→', + 0xE55D=>0xE6DA, + 0xE518=>0xE6DC, + 0xE519=>0xE6D9, + 0xE56B=>0xE683, + 0xE49F=>0xE683, + 0xE581=>'[ネジ]', + 0xE51A=>0xE674, + 0xE4B1=>0xE65E, + 0xE582=>'[フロッピー]', + 0xE574=>'[グラフ]', + 0xE575=>'[グラフ]', + 0xE51B=>0xE665, + 0xE583=>0xE6FB, + 0xE56C=>0xE683, + 0xE55E=>'[チェックマーク]', + 0xE4CE=>0xE747, + 0xE4E1=>0xE6A1, + 0xE584=>'[電池]', + 0xE55F=>0xE70A, + 0xE56D=>'[画びょう]', + 0xE51C=>0xE6D9, + 0xE585=>0xE715, + 0xE4FF=>'←', + 0xE500=>'→', + 0xE56E=>0xE683, + 0xE4A0=>0xE730, + 0xE4CF=>0xE685, + 0xE51D=>'[名札]', + 0xE4AC=>0xE66F, + 0xE56F=>0xE683, + 0xE4B2=>'[トラック]', + 0xE4A1=>0xE719, + 0xE586=>'[PDC]', + 0xE591=>0xE6CF, + 0xE587=>0xE718, + 0xE592=>'[送信BOX]', + 0xE593=>'[受信BOX]', + 0xE51E=>0xE687, + 0xE4AD=>0xE664, + 0xE570=>'[定規]', + 0xE4A2=>'[三角定規]', + 0xE576=>'[グラフ]', + 0xE4C4=>'[肉]', + 0xE588=>0xE688, + 0xE589=>'[コンセント]', + 0xE501=>'[家族]', + 0xE58A=>'[リンク]', + 0xE51F=>0xE685, + 0xE520=>0xE6D0, + 0xE48E=>'%i1%%i2%', + 0xE4B3=>0xE662, + 0xE4B4=>0xE6A3, + 0xE4C8=>'[サイコロ]', + 0xE58B=>'[新聞]', + 0xE4B5=>0xE65B, + 0xE58C=>' ', + 0xE47D=>0xE67F, + 0xE47E=>0xE680, + 0xE47F=>0xE69B, + 0xE480=>'[若葉マーク]', + 0xE522=>0xE6E2, + 0xE523=>0xE6E3, + 0xE524=>0xE6E4, + 0xE525=>0xE6E5, + 0xE526=>0xE6E6, + 0xE527=>0xE6E7, + 0xE528=>0xE6E8, + 0xE529=>0xE6E9, + 0xE52A=>0xE6EA, + 0xE52B=>'[10]', + 0xE469=>0xE643, + 0xE485=>0xE641, + 0xE48F=>0xE646, + 0xE490=>0xE647, + 0xE491=>0xE648, + 0xE492=>0xE649, + 0xE493=>0xE64A, + 0xE494=>0xE64B, + 0xE495=>0xE64C, + 0xE496=>0xE64D, + 0xE497=>0xE64E, + 0xE498=>0xE64F, + 0xE499=>0xE650, + 0xE49A=>0xE651, + 0xE49B=>'[蛇使座]', + 0xE4A3=>0xE668, + 0xE4A4=>0xE66A, + 0xE4A5=>0xE66E, + 0xE4A6=>0xE66C, + 0xE4A7=>'[バス停]', + 0xE4A8=>'[アンテナ]', + 0xE4A9=>0xE661, + 0xE4AA=>0xE667, + 0xE571=>0xE66B, + 0xE572=>'[地図]', + 0xE4AE=>0xE71D, + 0xE4AF=>0xE660, + 0xE4B0=>0xE65D, + 0xE46B=>0xE733, + 0xE4B6=>0xE656, + 0xE4B7=>0xE655, + 0xE4B8=>0xE712, + 0xE4B9=>0xE659, + 0xE46D=>'[観覧車]', + 0xE4BC=>0xE6F7, + 0xE4BD=>0xE74B, + 0xE4BE=>0xE6AC, + 0xE4BF=>0xE6B3, + 0xE4C0=>'[東京タワー]', + 0xE46E=>'[777]', + 0xE46F=>'[オメデトウ]', + 0xE4C5=>'[的中]', + 0xE4C6=>0xE68B, + 0xE4C7=>0xE715, + 0xE4C9=>0xE6A4, + 0xE4CA=>0xE748, + 0xE4CB=>'[お化け]', + 0xE4CC=>'[日の丸]', + 0xE4CD=>'[スイカ]', + 0xE4D0=>0xE74A, + 0xE4D1=>'[フライパン]', + 0xE4D2=>0xE742, + 0xE4D3=>0xE751, + 0xE4D4=>'[イチゴ]', + 0xE4D5=>0xE749, + 0xE4D6=>0xE673, + 0xE470=>'[クジラ]', + 0xE4D7=>'[ウサギ]', + 0xE4D8=>0xE754, + 0xE4D9=>'[サル]', + 0xE4DA=>'[カエル]', + 0xE4DB=>0xE6A2, + 0xE4DC=>0xE750, + 0xE4DD=>'[アリ]', + 0xE4DE=>0xE755, + 0xE4E2=>'[ビーチ]', + 0xE4E3=>'[ひまわり]', + 0xE471=>0xE6F0, + 0xE472=>0xE6F1, + 0xE473=>0xE72D, + 0xE474=>0xE72B, + 0xE475=>0xE701, + 0xE4E5=>0xE6FC, + 0xE4E6=>0xE707, + 0xE4E7=>0xE728, + 0xE477=>0xE6EE, + 0xE478=>0xE6EF, + 0xE479=>0xE6FA, + 0xE47A=>0xE6FE, + 0xE47B=>'[炎]', + 0xE4E8=>'[SOS]', + 0xE4E9=>'[力こぶ]', + 0xE4EA=>0xE6EC, + 0xE4EB=>0xE6F9, + 0xE4EC=>'[宇宙人]', + 0xE4ED=>0xE643, + 0xE4EE=>0xE698, + 0xE4EF=>'[アクマ]', + 0xE4F0=>'[花丸]', + 0xE4F1=>0xE734, + 0xE4F2=>'[100点]', + 0xE4F3=>0xE6FD, + 0xE4F4=>0xE708, + 0xE4F5=>'[ウンチ]', + 0xE4F6=>'[人差し指]', + 0xE4F7=>'[得]', + 0xE4F8=>'[ドクロ]', + 0xE4F9=>0xE727, + 0xE502=>0xE68A, + 0xE503=>0xE676, + 0xE504=>0xE70F, + 0xE505=>0xE6FF, + 0xE506=>'[ギター]', + 0xE507=>'[バイオリン]', + 0xE508=>0xE67A, + 0xE509=>0xE710, + 0xE50A=>'[ピストル]', + 0xE50B=>'[エステ]', + 0xE577=>'[EZ]', + 0xE578=>0xE6D7, + 0xE50C=>0xE68C, + 0xE50D=>0xE70E, + 0xE50E=>'[UFO]', + 0xE50F=>'[UP!]', + 0xE510=>'[注射]', + 0xE598=>0xE644, + 0xE599=>0xE654, + 0xE59A=>0xE658, + 0xE59B=>0xE65A, + 0xE59C=>0xE67B, + 0xE59D=>'[演劇]', + 0xE59E=>0xE67D, + 0xE59F=>0xE684, + 0xE5A0=>0xE686, + 0xE5A1=>0xE68E, + 0xE5A2=>0xE68F, + 0xE5A3=>0xE690, + 0xE5A4=>0xE691, + 0xE5A5=>0xE692, + 0xE5A6=>0xE694, + 0xE5A7=>0xE695, + 0xE5A8=>0xE69C, + 0xE5A9=>0xE69D, + 0xE5AA=>0xE69E, + 0xE5AB=>0xE6DB, + 0xE5AC=>0xE6EB, + 0xE5AD=>0xE70B, + 0xE5AE=>0xE6F4, + 0xE5AF=>0xE6ED, + 0xE5B0=>0xE705, + 0xE5B1=>0xE706, + 0xE5B2=>'[ezplus]', + 0xE5B3=>'[地球]', + 0xE5B4=>0xE74C, + 0xE5B5=>0xE6DD, + 0xE5B6=>0xE70E, + 0xE5B7=>0xE699, + 0xE5B8=>0xE716, + 0xE5B9=>'[ラジオ]', + 0xE5BA=>'[バラ]', + 0xE5BB=>'[教会]', + 0xE5BC=>0xE65C, + 0xE5BD=>0xE740, + 0xE5BE=>0xE6F6, + 0xE5BF=>'[天使]', + 0xE5C0=>'[トラ]', + 0xE5C1=>'[クマ]', + 0xE5C2=>'[ネズミ]', + 0xE5C3=>0xE729, + 0xE5C4=>0xE726, + 0xE5C5=>0xE757, + 0xE5C6=>0xE723, + 0xE5C7=>'[タコ]', + 0xE5C8=>'[ロケット]', + 0xE5C9=>0xE71A, + 0xE5CA=>0xE6F9, + 0xE5CB=>'[ハンマー]', + 0xE5CC=>'[花火]', + 0xE5CD=>0xE747, + 0xE5CE=>0xE682, + 0xE5CF=>'[噴水]', + 0xE5D0=>'[キャンプ]', + 0xE5D1=>'[麻雀]', + 0xE5D2=>'[VS]', + 0xE5D3=>'[トロフィー]', + 0xE5D4=>'[カメ]', + 0xE5D5=>'[スペイン]', + 0xE5D6=>'[ロシア]', + 0xE5D7=>'[工事中]', + 0xE5D8=>0xE6F7, + 0xE5D9=>'[祝日]', + 0xE5DA=>'[夕焼け]', + 0xE5DB=>0xE74F, + 0xE5DC=>'[株価]', + 0xE5DD=>'[警官]', + 0xE5DE=>0xE665, + 0xE5DF=>0xE666, + 0xEA80=>0xE73E, + 0xEA81=>0xE669, + 0xEA82=>0xE661, + 0xEA83=>'[18禁]', + 0xEA84=>'[バリ3]', + 0xEA85=>'[COOL]', + 0xEA86=>'[割]', + 0xEA87=>'[サービス]', + 0xEA88=>0xE6D8, + 0xEA89=>0xE73B, + 0xEA8A=>0xE739, + 0xEA8B=>'[指]', + 0xEA8C=>'[営]', + 0xEA8D=>'↑', + 0xEA8E=>'↓', + 0xEA8F=>'[占い]', + 0xEA90=>'[マナーモード]', + 0xEA91=>'[ケータイOFF]', + 0xEA92=>0xE689, + 0xEA93=>'[ネクタイ]', + 0xEA94=>'[ハイビスカス]', + 0xEA95=>'[花束]', + 0xEA96=>'[サボテン]', + 0xEA97=>0xE74B, + 0xEA98=>0xE672, + 0xEA99=>'[祝]', + 0xEA9A=>'[薬]', + 0xEA9B=>'[風船]', + 0xEA9C=>'[クラッカー]', + 0xEA9D=>'[EZナビ]', + 0xEA9E=>'[帽子]', + 0xEA9F=>'[ブーツ]', + 0xEAA0=>'[マニキュア]', + 0xEAA1=>'[美容院]', + 0xEAA2=>'[床屋]', + 0xEAA3=>'[着物]', + 0xEAA4=>'[ビキニ]', + 0xEAA5=>0xE68D, + 0xEAA6=>0xE6EC, + 0xEAA7=>0xE6EC, + 0xEAA8=>0xE6EC, + 0xEAA9=>0xE6EC, + 0xEAAA=>0xE6EC, + 0xEAAB=>0xE6FA, + 0xEAAC=>0xE657, + 0xEAAD=>0xE6A0, + 0xEAAE=>0xE71E, + 0xEAAF=>0xE74D, + 0xEAB0=>'[ソフトクリーム]', + 0xEAB1=>'[ポテト]', + 0xEAB2=>'[だんご]', + 0xEAB3=>'[せんべい]', + 0xEAB4=>0xE74C, + 0xEAB5=>'[パスタ]', + 0xEAB6=>'[カレー]', + 0xEAB7=>'[おでん]', + 0xEAB8=>'[すし]', + 0xEAB9=>0xE745, + 0xEABA=>'[みかん]', + 0xEABB=>'[トマト]', + 0xEABC=>'[ナス]', + 0xEABD=>'[弁当]', + 0xEABE=>'[鍋]', + 0xEABF=>0xE72C, + 0xEAC0=>0xE720, + 0xEAC1=>0xE753, + 0xEAC2=>0xE72B, + 0xEAC3=>0xE6F3, + 0xEAC4=>0xE701, + 0xEAC5=>0xE721, + 0xEAC6=>0xE757, + 0xEAC7=>'[風邪ひき]', + 0xEAC8=>'[熱]', + 0xEAC9=>0xE725, + 0xEACA=>0xE6F4, + 0xEACB=>0xE723, + 0xEACC=>0xE6FF, + 0xEACD=>0xE6F0, + 0xEACE=>'(>3<)', + 0xEACF=>'(´3`)', + 0xEAD0=>'[é¼»]', + 0xEAD1=>0xE6F9, + 0xEAD2=>'(>人<)', + 0xEAD3=>'[拍手]', + 0xEAD4=>0xE70B, + 0xEAD5=>0xE700, + 0xEAD6=>0xE695, + 0xEAD7=>0xE72F, + 0xEAD8=>0xE70B, + 0xEAD9=>'m(_ _)m', + 0xEADA=>0xE6ED, + 0xEADB=>'[バニー]', + 0xEADC=>'[トランペット]', + 0xEADD=>'[ビリヤード]', + 0xEADE=>'[æ°´æ³³]', + 0xEADF=>'[消防車]', + 0xEAE0=>'[救急車]', + 0xEAE1=>'[パトカー]', + 0xEAE2=>'[ジェットコースター]', + 0xEAE3=>'[門松]', + 0xEAE4=>'[ひな祭り]', + 0xEAE5=>'[卒業式]', + 0xEAE6=>'[ランドセル]', + 0xEAE7=>'[こいのぼり]', + 0xEAE8=>0xE645, + 0xEAE9=>'[花嫁]', + 0xEAEA=>'[カキ氷]', + 0xEAEB=>'[線香花火]', + 0xEAEC=>'[巻貝]', + 0xEAED=>'[風鈴]', + 0xEAEE=>'[ハロウィン]', + 0xEAEF=>'[お月見]', + 0xEAF0=>'[サンタ]', + 0xEAF1=>0xE6B3, + 0xEAF2=>'[虹]', + 0xEAF3=>'%i44%%i139%', + 0xEAF4=>0xE63E, + 0xEAF5=>0xE67C, + 0xEAF6=>'[デパート]', + 0xEAF7=>'[城]', + 0xEAF8=>'[城]', + 0xEAF9=>'[工場]', + 0xEAFA=>'[フランス]', + 0xEAFB=>'[オープンウェブ]', + 0xEAFC=>'[カギ]', + 0xEAFD=>'[ABCD]', + 0xEAFE=>'[abcd]', + 0xEAFF=>'[1234]', + 0xEB00=>'[記号]', + 0xEB01=>'[可]', + 0xEB02=>'[チェックマーク]', + 0xEB03=>0xE6AE, + 0xEB04=>'[ラジオボタン]', + 0xEB05=>0xE6DC, + 0xEB06=>'[←BACK]', + 0xEB07=>'[ブックマーク]', + 0xEB08=>0xE6CE, + 0xEB09=>0xE663, + 0xEB0A=>0xE665, + 0xEB0B=>0xE689, + 0xEB0C=>0xE6D9, + 0xEB0D=>0xE735, + 0xEB0E=>'[ドイツ]', + 0xEB0F=>'[イタリア]', + 0xEB10=>'[イギリス]', + 0xEB11=>'[中国]', + 0xEB12=>'[韓国]', + 0xEB13=>'[白人]', + 0xEB14=>'[中国人]', + 0xEB15=>'[インド人]', + 0xEB16=>'[おじいさん]', + 0xEB17=>'[おばあさん]', + 0xEB18=>'[赤ちゃん]', + 0xEB19=>'[工事現場の人]', + 0xEB1A=>'[お姫様]', + 0xEB1B=>'[イルカ]', + 0xEB1C=>'[ダンス]', + 0xEB1D=>0xE751, + 0xEB1E=>'[ゲジゲジ]', + 0xEB1F=>'[ゾウ]', + 0xEB20=>'[コアラ]', + 0xEB21=>'[牛]', + 0xEB22=>'[ヘビ]', + 0xEB23=>'[ニワトリ]', + 0xEB24=>'[イノシシ]', + 0xEB25=>'[ラクダ]', + 0xEB26=>'[A]', + 0xEB27=>'[B]', + 0xEB28=>'[O]', + 0xEB29=>'[AB]', + 0xEB2A=>0xE698, + 0xEB2B=>0xE699, + 0xEB2C=>0xE6DE, + 0xEB2D=>0xE6F5, + 0xEB2E=>0xE700, + 0xEB2F=>0xE703, + 0xEB30=>0xE704, + 0xEB31=>0xE70A, + 0xEB32=>'[メロン]', + 0xEB33=>'[パイナップル]', + 0xEB34=>'[ブドウ]', + 0xEB35=>0xE744, + 0xEB36=>'[とうもろこし]', + 0xEB37=>'[キノコ]', + 0xEB38=>'[栗]', + 0xEB39=>'[モモ]', + 0xEB3A=>'[やきいも]', + 0xEB3B=>'[ピザ]', + 0xEB3C=>'[チキン]', + 0xEB3D=>'[七夕]', + 0xEB3E=>0xE671, + 0xEB3F=>'[è¾°]', + 0xEB40=>'[ピアノ]', + 0xEB41=>0xE712, + 0xEB42=>0xE751, + 0xEB43=>'[ボーリング]', + 0xEB44=>'[なまはげ]', + 0xEB45=>'[天狗]', + 0xEB46=>'[パンダ]', + 0xEB47=>0xE728, + 0xEB48=>0xE755, + 0xEB49=>'[花]', + 0xEB4A=>'[アイスクリーム]', + 0xEB4B=>'[ドーナツ]', + 0xEB4C=>'[クッキー]', + 0xEB4D=>'[チョコ]', + 0xEB4E=>'[キャンディ]', + 0xEB4F=>'[キャンディ]', + 0xEB50=>'(/_ï¼¼)', + 0xEB51=>'(・×・)', + 0xEB52=>'|(・×・)|', + 0xEB53=>'[火山]', + 0xEB54=>0xE6EC, + 0xEB55=>'[ABC]', + 0xEB56=>'[プリン]', + 0xEB57=>'[ミツバチ]', + 0xEB58=>'[てんとう虫]', + 0xEB59=>'[ハチミツ]', + 0xEB5A=>0xE745, + 0xEB5B=>'[飛んでいくお金]', + 0xEB5C=>'[クラクラ]', + 0xEB5D=>0xE724, + 0xEB5E=>0xE724, + 0xEB5F=>0xE6B3, + 0xEB60=>'(´3`)', + 0xEB61=>0xE6F0, + 0xEB62=>0xE6CF, + 0xEB63=>0xE72A, + 0xEB64=>0xE72A, + 0xEB65=>0xE726, + 0xEB66=>0xE6F3, + 0xEB67=>0xE6F3, + 0xEB68=>0xE72E, + 0xEB69=>0xE72E, + 0xEB6A=>0xE753, + 0xEB6B=>'[ドレス]', + 0xEB6C=>'[モアイ]', + 0xEB6D=>'[駅]', + 0xEB6E=>'[花札]', + 0xEB6F=>'[ジョーカー]', + 0xEB70=>'[エビフライ]', + 0xEB71=>0xE6D3, + 0xEB72=>0xE733, + 0xEB73=>'[パトカー]', + 0xEB74=>'[EZムービー]', + 0xEB75=>0xE6ED, + 0xEB76=>0xE74F, + 0xEB77=>0xE711, + 0xEB78=>0xE717, + 0xEB79=>0xE735, + 0xEB7A=>0xE73C, + 0xEB7B=>0xE73D, + 0xEB7C=>0xE73F, + 0xEB7D=>0xE746, + 0xEB7E=>0xE74E, + 0xEB7F=>0xE753, + 0xEB80=>0xE753, + 0xEB81=>'[Cメール]', + 0xEB82=>0xE741, + 0xEB83=>0xE693, + 0xEB84=>0xE6E0, + 0xEB85=>'(^-^)/', + 0xEB86=>'ï¼¼(^o^)/', + 0xEB87=>0xE6F3, + 0xEB88=>0xE724, + 0xF001=>0xE6F0, + 0xF002=>0xE6F0, + 0xF003=>0xE6F9, + 0xF004=>0xE6F0, + 0xF005=>0xE6F0, + 0xF006=>0xE70E, + 0xF007=>0xE699, + 0xF008=>0xE681, + 0xF009=>0xE687, + 0xF00A=>0xE688, + 0xF00B=>0xE6D0, + 0xF00C=>0xE716, + 0xF00D=>0xE6FD, + 0xF00E=>0xE727, + 0xF010=>0xE693, + 0xF011=>0xE694, + 0xF012=>0xE695, + 0xF013=>0xE657, + 0xF014=>0xE654, + 0xF015=>0xE655, + 0xF016=>0xE653, + 0xF017=>0xE712, + 0xF018=>0xE656, + 0xF019=>0xE751, + 0xF01A=>0xE754, + 0xF01B=>0xE65E, + 0xF01C=>0xE6A3, + 0xF01D=>0xE662, + 0xF01E=>0xE65B, + 0xF01F=>0xE65D, + 0xF020=>'[?]', + 0xF021=>0xE702, + 0xF022=>0xE6EC, + 0xF023=>0xE6EE, + 0xF024=>0xE6BA, + 0xF025=>0xE6BA, + 0xF026=>0xE6BA, + 0xF027=>0xE6BA, + 0xF028=>0xE6BA, + 0xF029=>0xE6BA, + 0xF02A=>0xE6BA, + 0xF02B=>0xE6BA, + 0xF02C=>0xE6BA, + 0xF02D=>0xE6BA, + 0xF02E=>0xE6BA, + 0xF02F=>0xE6BA, + 0xF030=>0xE748, + 0xF031=>0xE71A, + 0xF033=>0xE6A4, + 0xF034=>0xE71B, + 0xF035=>0xE71B, + 0xF036=>0xE663, + 0xF038=>0xE664, + 0xF03A=>0xE66B, + 0xF03B=>0xE740, + 0xF03C=>0xE676, + 0xF03D=>0xE677, + 0xF03E=>0xE6F6, + 0xF03F=>0xE6D9, + 0xF043=>0xE66F, + 0xF044=>0xE671, + 0xF045=>0xE670, + 0xF046=>0xE74A, + 0xF047=>0xE672, + 0xF048=>0xE641, + 0xF049=>0xE63F, + 0xF04A=>0xE63E, + 0xF04B=>0xE640, + 0xF04C=>0xE69F, + 0xF04D=>0xE63E, + 0xF04F=>0xE6A2, + 0xF052=>0xE6A1, + 0xF055=>0xE750, + 0xF056=>0xE6F0, + 0xF057=>0xE6F0, + 0xF058=>0xE6F2, + 0xF059=>0xE6F1, + 0xF101=>0xE665, + 0xF102=>0xE665, + 0xF103=>0xE6CF, + 0xF104=>0xE6CE, + 0xF105=>0xE728, + 0xF106=>0xE726, + 0xF107=>0xE757, + 0xF108=>0xE723, + 0xF10B=>0xE755, + 0xF10E=>0xE71A, + 0xF10F=>0xE6FB, + 0xF110=>0xE741, + 0xF111=>0xE6F9, + 0xF112=>0xE685, + 0xF114=>0xE6DC, + 0xF115=>0xE733, + 0xF118=>0xE747, + 0xF11E=>0xE682, + 0xF11F=>0xE6B2, + 0xF120=>0xE673, + 0xF123=>0xE6F7, + 0xF125=>0xE67E, + 0xF126=>0xE68C, + 0xF127=>0xE68C, + 0xF12A=>0xE68A, + 0xF12E=>'[VS]', + 0xF12F=>0xE715, + 0xF132=>0xE659, + 0xF133=>'[777]', + 0xF134=>0xE754, + 0xF135=>0xE6A3, + 0xF136=>0xE71D, + 0xF138=>'[♂]', + 0xF139=>'[♀]', + 0xF13C=>0xE701, + 0xF13D=>0xE642, + 0xF13E=>0xE674, + 0xF13F=>0xE6F7, + 0xF140=>0xE66E, + 0xF144=>0xE6D9, + 0xF145=>0xE6D9, + 0xF148=>0xE683, + 0xF149=>'[$\]', + 0xF14D=>0xE667, + 0xF14E=>0xE66D, + 0xF14F=>0xE66C, + 0xF151=>0xE66E, + 0xF153=>0xE665, + 0xF154=>0xE668, + 0xF155=>0xE666, + 0xF156=>0xE66A, + 0xF157=>0xE73E, + 0xF158=>0xE669, + 0xF159=>0xE660, + 0xF15A=>0xE65E, + 0xF201=>0xE733, + 0xF202=>0xE661, + 0xF203=>'[ココ]', + 0xF204=>0xE6F8, + 0xF205=>0xE6F8, + 0xF206=>0xE6F8, + 0xF208=>0xE680, + 0xF20A=>0xE69B, + 0xF20C=>0xE68D, + 0xF20D=>0xE68F, + 0xF20E=>0xE68E, + 0xF20F=>0xE690, + 0xF210=>0xE6E0, + 0xF211=>0xE6DF, + 0xF212=>0xE6DD, + 0xF213=>'[UP]', + 0xF214=>'[COOL]', + 0xF215=>'[有]', + 0xF216=>'[無]', + 0xF217=>'[月]', + 0xF218=>'[申]', + 0xF219=>0xE69C, + 0xF21A=>0xE69C, + 0xF21B=>0xE69C, + 0xF21C=>0xE6E2, + 0xF21D=>0xE6E3, + 0xF21E=>0xE6E4, + 0xF21F=>0xE6E5, + 0xF220=>0xE6E6, + 0xF221=>0xE6E7, + 0xF222=>0xE6E8, + 0xF223=>0xE6E9, + 0xF224=>0xE6EA, + 0xF225=>0xE6EB, + 0xF226=>'[得]', + 0xF227=>'[割]', + 0xF228=>'[サ]', + 0xF229=>0xE6D8, + 0xF22A=>0xE73B, + 0xF22B=>0xE739, + 0xF22C=>'[指]', + 0xF22D=>'[営]', + 0xF22E=>'[↑]', + 0xF22F=>'[↓]', + 0xF230=>'[←]', + 0xF231=>'[→]', + 0xF232=>'[↑]', + 0xF233=>'[↓]', + 0xF234=>'[→]', + 0xF235=>'[←]', + 0xF236=>0xE678, + 0xF237=>0xE697, + 0xF238=>0xE696, + 0xF239=>0xE6A5, + 0xF23A=>'[>]', + 0xF23B=>'[<]', + 0xF23C=>'[>>]', + 0xF23D=>'[<<]', + 0xF23F=>0xE646, + 0xF240=>0xE647, + 0xF241=>0xE648, + 0xF242=>0xE649, + 0xF243=>0xE64A, + 0xF244=>0xE64B, + 0xF245=>0xE64C, + 0xF246=>0xE64D, + 0xF247=>0xE64E, + 0xF248=>0xE64F, + 0xF249=>0xE650, + 0xF24A=>0xE651, + 0xF24C=>'[TOP]', + 0xF24D=>0xE70B, + 0xF24E=>0xE731, + 0xF24F=>0xE736, + 0xF252=>0xE737, + 0xF301=>0xE689, + 0xF304=>0xE743, + 0xF309=>'[WC]', + 0xF30A=>0xE67A, + 0xF30B=>0xE74B, + 0xF30C=>0xE672, + 0xF30D=>'[祝]', + 0xF30E=>0xE67F, + 0xF311=>0xE6FE, + 0xF313=>0xE675, + 0xF314=>0xE684, + 0xF315=>0xE734, + 0xF31A=>0xE674, + 0xF31C=>0xE710, + 0xF31F=>0xE675, + 0xF323=>0xE682, + 0xF324=>0xE6AC, + 0xF325=>0xE713, + 0xF326=>0xE6FF, + 0xF327=>0xE6EC, + 0xF328=>0xE6ED, + 0xF329=>0xE6EC, + 0xF32A=>0xE6EC, + 0xF32B=>0xE6EC, + 0xF32C=>0xE6EC, + 0xF32D=>0xE6EC, + 0xF32E=>0xE6FA, + 0xF32F=>'[☆]', + 0xF330=>0xE708, + 0xF331=>0xE706, + 0xF332=>0xE6A0, + 0xF333=>'[×]', + 0xF334=>0xE6FC, + 0xF335=>'[☆]', + 0xF336=>'[?]', + 0xF337=>0xE702, + 0xF338=>0xE71E, + 0xF339=>0xE74D, + 0xF33E=>0xE74C, + 0xF340=>0xE74C, + 0xF342=>0xE749, + 0xF345=>0xE745, + 0xF34B=>0xE686, + 0xF401=>0xE723, + 0xF402=>0xE72C, + 0xF403=>0xE720, + 0xF404=>0xE753, + 0xF405=>0xE729, + 0xF406=>0xE72B, + 0xF407=>0xE6F3, + 0xF408=>0xE701, + 0xF409=>0xE728, + 0xF40A=>0xE721, + 0xF40B=>0xE757, + 0xF40D=>0xE72A, + 0xF40E=>0xE725, + 0xF40F=>0xE723, + 0xF410=>0xE6F4, + 0xF411=>0xE72D, + 0xF412=>'%i140%%i1034%', + 0xF413=>0xE72E, + 0xF414=>0xE6F0, + 0xF415=>0xE6F0, + 0xF416=>0xE724, + 0xF417=>0xE726, + 0xF418=>0xE726, + 0xF419=>0xE691, + 0xF41B=>0xE692, + 0xF41C=>0xE6F9, + 0xF41E=>0xE695, + 0xF420=>0xE70B, + 0xF421=>0xE700, + 0xF422=>0xE695, + 0xF423=>0xE72F, + 0xF424=>0xE70B, + 0xF425=>0xE6ED, + 0xF426=>'[m(_ _)m]', + 0xF427=>'[ï¼¼(^o^)/]', + 0xF42A=>0xE658, + 0xF42E=>0xE65F, + 0xF434=>0xE65C, + 0xF435=>0xE65D, + 0xF43C=>0xE645, + 0xF43E=>0xE73F, + 0xF443=>0xE643, + 0xF449=>0xE63E, + 0xF44A=>0xE63E, + 0xF44B=>0xE6B3, + 0xF501=>'%i44%%i139%', + 0xF502=>0xE67B, + 0xF503=>0xE67C, + 0xF507=>0xE677, + 0xF521=>0xE74F, + 0xF522=>0xE751, + 0xF523=>0xE74F, + 0xF52A=>0xE6A1, + 0xF532=>'[A]', + 0xF533=>'[B]', + 0xF534=>'[AB]', + 0xF535=>'[O]', + 0xF536=>0xE698, + 0xF537=>0xE732, +} +CONVERSION_TABLE_TO_AU = { + 0xE63E=>0xE488, + 0xE63F=>0xE48D, + 0xE640=>0xE48C, + 0xE641=>0xE485, + 0xE642=>0xE487, + 0xE643=>0xE469, + 0xE644=>0xE598, + 0xE645=>0xEAE8, + 0xE646=>0xE48F, + 0xE647=>0xE490, + 0xE648=>0xE491, + 0xE649=>0xE492, + 0xE64A=>0xE493, + 0xE64B=>0xE494, + 0xE64C=>0xE495, + 0xE64D=>0xE496, + 0xE64E=>0xE497, + 0xE64F=>0xE498, + 0xE650=>0xE499, + 0xE651=>0xE49A, + 0xE653=>0xE4BA, + 0xE654=>0xE599, + 0xE655=>0xE4B7, + 0xE656=>0xE4B6, + 0xE657=>0xEAAC, + 0xE658=>0xE59A, + 0xE659=>0xE4B9, + 0xE65A=>0xE59B, + 0xE65B=>0xE4B5, + 0xE65C=>0xE5BC, + 0xE65D=>0xE4B0, + 0xE65E=>0xE4B1, + 0xE65F=>0xE4B1, + 0xE660=>0xE4AF, + 0xE661=>0xEA82, + 0xE662=>0xE4B3, + 0xE663=>0xE4AB, + 0xE664=>0xE4AD, + 0xE665=>0xE5DE, + 0xE666=>0xE5DF, + 0xE667=>0xE4AA, + 0xE668=>0xE4A3, + 0xE669=>0xEA81, + 0xE66A=>0xE4A4, + 0xE66B=>0xE571, + 0xE66C=>0xE4A6, + 0xE66D=>0xE46A, + 0xE66E=>0xE4A5, + 0xE66F=>0xE4AC, + 0xE670=>0xE597, + 0xE671=>0xE4C2, + 0xE672=>0xE4C3, + 0xE673=>0xE4D6, + 0xE674=>0xE51A, + 0xE675=>0xE516, + 0xE676=>0xE503, + 0xE677=>0xE517, + 0xE678=>0xE555, + 0xE67A=>0xE508, + 0xE67B=>0xE59C, + 0xE67C=>0xEAF5, + 0xE67D=>0xE59E, + 0xE67E=>0xE49E, + 0xE67F=>0xE47D, + 0xE680=>0xE47E, + 0xE681=>0xE515, + 0xE682=>0xE49C, + 0xE683=>0xE49F, + 0xE684=>0xE59F, + 0xE685=>0xE4CF, + 0xE686=>0xE5A0, + 0xE687=>0xE596, + 0xE688=>0xE588, + 0xE689=>0xEA92, + 0xE68A=>0xE502, + 0xE68B=>0xE4C6, + 0xE68C=>0xE50C, + 0xE68D=>0xEAA5, + 0xE68E=>0xE5A1, + 0xE68F=>0xE5A2, + 0xE690=>0xE5A3, + 0xE691=>0xE5A4, + 0xE692=>0xE5A5, + 0xE693=>0xEB83, + 0xE694=>0xE5A6, + 0xE695=>0xE5A7, + 0xE696=>0xE54D, + 0xE697=>0xE54C, + 0xE698=>0xEB2A, + 0xE699=>0xEB2B, + 0xE69A=>0xE4FE, + 0xE69B=>0xE47F, + 0xE69C=>0xE5A8, + 0xE69D=>0xE5A9, + 0xE69E=>0xE5AA, + 0xE69F=>0xE486, + 0xE6A0=>'○', + 0xE6A1=>0xE4E1, + 0xE6A2=>0xE4DB, + 0xE6A3=>0xE4B4, + 0xE6A4=>0xE4C9, + 0xE6A5=>0xE556, + 0xE6CE=>0xEB08, + 0xE6CF=>0xEB62, + 0xE6D0=>0xE520, + 0xE6D1=>'[iモード]', + 0xE6D2=>'[iモード]', + 0xE6D3=>0xE521, + 0xE6D4=>'[ドコモ]', + 0xE6D5=>'[ドコモポイント]', + 0xE6D6=>0xE57D, + 0xE6D7=>0xE578, + 0xE6D8=>0xEA88, + 0xE6D9=>0xE519, + 0xE6DA=>0xE55D, + 0xE6DB=>0xE5AB, + 0xE6DC=>0xE518, + 0xE6DD=>0xE5B5, + 0xE6DE=>0xEB2C, + 0xE6DF=>'[フリーダイヤル]', + 0xE6E0=>0xEB84, + 0xE6E1=>0xE52C, + 0xE6E2=>0xE522, + 0xE6E3=>0xE523, + 0xE6E4=>0xE524, + 0xE6E5=>0xE525, + 0xE6E6=>0xE526, + 0xE6E7=>0xE527, + 0xE6E8=>0xE528, + 0xE6E9=>0xE529, + 0xE6EA=>0xE52A, + 0xE6EB=>0xE5AC, + 0xE70B=>0xE5AD, + 0xE6EC=>0xE595, + 0xE6ED=>0xEB75, + 0xE6EE=>0xE477, + 0xE6EF=>0xE478, + 0xE6F0=>0xE471, + 0xE6F1=>0xE472, + 0xE6F2=>0xEAC0, + 0xE6F3=>0xEAC3, + 0xE6F4=>0xE5AE, + 0xE6F5=>0xEB2D, + 0xE6F6=>0xE5BE, + 0xE6F7=>0xE4BC, + 0xE6F9=>0xE4EB, + 0xE6FA=>0xEAAB, + 0xE6FB=>0xE476, + 0xE6FC=>0xE4E5, + 0xE6FD=>0xE4F3, + 0xE6FE=>0xE47A, + 0xE6FF=>0xE505, + 0xE700=>0xEB2E, + 0xE701=>0xE475, + 0xE702=>0xE482, + 0xE703=>0xEB2F, + 0xE704=>0xEB30, + 0xE705=>0xE5B0, + 0xE706=>0xE5B1, + 0xE707=>0xE4E6, + 0xE708=>0xE4F4, + 0xE70A=>0xEB31, + 0xE6AC=>0xE4BE, + 0xE6AD=>'[ふくろ]', + 0xE6AE=>0xEB03, + 0xE6B2=>'[いす]', + 0xE6B3=>0xEAF1, + 0xE6B7=>'[SOON]', + 0xE6B8=>'[ON]', + 0xE6B9=>'[end]', + 0xE6BA=>0xE594, + 0xE70C=>'[iアプリ]', + 0xE70D=>'[iアプリ]', + 0xE70E=>0xE5B6, + 0xE70F=>0xE504, + 0xE710=>0xE509, + 0xE711=>0xEB77, + 0xE712=>0xE4B8, + 0xE713=>0xE512, + 0xE714=>'[ドア]', + 0xE715=>0xE4C7, + 0xE716=>0xE5B8, + 0xE717=>0xEB78, + 0xE718=>0xE587, + 0xE719=>0xE4A1, + 0xE71A=>0xE5C9, + 0xE71B=>0xE514, + 0xE71C=>0xE47C, + 0xE71D=>0xE4AE, + 0xE71E=>0xEAAE, + 0xE71F=>0xE57A, + 0xE720=>0xEAC0, + 0xE721=>0xEAC5, + 0xE722=>'%e257%%e330%', + 0xE723=>0xE5C6, + 0xE724=>0xEB5D, + 0xE725=>0xEAC9, + 0xE726=>0xE5C4, + 0xE727=>0xE4F9, + 0xE728=>0xE4E7, + 0xE729=>0xE5C3, + 0xE72A=>0xEAC5, + 0xE72B=>0xEAC2, + 0xE72C=>0xEABF, + 0xE72D=>0xE473, + 0xE72E=>0xEB69, + 0xE72F=>'[NG]', + 0xE730=>0xE4A0, + 0xE731=>0xE558, + 0xE732=>0xE54E, + 0xE733=>0xE46B, + 0xE734=>0xE4F1, + 0xE735=>0xEB79, + 0xE736=>0xE559, + 0xE737=>0xE481, + 0xE738=>'[禁]', + 0xE739=>0xEA8A, + 0xE73A=>'[合]', + 0xE73B=>0xEA89, + 0xE73C=>0xEB7A, + 0xE73D=>0xEB7B, + 0xE73E=>0xEA80, + 0xE73F=>0xEB7C, + 0xE740=>0xE5BD, + 0xE741=>0xE513, + 0xE742=>0xE4D2, + 0xE743=>0xE4E4, + 0xE744=>0xEB35, + 0xE745=>0xEAB9, + 0xE746=>0xEB7D, + 0xE747=>0xE4CE, + 0xE748=>0xE4CA, + 0xE749=>0xE4D5, + 0xE74A=>0xE4D0, + 0xE74B=>0xEA97, + 0xE74C=>0xE5B4, + 0xE74D=>0xEAAF, + 0xE74E=>0xEB7E, + 0xE74F=>0xE4E0, + 0xE750=>0xE4DC, + 0xE751=>0xE49A, + 0xE752=>0xEACD, + 0xE753=>0xEB80, + 0xE754=>0xE4D8, + 0xE755=>0xE4DE, + 0xE756=>0xE4C1, + 0xE757=>0xE5C5, + 0xE481=>0xE481, + 0xE482=>0xE482, + 0xE483=>0xE483, + 0xE52C=>0xE52C, + 0xE52D=>0xE52D, + 0xE52E=>0xE52E, + 0xE52F=>0xE52F, + 0xE530=>0xE530, + 0xE531=>0xE531, + 0xE532=>0xE532, + 0xE533=>0xE533, + 0xE4C1=>0xE4C1, + 0xE511=>0xE511, + 0xE579=>0xE579, + 0xE486=>0xE486, + 0xE487=>0xE487, + 0xE534=>0xE534, + 0xE535=>0xE535, + 0xE536=>0xE536, + 0xE537=>0xE537, + 0xE538=>0xE538, + 0xE539=>0xE539, + 0xE53A=>0xE53A, + 0xE53B=>0xE53B, + 0xE57A=>0xE57A, + 0xE53C=>0xE53C, + 0xE53D=>0xE53D, + 0xE53E=>0xE53E, + 0xE53F=>0xE53F, + 0xE540=>0xE540, + 0xE541=>0xE541, + 0xE542=>0xE542, + 0xE543=>0xE543, + 0xE544=>0xE544, + 0xE545=>0xE545, + 0xE546=>0xE546, + 0xE547=>0xE547, + 0xE548=>0xE548, + 0xE549=>0xE549, + 0xE54A=>0xE54A, + 0xE54B=>0xE54B, + 0xE54C=>0xE54C, + 0xE54D=>0xE54D, + 0xE488=>0xE488, + 0xE4BA=>0xE4BA, + 0xE594=>0xE594, + 0xE489=>0xE489, + 0xE512=>0xE512, + 0xE560=>0xE560, + 0xE4FA=>0xE4FA, + 0xE595=>0xE595, + 0xE4C2=>0xE4C2, + 0xE513=>0xE513, + 0xE54E=>0xE54E, + 0xE54F=>0xE54F, + 0xE561=>0xE561, + 0xE57B=>0xE57B, + 0xE47C=>0xE47C, + 0xE562=>0xE562, + 0xE48A=>0xE48A, + 0xE550=>0xE550, + 0xE551=>0xE551, + 0xE552=>0xE552, + 0xE553=>0xE553, + 0xE4C3=>0xE4C3, + 0xE554=>0xE554, + 0xE563=>0xE563, + 0xE4FB=>0xE4FB, + 0xE48B=>0xE48B, + 0xE555=>0xE555, + 0xE556=>0xE556, + 0xE514=>0xE514, + 0xE557=>0xE557, + 0xE4DF=>0xE4DF, + 0xE468=>0xE468, + 0xE46C=>0xE46C, + 0xE476=>0xE476, + 0xE4E0=>0xE4E0, + 0xE58F=>0xE58F, + 0xE4FC=>0xE4FC, + 0xE558=>0xE558, + 0xE559=>0xE559, + 0xE49C=>0xE49C, + 0xE590=>0xE590, + 0xE596=>0xE596, + 0xE4FD=>0xE4FD, + 0xE57C=>0xE57C, + 0xE55A=>0xE55A, + 0xE55B=>0xE55B, + 0xE573=>0xE573, + 0xE49D=>0xE49D, + 0xE564=>0xE564, + 0xE597=>0xE597, + 0xE515=>0xE515, + 0xE48C=>0xE48C, + 0xE4BB=>0xE4BB, + 0xE565=>0xE565, + 0xE484=>0xE484, + 0xE46A=>0xE46A, + 0xE566=>0xE566, + 0xE567=>0xE567, + 0xE568=>0xE568, + 0xE569=>0xE569, + 0xE516=>0xE516, + 0xE56A=>0xE56A, + 0xE49E=>0xE49E, + 0xE48D=>0xE48D, + 0xE521=>0xE521, + 0xE57D=>0xE57D, + 0xE517=>0xE517, + 0xE57E=>0xE57E, + 0xE4AB=>0xE4AB, + 0xE4E4=>0xE4E4, + 0xE57F=>0xE57F, + 0xE580=>0xE580, + 0xE4FE=>0xE4FE, + 0xE55C=>0xE55C, + 0xE55D=>0xE55D, + 0xE518=>0xE518, + 0xE519=>0xE519, + 0xE56B=>0xE56B, + 0xE49F=>0xE49F, + 0xE581=>0xE581, + 0xE51A=>0xE51A, + 0xE4B1=>0xE4B1, + 0xE582=>0xE582, + 0xE574=>0xE574, + 0xE575=>0xE575, + 0xE51B=>0xE51B, + 0xE583=>0xE583, + 0xE56C=>0xE56C, + 0xE55E=>0xE55E, + 0xE4CE=>0xE4CE, + 0xE4E1=>0xE4E1, + 0xE584=>0xE584, + 0xE55F=>0xE55F, + 0xE56D=>0xE56D, + 0xE51C=>0xE51C, + 0xE585=>0xE585, + 0xE4FF=>0xE4FF, + 0xE500=>0xE500, + 0xE56E=>0xE56E, + 0xE4A0=>0xE4A0, + 0xE4CF=>0xE4CF, + 0xE51D=>0xE51D, + 0xE4AC=>0xE4AC, + 0xE56F=>0xE56F, + 0xE4B2=>0xE4B2, + 0xE4A1=>0xE4A1, + 0xE586=>0xE586, + 0xE591=>0xE591, + 0xE587=>0xE587, + 0xE592=>0xE592, + 0xE593=>0xE593, + 0xE51E=>0xE51E, + 0xE4AD=>0xE4AD, + 0xE570=>0xE570, + 0xE4A2=>0xE4A2, + 0xE576=>0xE576, + 0xE4C4=>0xE4C4, + 0xE588=>0xE588, + 0xE589=>0xE589, + 0xE501=>0xE501, + 0xE58A=>0xE58A, + 0xE51F=>0xE51F, + 0xE520=>0xE520, + 0xE48E=>0xE48E, + 0xE4B3=>0xE4B3, + 0xE4B4=>0xE4B4, + 0xE4C8=>0xE4C8, + 0xE58B=>0xE58B, + 0xE4B5=>0xE4B5, + 0xE58C=>0xE58C, + 0xE58D=>0xE58D, + 0xE58E=>0xE58E, + 0xE47D=>0xE47D, + 0xE47E=>0xE47E, + 0xE47F=>0xE47F, + 0xE480=>0xE480, + 0xE522=>0xE522, + 0xE523=>0xE523, + 0xE524=>0xE524, + 0xE525=>0xE525, + 0xE526=>0xE526, + 0xE527=>0xE527, + 0xE528=>0xE528, + 0xE529=>0xE529, + 0xE52A=>0xE52A, + 0xE52B=>0xE52B, + 0xE469=>0xE469, + 0xE485=>0xE485, + 0xE48F=>0xE48F, + 0xE490=>0xE490, + 0xE491=>0xE491, + 0xE492=>0xE492, + 0xE493=>0xE493, + 0xE494=>0xE494, + 0xE495=>0xE495, + 0xE496=>0xE496, + 0xE497=>0xE497, + 0xE498=>0xE498, + 0xE499=>0xE499, + 0xE49A=>0xE49A, + 0xE49B=>0xE49B, + 0xE4A3=>0xE4A3, + 0xE4A4=>0xE4A4, + 0xE4A5=>0xE4A5, + 0xE4A6=>0xE4A6, + 0xE4A7=>0xE4A7, + 0xE4A8=>0xE4A8, + 0xE4A9=>0xE4A9, + 0xE4AA=>0xE4AA, + 0xE571=>0xE571, + 0xE572=>0xE572, + 0xE4AE=>0xE4AE, + 0xE4AF=>0xE4AF, + 0xE4B0=>0xE4B0, + 0xE46B=>0xE46B, + 0xE4B6=>0xE4B6, + 0xE4B7=>0xE4B7, + 0xE4B8=>0xE4B8, + 0xE4B9=>0xE4B9, + 0xE46D=>0xE46D, + 0xE4BC=>0xE4BC, + 0xE4BD=>0xE4BD, + 0xE4BE=>0xE4BE, + 0xE4BF=>0xE4BF, + 0xE4C0=>0xE4C0, + 0xE46E=>0xE46E, + 0xE46F=>0xE46F, + 0xE4C5=>0xE4C5, + 0xE4C6=>0xE4C6, + 0xE4C7=>0xE4C7, + 0xE4C9=>0xE4C9, + 0xE4CA=>0xE4CA, + 0xE4CB=>0xE4CB, + 0xE4CC=>0xE4CC, + 0xE4CD=>0xE4CD, + 0xE4D0=>0xE4D0, + 0xE4D1=>0xE4D1, + 0xE4D2=>0xE4D2, + 0xE4D3=>0xE4D3, + 0xE4D4=>0xE4D4, + 0xE4D5=>0xE4D5, + 0xE4D6=>0xE4D6, + 0xE470=>0xE470, + 0xE4D7=>0xE4D7, + 0xE4D8=>0xE4D8, + 0xE4D9=>0xE4D9, + 0xE4DA=>0xE4DA, + 0xE4DB=>0xE4DB, + 0xE4DC=>0xE4DC, + 0xE4DD=>0xE4DD, + 0xE4DE=>0xE4DE, + 0xE4E2=>0xE4E2, + 0xE4E3=>0xE4E3, + 0xE471=>0xE471, + 0xE472=>0xE472, + 0xE473=>0xE473, + 0xE474=>0xE474, + 0xE475=>0xE475, + 0xE4E5=>0xE4E5, + 0xE4E6=>0xE4E6, + 0xE4E7=>0xE4E7, + 0xE477=>0xE477, + 0xE478=>0xE478, + 0xE479=>0xE479, + 0xE47A=>0xE47A, + 0xE47B=>0xE47B, + 0xE4E8=>0xE4E8, + 0xE4E9=>0xE4E9, + 0xE4EA=>0xE4EA, + 0xE4EB=>0xE4EB, + 0xE4EC=>0xE4EC, + 0xE4ED=>0xE4ED, + 0xE4EE=>0xE4EE, + 0xE4EF=>0xE4EF, + 0xE4F0=>0xE4F0, + 0xE4F1=>0xE4F1, + 0xE4F2=>0xE4F2, + 0xE4F3=>0xE4F3, + 0xE4F4=>0xE4F4, + 0xE4F5=>0xE4F5, + 0xE4F6=>0xE4F6, + 0xE4F7=>0xE4F7, + 0xE4F8=>0xE4F8, + 0xE4F9=>0xE4F9, + 0xE502=>0xE502, + 0xE503=>0xE503, + 0xE504=>0xE504, + 0xE505=>0xE505, + 0xE506=>0xE506, + 0xE507=>0xE507, + 0xE508=>0xE508, + 0xE509=>0xE509, + 0xE50A=>0xE50A, + 0xE50B=>0xE50B, + 0xE577=>0xE577, + 0xE578=>0xE578, + 0xE50C=>0xE50C, + 0xE50D=>0xE50D, + 0xE50E=>0xE50E, + 0xE50F=>0xE50F, + 0xE510=>0xE510, + 0xE598=>0xE598, + 0xE599=>0xE599, + 0xE59A=>0xE59A, + 0xE59B=>0xE59B, + 0xE59C=>0xE59C, + 0xE59D=>0xE59D, + 0xE59E=>0xE59E, + 0xE59F=>0xE59F, + 0xE5A0=>0xE5A0, + 0xE5A1=>0xE5A1, + 0xE5A2=>0xE5A2, + 0xE5A3=>0xE5A3, + 0xE5A4=>0xE5A4, + 0xE5A5=>0xE5A5, + 0xE5A6=>0xE5A6, + 0xE5A7=>0xE5A7, + 0xE5A8=>0xE5A8, + 0xE5A9=>0xE5A9, + 0xE5AA=>0xE5AA, + 0xE5AB=>0xE5AB, + 0xE5AC=>0xE5AC, + 0xE5AD=>0xE5AD, + 0xE5AE=>0xE5AE, + 0xE5AF=>0xE5AF, + 0xE5B0=>0xE5B0, + 0xE5B1=>0xE5B1, + 0xE5B2=>0xE5B2, + 0xE5B3=>0xE5B3, + 0xE5B4=>0xE5B4, + 0xE5B5=>0xE5B5, + 0xE5B6=>0xE5B6, + 0xE5B7=>0xE5B7, + 0xE5B8=>0xE5B8, + 0xE5B9=>0xE5B9, + 0xE5BA=>0xE5BA, + 0xE5BB=>0xE5BB, + 0xE5BC=>0xE5BC, + 0xE5BD=>0xE5BD, + 0xE5BE=>0xE5BE, + 0xE5BF=>0xE5BF, + 0xE5C0=>0xE5C0, + 0xE5C1=>0xE5C1, + 0xE5C2=>0xE5C2, + 0xE5C3=>0xE5C3, + 0xE5C4=>0xE5C4, + 0xE5C5=>0xE5C5, + 0xE5C6=>0xE5C6, + 0xE5C7=>0xE5C7, + 0xE5C8=>0xE5C8, + 0xE5C9=>0xE5C9, + 0xE5CA=>0xE5CA, + 0xE5CB=>0xE5CB, + 0xE5CC=>0xE5CC, + 0xE5CD=>0xE5CD, + 0xE5CE=>0xE5CE, + 0xE5CF=>0xE5CF, + 0xE5D0=>0xE5D0, + 0xE5D1=>0xE5D1, + 0xE5D2=>0xE5D2, + 0xE5D3=>0xE5D3, + 0xE5D4=>0xE5D4, + 0xE5D5=>0xE5D5, + 0xE5D6=>0xE5D6, + 0xE5D7=>0xE5D7, + 0xE5D8=>0xE5D8, + 0xE5D9=>0xE5D9, + 0xE5DA=>0xE5DA, + 0xE5DB=>0xE5DB, + 0xE5DC=>0xE5DC, + 0xE5DD=>0xE5DD, + 0xE5DE=>0xE5DE, + 0xE5DF=>0xE5DF, + 0xEA80=>0xEA80, + 0xEA81=>0xEA81, + 0xEA82=>0xEA82, + 0xEA83=>0xEA83, + 0xEA84=>0xEA84, + 0xEA85=>0xEA85, + 0xEA86=>0xEA86, + 0xEA87=>0xEA87, + 0xEA88=>0xEA88, + 0xEA89=>0xEA89, + 0xEA8A=>0xEA8A, + 0xEA8B=>0xEA8B, + 0xEA8C=>0xEA8C, + 0xEA8D=>0xEA8D, + 0xEA8E=>0xEA8E, + 0xEA8F=>0xEA8F, + 0xEA90=>0xEA90, + 0xEA91=>0xEA91, + 0xEA92=>0xEA92, + 0xEA93=>0xEA93, + 0xEA94=>0xEA94, + 0xEA95=>0xEA95, + 0xEA96=>0xEA96, + 0xEA97=>0xEA97, + 0xEA98=>0xEA98, + 0xEA99=>0xEA99, + 0xEA9A=>0xEA9A, + 0xEA9B=>0xEA9B, + 0xEA9C=>0xEA9C, + 0xEA9D=>0xEA9D, + 0xEA9E=>0xEA9E, + 0xEA9F=>0xEA9F, + 0xEAA0=>0xEAA0, + 0xEAA1=>0xEAA1, + 0xEAA2=>0xEAA2, + 0xEAA3=>0xEAA3, + 0xEAA4=>0xEAA4, + 0xEAA5=>0xEAA5, + 0xEAA6=>0xEAA6, + 0xEAA7=>0xEAA7, + 0xEAA8=>0xEAA8, + 0xEAA9=>0xEAA9, + 0xEAAA=>0xEAAA, + 0xEAAB=>0xEAAB, + 0xEAAC=>0xEAAC, + 0xEAAD=>0xEAAD, + 0xEAAE=>0xEAAE, + 0xEAAF=>0xEAAF, + 0xEAB0=>0xEAB0, + 0xEAB1=>0xEAB1, + 0xEAB2=>0xEAB2, + 0xEAB3=>0xEAB3, + 0xEAB4=>0xEAB4, + 0xEAB5=>0xEAB5, + 0xEAB6=>0xEAB6, + 0xEAB7=>0xEAB7, + 0xEAB8=>0xEAB8, + 0xEAB9=>0xEAB9, + 0xEABA=>0xEABA, + 0xEABB=>0xEABB, + 0xEABC=>0xEABC, + 0xEABD=>0xEABD, + 0xEABE=>0xEABE, + 0xEABF=>0xEABF, + 0xEAC0=>0xEAC0, + 0xEAC1=>0xEAC1, + 0xEAC2=>0xEAC2, + 0xEAC3=>0xEAC3, + 0xEAC4=>0xEAC4, + 0xEAC5=>0xEAC5, + 0xEAC6=>0xEAC6, + 0xEAC7=>0xEAC7, + 0xEAC8=>0xEAC8, + 0xEAC9=>0xEAC9, + 0xEACA=>0xEACA, + 0xEACB=>0xEACB, + 0xEACC=>0xEACC, + 0xEACD=>0xEACD, + 0xEACE=>0xEACE, + 0xEACF=>0xEACF, + 0xEAD0=>0xEAD0, + 0xEAD1=>0xEAD1, + 0xEAD2=>0xEAD2, + 0xEAD3=>0xEAD3, + 0xEAD4=>0xEAD4, + 0xEAD5=>0xEAD5, + 0xEAD6=>0xEAD6, + 0xEAD7=>0xEAD7, + 0xEAD8=>0xEAD8, + 0xEAD9=>0xEAD9, + 0xEADA=>0xEADA, + 0xEADB=>0xEADB, + 0xEADC=>0xEADC, + 0xEADD=>0xEADD, + 0xEADE=>0xEADE, + 0xEADF=>0xEADF, + 0xEAE0=>0xEAE0, + 0xEAE1=>0xEAE1, + 0xEAE2=>0xEAE2, + 0xEAE3=>0xEAE3, + 0xEAE4=>0xEAE4, + 0xEAE5=>0xEAE5, + 0xEAE6=>0xEAE6, + 0xEAE7=>0xEAE7, + 0xEAE8=>0xEAE8, + 0xEAE9=>0xEAE9, + 0xEAEA=>0xEAEA, + 0xEAEB=>0xEAEB, + 0xEAEC=>0xEAEC, + 0xEAED=>0xEAED, + 0xEAEE=>0xEAEE, + 0xEAEF=>0xEAEF, + 0xEAF0=>0xEAF0, + 0xEAF1=>0xEAF1, + 0xEAF2=>0xEAF2, + 0xEAF3=>0xEAF3, + 0xEAF4=>0xEAF4, + 0xEAF5=>0xEAF5, + 0xEAF6=>0xEAF6, + 0xEAF7=>0xEAF7, + 0xEAF8=>0xEAF8, + 0xEAF9=>0xEAF9, + 0xEAFA=>0xEAFA, + 0xEAFB=>0xEAFB, + 0xEAFC=>0xEAFC, + 0xEAFD=>0xEAFD, + 0xEAFE=>0xEAFE, + 0xEAFF=>0xEAFF, + 0xEB00=>0xEB00, + 0xEB01=>0xEB01, + 0xEB02=>0xEB02, + 0xEB03=>0xEB03, + 0xEB04=>0xEB04, + 0xEB05=>0xEB05, + 0xEB06=>0xEB06, + 0xEB07=>0xEB07, + 0xEB08=>0xEB08, + 0xEB09=>0xEB09, + 0xEB0A=>0xEB0A, + 0xEB0B=>0xEB0B, + 0xEB0C=>0xEB0C, + 0xEB0D=>0xEB0D, + 0xEB0E=>0xEB0E, + 0xEB0F=>0xEB0F, + 0xEB10=>0xEB10, + 0xEB11=>0xEB11, + 0xEB12=>0xEB12, + 0xEB13=>0xEB13, + 0xEB14=>0xEB14, + 0xEB15=>0xEB15, + 0xEB16=>0xEB16, + 0xEB17=>0xEB17, + 0xEB18=>0xEB18, + 0xEB19=>0xEB19, + 0xEB1A=>0xEB1A, + 0xEB1B=>0xEB1B, + 0xEB1C=>0xEB1C, + 0xEB1D=>0xEB1D, + 0xEB1E=>0xEB1E, + 0xEB1F=>0xEB1F, + 0xEB20=>0xEB20, + 0xEB21=>0xEB21, + 0xEB22=>0xEB22, + 0xEB23=>0xEB23, + 0xEB24=>0xEB24, + 0xEB25=>0xEB25, + 0xEB26=>0xEB26, + 0xEB27=>0xEB27, + 0xEB28=>0xEB28, + 0xEB29=>0xEB29, + 0xEB2A=>0xEB2A, + 0xEB2B=>0xEB2B, + 0xEB2C=>0xEB2C, + 0xEB2D=>0xEB2D, + 0xEB2E=>0xEB2E, + 0xEB2F=>0xEB2F, + 0xEB30=>0xEB30, + 0xEB31=>0xEB31, + 0xEB32=>0xEB32, + 0xEB33=>0xEB33, + 0xEB34=>0xEB34, + 0xEB35=>0xEB35, + 0xEB36=>0xEB36, + 0xEB37=>0xEB37, + 0xEB38=>0xEB38, + 0xEB39=>0xEB39, + 0xEB3A=>0xEB3A, + 0xEB3B=>0xEB3B, + 0xEB3C=>0xEB3C, + 0xEB3D=>0xEB3D, + 0xEB3E=>0xEB3E, + 0xEB3F=>0xEB3F, + 0xEB40=>0xEB40, + 0xEB41=>0xEB41, + 0xEB42=>0xEB42, + 0xEB43=>0xEB43, + 0xEB44=>0xEB44, + 0xEB45=>0xEB45, + 0xEB46=>0xEB46, + 0xEB47=>0xEB47, + 0xEB48=>0xEB48, + 0xEB49=>0xEB49, + 0xEB4A=>0xEB4A, + 0xEB4B=>0xEB4B, + 0xEB4C=>0xEB4C, + 0xEB4D=>0xEB4D, + 0xEB4E=>0xEB4E, + 0xEB4F=>0xEB4F, + 0xEB50=>0xEB50, + 0xEB51=>0xEB51, + 0xEB52=>0xEB52, + 0xEB53=>0xEB53, + 0xEB54=>0xEB54, + 0xEB55=>0xEB55, + 0xEB56=>0xEB56, + 0xEB57=>0xEB57, + 0xEB58=>0xEB58, + 0xEB59=>0xEB59, + 0xEB5A=>0xEB5A, + 0xEB5B=>0xEB5B, + 0xEB5C=>0xEB5C, + 0xEB5D=>0xEB5D, + 0xEB5E=>0xEB5E, + 0xEB5F=>0xEB5F, + 0xEB60=>0xEB60, + 0xEB61=>0xEB61, + 0xEB62=>0xEB62, + 0xEB63=>0xEB63, + 0xEB64=>0xEB64, + 0xEB65=>0xEB65, + 0xEB66=>0xEB66, + 0xEB67=>0xEB67, + 0xEB68=>0xEB68, + 0xEB69=>0xEB69, + 0xEB6A=>0xEB6A, + 0xEB6B=>0xEB6B, + 0xEB6C=>0xEB6C, + 0xEB6D=>0xEB6D, + 0xEB6E=>0xEB6E, + 0xEB6F=>0xEB6F, + 0xEB70=>0xEB70, + 0xEB71=>0xEB71, + 0xEB72=>0xEB72, + 0xEB73=>0xEB73, + 0xEB74=>0xEB74, + 0xEB75=>0xEB75, + 0xEB76=>0xEB76, + 0xEB77=>0xEB77, + 0xEB78=>0xEB78, + 0xEB79=>0xEB79, + 0xEB7A=>0xEB7A, + 0xEB7B=>0xEB7B, + 0xEB7C=>0xEB7C, + 0xEB7D=>0xEB7D, + 0xEB7E=>0xEB7E, + 0xEB7F=>0xEB7F, + 0xEB80=>0xEB80, + 0xEB81=>0xEB81, + 0xEB82=>0xEB82, + 0xEB83=>0xEB83, + 0xEB84=>0xEB84, + 0xEB85=>0xEB85, + 0xEB86=>0xEB86, + 0xEB87=>0xEB87, + 0xEB88=>0xEB88, + 0xF001=>0xE4FC, + 0xF002=>0xE4FA, + 0xF003=>0xE4EB, + 0xF004=>0xE4FC, + 0xF005=>0xE4FA, + 0xF006=>0xE5B6, + 0xF007=>0xE5B7, + 0xF008=>0xE515, + 0xF009=>0xE596, + 0xF00A=>0xE588, + 0xF00B=>0xE520, + 0xF00C=>0xE5B8, + 0xF00D=>0xE4F3, + 0xF00E=>0xE4F9, + 0xF00F=>0xE4F6, + 0xF010=>0xEB83, + 0xF011=>0xE5A6, + 0xF012=>0xE5A7, + 0xF013=>0xEAAC, + 0xF014=>0xE599, + 0xF015=>0xE4B7, + 0xF016=>0xE4BA, + 0xF017=>0xEB41, + 0xF018=>0xE4B6, + 0xF019=>0xE49A, + 0xF01A=>0xE4D8, + 0xF01B=>0xE4B1, + 0xF01C=>0xE4B4, + 0xF01D=>0xE4B3, + 0xF01E=>0xE4B5, + 0xF01F=>0xE4B0, + 0xF020=>0xE483, + 0xF021=>0xE482, + 0xF022=>0xE595, + 0xF023=>0xE477, + 0xF024=>0xE594, + 0xF025=>0xE594, + 0xF026=>0xE594, + 0xF027=>0xE594, + 0xF028=>0xE594, + 0xF029=>0xE594, + 0xF02A=>0xE594, + 0xF02B=>0xE594, + 0xF02C=>0xE594, + 0xF02D=>0xE594, + 0xF02E=>0xE594, + 0xF02F=>0xE594, + 0xF030=>0xE4CA, + 0xF031=>0xE5C9, + 0xF032=>0xE5BA, + 0xF033=>0xE4C9, + 0xF034=>0xE514, + 0xF035=>0xE514, + 0xF036=>0xE4AB, + 0xF037=>0xE5BB, + 0xF038=>0xE4AD, + 0xF039=>0xEB6D, + 0xF03A=>0xE571, + 0xF03B=>0xE5BD, + 0xF03C=>0xE503, + 0xF03D=>0xE517, + 0xF03E=>0xE5BE, + 0xF03F=>0xE519, + 0xF041=>0xE506, + 0xF042=>0xEADC, + 0xF043=>0xE4AC, + 0xF044=>0xE4C2, + 0xF045=>0xE597, + 0xF046=>0xE4D0, + 0xF047=>0xE4C3, + 0xF048=>0xE485, + 0xF049=>0xE48D, + 0xF04A=>0xE488, + 0xF04B=>0xE48C, + 0xF04C=>0xE486, + 0xF04D=>0xEAF4, + 0xF04E=>0xE5BF, + 0xF04F=>0xE4DB, + 0xF050=>0xE5C0, + 0xF051=>0xE5C1, + 0xF052=>0xE4E1, + 0xF053=>0xE5C2, + 0xF054=>0xE470, + 0xF055=>0xE4DC, + 0xF056=>0xEACD, + 0xF057=>0xE471, + 0xF058=>0xEAC3, + 0xF059=>0xE472, + 0xF05A=>0xE4F5, + 0xF101=>0xE51B, + 0xF102=>0xE51B, + 0xF103=>0xEB62, + 0xF104=>0xEB08, + 0xF105=>0xE4E7, + 0xF106=>0xE5C4, + 0xF107=>0xE5C5, + 0xF108=>0xE5C6, + 0xF109=>0xE4D9, + 0xF10A=>0xE5C7, + 0xF10B=>0xE4DE, + 0xF10C=>0xE4EC, + 0xF10D=>0xE5C8, + 0xF10E=>0xE5C9, + 0xF10F=>0xE476, + 0xF110=>0xE513, + 0xF111=>0xE5CA, + 0xF112=>0xE4CF, + 0xF113=>0xE50A, + 0xF114=>0xE518, + 0xF115=>0xE46B, + 0xF116=>0xE5CB, + 0xF117=>0xE5CC, + 0xF118=>0xE4CE, + 0xF119=>0xE5CD, + 0xF11A=>0xE4EF, + 0xF11B=>0xE4CB, + 0xF11C=>0xE4F8, + 0xF11D=>0xE47B, + 0xF11E=>0xE5CE, + 0xF120=>0xE4D6, + 0xF121=>0xE5CF, + 0xF122=>0xE5D0, + 0xF123=>0xE4BC, + 0xF124=>0xE46D, + 0xF125=>0xE49E, + 0xF126=>0xE50C, + 0xF127=>0xE50C, + 0xF128=>0xE5B9, + 0xF129=>0xE580, + 0xF12A=>0xE502, + 0xF12B=>0xE4EC, + 0xF12D=>0xE5D1, + 0xF12E=>0xE5D2, + 0xF12F=>0xE4C7, + 0xF130=>0xE4C5, + 0xF131=>0xE5D3, + 0xF132=>0xE4B9, + 0xF133=>0xE46E, + 0xF134=>0xE4D8, + 0xF135=>0xE4B4, + 0xF136=>0xE4AE, + 0xF137=>0xE5D7, + 0xF138=>'[♂]', + 0xF139=>'[♀]', + 0xF13A=>0xEB18, + 0xF13B=>0xE510, + 0xF13C=>0xE475, + 0xF13D=>0xE487, + 0xF13E=>0xE51A, + 0xF13F=>0xE5D8, + 0xF140=>0xE4A5, + 0xF141=>0xE511, + 0xF142=>0xE511, + 0xF143=>0xE5D9, + 0xF144=>0xE51C, + 0xF145=>0xE51C, + 0xF146=>0xE5DA, + 0xF147=>0xE4D1, + 0xF148=>0xE49F, + 0xF149=>'[$\]', + 0xF14A=>0xE5DC, + 0xF14B=>0xE4A8, + 0xF14C=>0xE4E9, + 0xF14D=>0xE4AA, + 0xF14E=>0xE46A, + 0xF14F=>0xE4A6, + 0xF150=>0xE4A7, + 0xF151=>0xE4A5, + 0xF152=>0xE5DD, + 0xF153=>0xE5DE, + 0xF154=>0xE4A3, + 0xF155=>0xE5DF, + 0xF156=>0xE4A4, + 0xF157=>0xEA80, + 0xF158=>0xEA81, + 0xF159=>0xE4AF, + 0xF15A=>0xE4B1, + 0xF201=>0xEB72, + 0xF202=>0xEA82, + 0xF203=>'[ココ]', + 0xF204=>0xE595, + 0xF205=>0xE479, + 0xF206=>0xE53E, + 0xF207=>0xEA83, + 0xF208=>0xE47E, + 0xF209=>0xE480, + 0xF20A=>0xE47F, + 0xF20B=>0xEA84, + 0xF20C=>0xEAA5, + 0xF20D=>0xE5A2, + 0xF20E=>0xE5A1, + 0xF20F=>0xE5A3, + 0xF210=>0xEB84, + 0xF212=>0xE5B5, + 0xF213=>0xE50F, + 0xF214=>0xEA85, + 0xF215=>'[有]', + 0xF216=>'[無]', + 0xF217=>'[月]', + 0xF218=>'[申]', + 0xF219=>0xE54A, + 0xF21A=>0xE54B, + 0xF21B=>0xE54B, + 0xF21C=>0xE522, + 0xF21D=>0xE523, + 0xF21E=>0xE524, + 0xF21F=>0xE525, + 0xF220=>0xE526, + 0xF221=>0xE527, + 0xF222=>0xE528, + 0xF223=>0xE529, + 0xF224=>0xE52A, + 0xF225=>0xE5AC, + 0xF226=>0xE4F7, + 0xF227=>0xEA86, + 0xF228=>0xEA87, + 0xF229=>0xEA88, + 0xF22A=>0xEA89, + 0xF22B=>0xEA8A, + 0xF22C=>0xEA8B, + 0xF22D=>0xEA8C, + 0xF22E=>0xEA8D, + 0xF22F=>0xEA8E, + 0xF230=>0xE4FF, + 0xF231=>0xE500, + 0xF232=>0xE53F, + 0xF233=>0xE540, + 0xF234=>0xE552, + 0xF235=>0xE553, + 0xF236=>0xE555, + 0xF237=>0xE54C, + 0xF238=>0xE54D, + 0xF239=>0xE556, + 0xF23A=>0xE52E, + 0xF23B=>0xE52D, + 0xF23C=>0xE530, + 0xF23D=>0xE52F, + 0xF23E=>0xEA8F, + 0xF23F=>0xE48F, + 0xF240=>0xE490, + 0xF241=>0xE491, + 0xF242=>0xE492, + 0xF243=>0xE493, + 0xF244=>0xE494, + 0xF245=>0xE495, + 0xF246=>0xE496, + 0xF247=>0xE497, + 0xF248=>0xE498, + 0xF249=>0xE499, + 0xF24A=>0xE49A, + 0xF24B=>0xE49B, + 0xF24C=>'[TOP]', + 0xF24D=>0xE5AD, + 0xF24E=>0xE558, + 0xF24F=>0xE559, + 0xF250=>0xEA90, + 0xF251=>0xEA91, + 0xF252=>0xE481, + 0xF301=>0xEA92, + 0xF302=>0xEA93, + 0xF303=>0xEA94, + 0xF304=>0xE4E4, + 0xF305=>0xE4E3, + 0xF306=>0xEA95, + 0xF307=>0xE4E2, + 0xF308=>0xEA96, + 0xF309=>'[WC]', + 0xF30A=>0xE508, + 0xF30B=>0xEA97, + 0xF30C=>0xEA98, + 0xF30D=>0xEA99, + 0xF30E=>0xE47D, + 0xF30F=>0xEA9A, + 0xF310=>0xEA9B, + 0xF311=>0xE47A, + 0xF312=>0xEA9C, + 0xF313=>0xE516, + 0xF314=>0xE59F, + 0xF315=>0xE4F1, + 0xF316=>0xE582, + 0xF317=>0xE511, + 0xF318=>0xEA9E, + 0xF319=>0xEB6B, + 0xF31A=>0xE51A, + 0xF31B=>0xEA9F, + 0xF31C=>0xE509, + 0xF31D=>0xEAA0, + 0xF31E=>0xE50B, + 0xF31F=>0xEAA1, + 0xF320=>0xEAA2, + 0xF321=>0xEAA3, + 0xF322=>0xEAA4, + 0xF323=>0xE49C, + 0xF324=>0xE4BE, + 0xF325=>0xE512, + 0xF326=>0xE505, + 0xF327=>0xEAA6, + 0xF328=>0xEB75, + 0xF329=>0xE4EA, + 0xF32A=>0xEAA7, + 0xF32B=>0xEAA8, + 0xF32C=>0xEAA9, + 0xF32D=>0xEAAA, + 0xF32E=>0xEAAB, + 0xF32F=>0xE48B, + 0xF330=>0xE4F4, + 0xF331=>0xE5B1, + 0xF332=>0xEAAD, + 0xF333=>0xE550, + 0xF334=>0xE4E5, + 0xF335=>0xE48B, + 0xF336=>0xE483, + 0xF337=>0xE482, + 0xF338=>0xEAAE, + 0xF339=>0xEAAF, + 0xF33A=>0xEAB0, + 0xF33B=>0xEAB1, + 0xF33C=>0xEAB2, + 0xF33D=>0xEAB3, + 0xF33E=>0xEAB4, + 0xF33F=>0xEAB5, + 0xF340=>0xE5B4, + 0xF341=>0xEAB6, + 0xF342=>0xE4D5, + 0xF343=>0xEAB7, + 0xF344=>0xEAB8, + 0xF345=>0xEAB9, + 0xF346=>0xEABA, + 0xF347=>0xE4D4, + 0xF348=>0xE4CD, + 0xF349=>0xEABB, + 0xF34A=>0xEABC, + 0xF34B=>0xE5A0, + 0xF34C=>0xEABD, + 0xF34D=>0xEABE, + 0xF401=>0xE5C6, + 0xF402=>0xEABF, + 0xF403=>0xEAC0, + 0xF404=>0xEAC1, + 0xF405=>0xE5C3, + 0xF406=>0xEAC2, + 0xF407=>0xEAC3, + 0xF408=>0xEAC4, + 0xF409=>0xE4E7, + 0xF40A=>0xEAC5, + 0xF40B=>0xEAC6, + 0xF40C=>0xEAC7, + 0xF40D=>0xEAC8, + 0xF40E=>0xEAC9, + 0xF40F=>0xEAC6, + 0xF410=>0xEACA, + 0xF411=>0xE473, + 0xF412=>0xEB64, + 0xF413=>0xEB69, + 0xF414=>0xEACD, + 0xF415=>0xE471, + 0xF416=>0xEB5D, + 0xF417=>0xEACE, + 0xF418=>0xEACF, + 0xF419=>0xE5A4, + 0xF41A=>0xEAD0, + 0xF41B=>0xE5A5, + 0xF41C=>0xEAD1, + 0xF41D=>0xEAD2, + 0xF41E=>0xEAD6, + 0xF41F=>0xEAD3, + 0xF420=>0xEAD4, + 0xF421=>0xEAD5, + 0xF422=>0xEAD6, + 0xF423=>0xEAD7, + 0xF424=>0xEAD8, + 0xF425=>0xEADA, + 0xF426=>0xEAD9, + 0xF427=>0xEB86, + 0xF429=>0xEADB, + 0xF42A=>0xE59A, + 0xF42B=>0xE4BB, + 0xF42C=>0xEADD, + 0xF42D=>0xEADE, + 0xF42E=>0xE4B1, + 0xF42F=>0xE4B2, + 0xF430=>0xEADF, + 0xF431=>0xEAE0, + 0xF432=>0xEAE1, + 0xF433=>0xEAE2, + 0xF434=>0xE5BC, + 0xF435=>0xE4B0, + 0xF436=>0xEAE3, + 0xF437=>0xEB54, + 0xF438=>0xEAE4, + 0xF439=>0xEAE5, + 0xF43A=>0xEAE6, + 0xF43B=>0xEAE7, + 0xF43C=>0xEAE8, + 0xF43D=>0xE5BB, + 0xF43E=>0xEB7C, + 0xF43F=>0xEAEA, + 0xF440=>0xEAEB, + 0xF441=>0xEAEC, + 0xF442=>0xEAED, + 0xF443=>0xE469, + 0xF445=>0xEAEE, + 0xF446=>0xEAEF, + 0xF447=>0xE5CD, + 0xF448=>0xEAF0, + 0xF449=>0xEAF4, + 0xF44A=>0xE5DA, + 0xF44B=>0xEAF1, + 0xF44C=>0xEAF2, + 0xF501=>0xEAF3, + 0xF502=>0xE59C, + 0xF503=>0xEAF5, + 0xF504=>0xEAF6, + 0xF505=>0xEAF7, + 0xF506=>0xEAF8, + 0xF507=>0xE517, + 0xF508=>0xEAF9, + 0xF509=>0xE4C0, + 0xF50B=>0xE4CC, + 0xF50C=>0xE573, + 0xF50D=>0xEAFA, + 0xF50E=>0xEB0E, + 0xF50F=>0xEB0F, + 0xF510=>0xEB10, + 0xF511=>0xE5D5, + 0xF512=>0xE5D6, + 0xF513=>0xEB11, + 0xF514=>0xEB12, + 0xF515=>0xEB13, + 0xF516=>0xEB14, + 0xF517=>0xEB15, + 0xF518=>0xEB16, + 0xF519=>0xEB17, + 0xF51A=>0xEB18, + 0xF51B=>0xEB19, + 0xF51C=>0xEB1A, + 0xF51F=>0xEB1C, + 0xF520=>0xEB1B, + 0xF521=>0xE4E0, + 0xF522=>0xEB1D, + 0xF523=>0xE4E0, + 0xF525=>0xEB1E, + 0xF526=>0xEB1F, + 0xF527=>0xEB20, + 0xF528=>0xE4D9, + 0xF529=>0xE48F, + 0xF52A=>0xE4E1, + 0xF52B=>0xEB21, + 0xF52C=>0xE4D7, + 0xF52D=>0xEB22, + 0xF52E=>0xEB23, + 0xF52F=>0xEB24, + 0xF530=>0xEB25, + 0xF531=>0xE4DA, + 0xF532=>0xEB26, + 0xF533=>0xEB27, + 0xF534=>0xEB29, + 0xF535=>0xEB28, + 0xF536=>0xEB2A, + 0xF537=>0xE54E, +} +CONVERSION_TABLE_TO_SOFTBANK = { + 0xE63E=>0xF04A, + 0xE63F=>0xF049, + 0xE640=>0xF04B, + 0xE641=>0xF048, + 0xE642=>0xF13D, + 0xE643=>0xF443, + 0xE644=>'[霧]', + 0xE645=>0xF43C, + 0xE646=>0xF23F, + 0xE647=>0xF240, + 0xE648=>0xF241, + 0xE649=>0xF242, + 0xE64A=>0xF243, + 0xE64B=>0xF244, + 0xE64C=>0xF245, + 0xE64D=>0xF246, + 0xE64E=>0xF247, + 0xE64F=>0xF248, + 0xE650=>0xF249, + 0xE651=>0xF24A, + 0xE653=>0xF016, + 0xE654=>0xF014, + 0xE655=>0xF015, + 0xE656=>0xF018, + 0xE657=>0xF013, + 0xE658=>0xF42A, + 0xE659=>0xF132, + 0xE65A=>'[ポケベル]', + 0xE65B=>0xF01E, + 0xE65C=>0xF434, + 0xE65D=>0xF435, + 0xE65E=>0xF01B, + 0xE65F=>0xF42E, + 0xE660=>0xF159, + 0xE661=>0xF202, + 0xE662=>0xF01D, + 0xE663=>0xF036, + 0xE664=>0xF038, + 0xE665=>0xF153, + 0xE666=>0xF155, + 0xE667=>0xF14D, + 0xE668=>0xF154, + 0xE669=>0xF158, + 0xE66A=>0xF156, + 0xE66B=>0xF03A, + 0xE66C=>0xF14F, + 0xE66D=>0xF14E, + 0xE66E=>0xF151, + 0xE66F=>0xF043, + 0xE670=>0xF045, + 0xE671=>0xF044, + 0xE672=>0xF047, + 0xE673=>0xF120, + 0xE674=>0xF13E, + 0xE675=>0xF313, + 0xE676=>0xF03C, + 0xE677=>0xF03D, + 0xE678=>0xF236, + 0xE67A=>0xF30A, + 0xE67B=>0xF502, + 0xE67C=>0xF503, + 0xE67E=>0xF125, + 0xE67F=>0xF30E, + 0xE680=>0xF208, + 0xE681=>0xF008, + 0xE682=>0xF323, + 0xE683=>0xF148, + 0xE684=>0xF314, + 0xE685=>0xF112, + 0xE686=>0xF34B, + 0xE687=>0xF009, + 0xE688=>0xF00A, + 0xE689=>0xF301, + 0xE68A=>0xF12A, + 0xE68B=>'[ゲーム]', + 0xE68C=>0xF126, + 0xE68D=>0xF20C, + 0xE68E=>0xF20E, + 0xE68F=>0xF20D, + 0xE690=>0xF20F, + 0xE691=>0xF419, + 0xE692=>0xF41B, + 0xE693=>0xF010, + 0xE694=>0xF011, + 0xE695=>0xF012, + 0xE696=>0xF238, + 0xE697=>0xF237, + 0xE698=>0xF536, + 0xE699=>0xF007, + 0xE69A=>'[メガネ]', + 0xE69B=>0xF20A, + 0xE69C=>'●', + 0xE69D=>0xF04C, + 0xE69E=>0xF04C, + 0xE69F=>0xF04C, + 0xE6A0=>'○', + 0xE6A1=>0xF052, + 0xE6A2=>0xF04F, + 0xE6A3=>0xF01C, + 0xE6A4=>0xF033, + 0xE6A5=>0xF239, + 0xE6CE=>0xF104, + 0xE6CF=>0xF103, + 0xE6D0=>0xF00B, + 0xE6D1=>'[iモード]', + 0xE6D2=>'[iモード]', + 0xE6D3=>0xF103, + 0xE6D4=>'[ドコモ]', + 0xE6D5=>'[ドコモポイント]', + 0xE6D6=>'ï¿¥', + 0xE6D7=>'[FREE]', + 0xE6D8=>0xF229, + 0xE6D9=>0xF03F, + 0xE6DB=>'[CL]', + 0xE6DC=>0xF114, + 0xE6DD=>0xF212, + 0xE6DF=>0xF211, + 0xE6E0=>0xF210, + 0xE6E1=>'[Q]', + 0xE6E2=>0xF21C, + 0xE6E3=>0xF21D, + 0xE6E4=>0xF21E, + 0xE6E5=>0xF21F, + 0xE6E6=>0xF220, + 0xE6E7=>0xF221, + 0xE6E8=>0xF222, + 0xE6E9=>0xF223, + 0xE6EA=>0xF224, + 0xE6EB=>0xF225, + 0xE70B=>0xF24D, + 0xE6EC=>0xF022, + 0xE6ED=>0xF327, + 0xE6EE=>0xF023, + 0xE6EF=>0xF327, + 0xE6F0=>0xF057, + 0xE6F1=>0xF059, + 0xE6F2=>0xF058, + 0xE6F3=>0xF407, + 0xE6F4=>0xF406, + 0xE6F5=>0xF236, + 0xE6F6=>0xF03E, + 0xE6F7=>0xF123, + 0xE6F9=>0xF003, + 0xE6FA=>0xF32E, + 0xE6FB=>0xF10F, + 0xE6FC=>0xF334, + 0xE6FD=>0xF00D, + 0xE6FE=>0xF311, + 0xE6FF=>0xF326, + 0xE700=>0xF238, + 0xE701=>0xF13C, + 0xE702=>0xF021, + 0xE703=>'!?', + 0xE704=>'!!', + 0xE706=>0xF331, + 0xE707=>0xF331, + 0xE708=>0xF330, + 0xE6AC=>0xF324, + 0xE6AD=>'[ふくろ]', + 0xE6AE=>'[ペン]', + 0xE6B2=>0xF11F, + 0xE6B3=>0xF44B, + 0xE6B7=>'[SOON]', + 0xE6B8=>'[ON]', + 0xE6B9=>'[end]', + 0xE6BA=>0xF02D, + 0xE70C=>'[iアプリ]', + 0xE70D=>'[iアプリ]', + 0xE70E=>0xF006, + 0xE70F=>'[財布]', + 0xE710=>0xF31C, + 0xE711=>'[ジーンズ]', + 0xE712=>'[スノボ]', + 0xE713=>0xF325, + 0xE714=>'[ドア]', + 0xE715=>0xF12F, + 0xE716=>0xF00C, + 0xE717=>'%s103%%s340%', + 0xE718=>'[レンチ]', + 0xE719=>0xF301, + 0xE71A=>0xF10E, + 0xE71B=>0xF034, + 0xE71C=>'[砂時計]', + 0xE71D=>0xF136, + 0xE71E=>0xF338, + 0xE71F=>'[腕時計]', + 0xE720=>0xF403, + 0xE721=>0xF40A, + 0xE722=>'%s421%%s349%', + 0xE723=>0xF108, + 0xE724=>0xF416, + 0xE725=>0xF40E, + 0xE726=>0xF106, + 0xE727=>0xF00E, + 0xE728=>0xF105, + 0xE729=>0xF405, + 0xE72A=>0xF40A, + 0xE72B=>0xF406, + 0xE72C=>0xF402, + 0xE72D=>0xF411, + 0xE72E=>0xF413, + 0xE72F=>'[NG]', + 0xE730=>'[クリップ]', + 0xE731=>0xF24E, + 0xE732=>0xF537, + 0xE733=>0xF115, + 0xE734=>0xF315, + 0xE736=>0xF24F, + 0xE737=>0xF252, + 0xE738=>'[禁]', + 0xE739=>0xF22B, + 0xE73A=>'[合]', + 0xE73B=>0xF22A, + 0xE73C=>'⇔', + 0xE73D=>'↑↓', + 0xE73E=>0xF157, + 0xE73F=>0xF43E, + 0xE740=>0xF03B, + 0xE741=>0xF110, + 0xE742=>'[チェリー]', + 0xE743=>0xF304, + 0xE744=>'[バナナ]', + 0xE745=>0xF345, + 0xE746=>0xF110, + 0xE747=>0xF118, + 0xE748=>0xF030, + 0xE749=>0xF342, + 0xE74A=>0xF046, + 0xE74B=>0xF30B, + 0xE74C=>0xF340, + 0xE74D=>0xF339, + 0xE74E=>'[カタツムリ]', + 0xE74F=>0xF523, + 0xE750=>0xF055, + 0xE751=>0xF019, + 0xE752=>0xF056, + 0xE753=>0xF404, + 0xE754=>0xF01A, + 0xE755=>0xF10B, + 0xE756=>0xF044, + 0xE757=>0xF107, + 0xE481=>0xF252, + 0xE482=>0xF021, + 0xE483=>0xF020, + 0xE52C=>'[Q]', + 0xE52D=>0xF23B, + 0xE52E=>0xF23A, + 0xE52F=>0xF23D, + 0xE530=>0xF23C, + 0xE531=>0xF21B, + 0xE532=>0xF21A, + 0xE533=>'[i]', + 0xE4C1=>0xF044, + 0xE511=>0xF141, + 0xE579=>0xF12F, + 0xE486=>0xF04C, + 0xE487=>0xF13D, + 0xE534=>0xF21B, + 0xE535=>0xF21A, + 0xE536=>0xF21B, + 0xE537=>0xF21B, + 0xE538=>0xF21B, + 0xE539=>0xF21A, + 0xE53A=>0xF219, + 0xE53B=>0xF219, + 0xE57A=>'[腕時計]', + 0xE53C=>'+', + 0xE53D=>'−', + 0xE53E=>'*', + 0xE53F=>0xF232, + 0xE540=>0xF233, + 0xE541=>'[禁止]', + 0xE542=>'▼', + 0xE543=>'▲', + 0xE544=>'▼', + 0xE545=>'▲', + 0xE546=>0xF21B, + 0xE547=>0xF21B, + 0xE548=>0xF21B, + 0xE549=>0xF21A, + 0xE54A=>0xF219, + 0xE54B=>0xF219, + 0xE54C=>0xF237, + 0xE54D=>0xF238, + 0xE488=>0xF04A, + 0xE4BA=>0xF016, + 0xE594=>0xF02D, + 0xE489=>0xF04C, + 0xE512=>0xF325, + 0xE560=>'φ', + 0xE4FA=>0xF002, + 0xE595=>0xF022, + 0xE4C2=>0xF044, + 0xE513=>0xF110, + 0xE54E=>0xF537, + 0xE54F=>0xF333, + 0xE561=>0xF301, + 0xE57B=>'[砂時計]', + 0xE47C=>'[砂時計]', + 0xE562=>0xF316, + 0xE48A=>'[雪結晶]', + 0xE550=>0xF333, + 0xE551=>0xF333, + 0xE552=>0xF234, + 0xE553=>0xF235, + 0xE4C3=>0xF047, + 0xE554=>'÷', + 0xE563=>'[カレンダー]', + 0xE4FB=>0xF056, + 0xE48B=>0xF32F, + 0xE555=>0xF236, + 0xE556=>0xF239, + 0xE514=>0xF034, + 0xE557=>'[チェックマーク]', + 0xE4DF=>0xF052, + 0xE468=>'☆彡', + 0xE46C=>0xF32E, + 0xE476=>0xF10F, + 0xE4E0=>0xF523, + 0xE58F=>'[フォルダ]', + 0xE4FC=>0xF001, + 0xE558=>0xF24E, + 0xE559=>0xF24F, + 0xE49C=>0xF323, + 0xE590=>'[フォルダ]', + 0xE596=>0xF009, + 0xE4FD=>'[フキダシ]', + 0xE57C=>'[カード]', + 0xE55A=>'▲', + 0xE55B=>'▼', + 0xE573=>0xF50C, + 0xE49D=>0xF148, + 0xE564=>0xF301, + 0xE597=>0xF045, + 0xE515=>0xF008, + 0xE48C=>0xF04B, + 0xE4BB=>0xF42B, + 0xE565=>0xF148, + 0xE484=>0xF137, + 0xE46A=>0xF14E, + 0xE566=>0xF148, + 0xE567=>0xF148, + 0xE568=>0xF148, + 0xE569=>0xF301, + 0xE516=>0xF313, + 0xE56A=>'[カレンダー]', + 0xE49E=>0xF125, + 0xE48D=>0xF049, + 0xE521=>0xF103, + 0xE57D=>'ï¿¥', + 0xE517=>0xF03D, + 0xE57E=>0xF03D, + 0xE4AB=>0xF036, + 0xE4E4=>0xF304, + 0xE57F=>'[包丁]', + 0xE580=>0xF129, + 0xE4FE=>'[メガネ]', + 0xE55C=>'└→', + 0xE55D=>'←┘', + 0xE518=>0xF114, + 0xE519=>0xF03F, + 0xE56B=>0xF148, + 0xE49F=>0xF148, + 0xE581=>'[ネジ]', + 0xE51A=>0xF13E, + 0xE4B1=>0xF01B, + 0xE582=>0xF316, + 0xE574=>0xF14A, + 0xE575=>0xF14A, + 0xE51B=>0xF101, + 0xE583=>'[懐中電灯]', + 0xE56C=>0xF148, + 0xE55E=>'[チェックマーク]', + 0xE4CE=>0xF118, + 0xE4E1=>0xF052, + 0xE584=>'[電池]', + 0xE55F=>'[スクロール]', + 0xE56D=>'[画びょう]', + 0xE51C=>0xF144, + 0xE585=>0xF12F, + 0xE4FF=>0xF230, + 0xE500=>0xF231, + 0xE56E=>0xF148, + 0xE4A0=>'[クリップ]', + 0xE4CF=>0xF112, + 0xE51D=>'[名札]', + 0xE4AC=>0xF043, + 0xE56F=>0xF148, + 0xE4B2=>0xF42F, + 0xE4A1=>0xF301, + 0xE586=>'[PDC]', + 0xE591=>0xF103, + 0xE587=>'[レンチ]', + 0xE592=>'[送信BOX]', + 0xE593=>'[受信BOX]', + 0xE51E=>0xF009, + 0xE4AD=>0xF038, + 0xE570=>'[定規]', + 0xE4A2=>'[三角定規]', + 0xE576=>'[グラフ]', + 0xE4C4=>'[肉]', + 0xE588=>0xF00A, + 0xE589=>'[コンセント]', + 0xE501=>'[家族]', + 0xE58A=>'[リンク]', + 0xE51F=>0xF112, + 0xE520=>0xF00B, + 0xE48E=>'%s74%%s73%', + 0xE4B3=>0xF01D, + 0xE4B4=>0xF01C, + 0xE4C8=>'[サイコロ]', + 0xE58B=>'[新聞]', + 0xE4B5=>0xF01E, + 0xE58C=>' ', + 0xE47D=>0xF30E, + 0xE47E=>0xF208, + 0xE47F=>0xF20A, + 0xE480=>0xF209, + 0xE522=>0xF21C, + 0xE523=>0xF21D, + 0xE524=>0xF21E, + 0xE525=>0xF21F, + 0xE526=>0xF220, + 0xE527=>0xF221, + 0xE528=>0xF222, + 0xE529=>0xF223, + 0xE52A=>0xF224, + 0xE52B=>'[10]', + 0xE469=>0xF443, + 0xE485=>0xF048, + 0xE48F=>0xF23F, + 0xE490=>0xF240, + 0xE491=>0xF241, + 0xE492=>0xF242, + 0xE493=>0xF243, + 0xE494=>0xF244, + 0xE495=>0xF245, + 0xE496=>0xF246, + 0xE497=>0xF247, + 0xE498=>0xF248, + 0xE499=>0xF249, + 0xE49A=>0xF24A, + 0xE49B=>0xF24B, + 0xE4A3=>0xF154, + 0xE4A4=>0xF156, + 0xE4A5=>0xF151, + 0xE4A6=>0xF14F, + 0xE4A7=>0xF150, + 0xE4A8=>0xF14B, + 0xE4A9=>0xF202, + 0xE4AA=>0xF14D, + 0xE571=>0xF03A, + 0xE572=>'[地図]', + 0xE4AE=>0xF136, + 0xE4AF=>0xF159, + 0xE4B0=>0xF01F, + 0xE46B=>0xF115, + 0xE4B6=>0xF018, + 0xE4B7=>0xF015, + 0xE4B8=>'[スノボ]', + 0xE4B9=>0xF132, + 0xE46D=>0xF124, + 0xE4BC=>0xF123, + 0xE4BD=>0xF30B, + 0xE4BE=>0xF324, + 0xE4BF=>0xF44B, + 0xE4C0=>0xF509, + 0xE46E=>0xF133, + 0xE46F=>'[オメデトウ]', + 0xE4C5=>0xF130, + 0xE4C6=>'[ゲーム]', + 0xE4C7=>0xF12F, + 0xE4C9=>0xF033, + 0xE4CA=>0xF030, + 0xE4CB=>0xF11B, + 0xE4CC=>0xF50B, + 0xE4CD=>0xF348, + 0xE4D0=>0xF046, + 0xE4D1=>0xF147, + 0xE4D2=>'[さくらんぼ]', + 0xE4D3=>0xF019, + 0xE4D4=>0xF347, + 0xE4D5=>0xF342, + 0xE4D6=>0xF120, + 0xE470=>0xF054, + 0xE4D7=>0xF52C, + 0xE4D8=>0xF01A, + 0xE4D9=>0xF109, + 0xE4DA=>0xF531, + 0xE4DB=>0xF04F, + 0xE4DC=>0xF055, + 0xE4DD=>'[アリ]', + 0xE4DE=>0xF10B, + 0xE4E2=>0xF307, + 0xE4E3=>0xF305, + 0xE471=>0xF057, + 0xE472=>0xF059, + 0xE473=>0xF411, + 0xE474=>0xF406, + 0xE475=>0xF13C, + 0xE4E5=>0xF334, + 0xE4E6=>0xF331, + 0xE4E7=>0xF105, + 0xE477=>0xF023, + 0xE478=>0xF327, + 0xE479=>0xF32E, + 0xE47A=>0xF311, + 0xE47B=>0xF11D, + 0xE4E8=>'[SOS]', + 0xE4E9=>0xF14C, + 0xE4EA=>0xF329, + 0xE4EB=>0xF003, + 0xE4EC=>0xF10C, + 0xE4ED=>'[なると]', + 0xE4EE=>0xF536, + 0xE4EF=>0xF11A, + 0xE4F0=>'[花丸]', + 0xE4F1=>0xF315, + 0xE4F2=>'[100点]', + 0xE4F3=>0xF00D, + 0xE4F4=>0xF330, + 0xE4F5=>0xF05A, + 0xE4F6=>0xF00F, + 0xE4F7=>0xF226, + 0xE4F8=>0xF11C, + 0xE4F9=>0xF00E, + 0xE502=>0xF12A, + 0xE503=>0xF03C, + 0xE504=>'[財布]', + 0xE505=>0xF326, + 0xE506=>0xF041, + 0xE507=>'[バイオリン]', + 0xE508=>0xF30A, + 0xE509=>0xF31C, + 0xE50A=>0xF113, + 0xE50B=>0xF31E, + 0xE577=>'[EZ]', + 0xE578=>'[FREE]', + 0xE50C=>0xF126, + 0xE50D=>0xF006, + 0xE50E=>0xF10C, + 0xE50F=>0xF213, + 0xE510=>0xF13B, + 0xE598=>'[霧]', + 0xE599=>0xF014, + 0xE59A=>0xF42A, + 0xE59B=>'[ポケベル]', + 0xE59C=>0xF502, + 0xE59D=>0xF503, + 0xE59E=>'[イベント]', + 0xE59F=>0xF314, + 0xE5A0=>0xF34B, + 0xE5A1=>0xF20E, + 0xE5A2=>0xF20D, + 0xE5A3=>0xF20F, + 0xE5A4=>0xF419, + 0xE5A5=>0xF41B, + 0xE5A6=>0xF011, + 0xE5A7=>0xF012, + 0xE5A8=>'●', + 0xE5A9=>0xF04C, + 0xE5AA=>0xF04C, + 0xE5AB=>'[CL]', + 0xE5AC=>0xF225, + 0xE5AD=>0xF24D, + 0xE5AE=>0xF406, + 0xE5AF=>0xF327, + 0xE5B0=>'[ドンッ]', + 0xE5B1=>0xF331, + 0xE5B2=>'[ezplus]', + 0xE5B3=>'[地球]', + 0xE5B4=>0xF340, + 0xE5B5=>0xF212, + 0xE5B6=>0xF006, + 0xE5B7=>0xF007, + 0xE5B8=>0xF00C, + 0xE5B9=>0xF128, + 0xE5BA=>0xF032, + 0xE5BB=>0xF037, + 0xE5BC=>0xF434, + 0xE5BD=>0xF03B, + 0xE5BE=>0xF03E, + 0xE5BF=>0xF04E, + 0xE5C0=>0xF050, + 0xE5C1=>0xF051, + 0xE5C2=>0xF053, + 0xE5C3=>0xF405, + 0xE5C4=>0xF106, + 0xE5C5=>0xF410, + 0xE5C6=>0xF108, + 0xE5C7=>0xF10A, + 0xE5C8=>0xF10D, + 0xE5C9=>0xF10E, + 0xE5CA=>0xF111, + 0xE5CB=>0xF116, + 0xE5CC=>0xF117, + 0xE5CD=>0xF119, + 0xE5CE=>0xF11E, + 0xE5CF=>0xF121, + 0xE5D0=>0xF122, + 0xE5D1=>0xF12D, + 0xE5D2=>0xF12E, + 0xE5D3=>0xF131, + 0xE5D4=>'[カメ]', + 0xE5D5=>0xF511, + 0xE5D6=>0xF512, + 0xE5D7=>0xF137, + 0xE5D8=>0xF13F, + 0xE5D9=>0xF143, + 0xE5DA=>0xF146, + 0xE5DB=>0xF523, + 0xE5DC=>0xF14A, + 0xE5DD=>0xF152, + 0xE5DE=>0xF153, + 0xE5DF=>0xF155, + 0xEA80=>0xF157, + 0xEA81=>0xF158, + 0xEA82=>0xF202, + 0xEA83=>0xF207, + 0xEA84=>0xF20B, + 0xEA85=>0xF214, + 0xEA86=>0xF227, + 0xEA87=>0xF228, + 0xEA88=>0xF229, + 0xEA89=>0xF22A, + 0xEA8A=>0xF22B, + 0xEA8B=>0xF22C, + 0xEA8C=>0xF22D, + 0xEA8D=>0xF22E, + 0xEA8E=>0xF22F, + 0xEA8F=>0xF23E, + 0xEA90=>0xF250, + 0xEA91=>0xF251, + 0xEA92=>0xF301, + 0xEA93=>0xF302, + 0xEA94=>0xF303, + 0xEA95=>0xF306, + 0xEA96=>0xF308, + 0xEA97=>0xF30B, + 0xEA98=>0xF30C, + 0xEA99=>0xF30D, + 0xEA9A=>0xF30F, + 0xEA9B=>0xF310, + 0xEA9C=>0xF312, + 0xEA9D=>'[EZナビ]', + 0xEA9E=>0xF318, + 0xEA9F=>0xF31B, + 0xEAA0=>0xF31D, + 0xEAA1=>0xF31F, + 0xEAA2=>0xF320, + 0xEAA3=>0xF321, + 0xEAA4=>0xF322, + 0xEAA5=>0xF20C, + 0xEAA6=>0xF327, + 0xEAA7=>0xF32A, + 0xEAA8=>0xF32B, + 0xEAA9=>0xF32C, + 0xEAAA=>0xF32D, + 0xEAAB=>0xF32E, + 0xEAAC=>0xF013, + 0xEAAD=>0xF332, + 0xEAAE=>0xF338, + 0xEAAF=>0xF339, + 0xEAB0=>0xF33A, + 0xEAB1=>0xF33B, + 0xEAB2=>0xF33C, + 0xEAB3=>0xF33D, + 0xEAB4=>0xF33E, + 0xEAB5=>0xF33F, + 0xEAB6=>0xF341, + 0xEAB7=>0xF343, + 0xEAB8=>0xF344, + 0xEAB9=>0xF345, + 0xEABA=>0xF346, + 0xEABB=>0xF349, + 0xEABC=>0xF34A, + 0xEABD=>0xF34C, + 0xEABE=>0xF34D, + 0xEABF=>0xF402, + 0xEAC0=>0xF403, + 0xEAC1=>0xF404, + 0xEAC2=>0xF406, + 0xEAC3=>0xF407, + 0xEAC4=>0xF408, + 0xEAC5=>0xF40A, + 0xEAC6=>0xF40B, + 0xEAC7=>0xF40C, + 0xEAC8=>0xF40D, + 0xEAC9=>0xF40E, + 0xEACA=>0xF410, + 0xEACB=>0xF40F, + 0xEACC=>0xF326, + 0xEACD=>0xF056, + 0xEACE=>0xF417, + 0xEACF=>0xF418, + 0xEAD0=>0xF41A, + 0xEAD1=>0xF41C, + 0xEAD2=>0xF41D, + 0xEAD3=>0xF41F, + 0xEAD4=>0xF420, + 0xEAD5=>0xF421, + 0xEAD6=>0xF41E, + 0xEAD7=>0xF423, + 0xEAD8=>0xF424, + 0xEAD9=>0xF426, + 0xEADA=>0xF425, + 0xEADB=>0xF429, + 0xEADC=>0xF042, + 0xEADD=>0xF42C, + 0xEADE=>0xF42D, + 0xEADF=>0xF430, + 0xEAE0=>0xF431, + 0xEAE1=>0xF432, + 0xEAE2=>0xF433, + 0xEAE3=>0xF436, + 0xEAE4=>0xF438, + 0xEAE5=>0xF439, + 0xEAE6=>0xF43A, + 0xEAE7=>0xF43B, + 0xEAE8=>0xF43C, + 0xEAE9=>'[花嫁]', + 0xEAEA=>0xF43F, + 0xEAEB=>0xF440, + 0xEAEC=>0xF441, + 0xEAED=>0xF442, + 0xEAEE=>0xF445, + 0xEAEF=>0xF446, + 0xEAF0=>0xF448, + 0xEAF1=>0xF44B, + 0xEAF2=>0xF44C, + 0xEAF3=>0xF501, + 0xEAF4=>0xF449, + 0xEAF5=>0xF503, + 0xEAF6=>0xF504, + 0xEAF7=>0xF505, + 0xEAF8=>0xF506, + 0xEAF9=>0xF508, + 0xEAFA=>0xF50D, + 0xEAFB=>'[オープンウェブ]', + 0xEAFC=>0xF144, + 0xEAFD=>'[ABCD]', + 0xEAFE=>'[abcd]', + 0xEAFF=>'[1234]', + 0xEB00=>'[記号]', + 0xEB01=>'[可]', + 0xEB02=>'[チェックマーク]', + 0xEB03=>'[ペン]', + 0xEB04=>'[ラジオボタン]', + 0xEB05=>0xF114, + 0xEB06=>0xF235, + 0xEB07=>'[ブックマーク]', + 0xEB08=>0xF104, + 0xEB09=>0xF036, + 0xEB0A=>0xF101, + 0xEB0B=>0xF301, + 0xEB0C=>0xF144, + 0xEB0D=>'↑↓', + 0xEB0E=>0xF50E, + 0xEB0F=>0xF50F, + 0xEB10=>0xF510, + 0xEB11=>0xF513, + 0xEB12=>0xF514, + 0xEB13=>0xF515, + 0xEB14=>0xF516, + 0xEB15=>0xF517, + 0xEB16=>0xF518, + 0xEB17=>0xF519, + 0xEB18=>0xF51A, + 0xEB19=>0xF51B, + 0xEB1A=>0xF51C, + 0xEB1B=>0xF520, + 0xEB1C=>0xF51F, + 0xEB1D=>0xF522, + 0xEB1E=>0xF525, + 0xEB1F=>0xF526, + 0xEB20=>0xF527, + 0xEB21=>0xF52B, + 0xEB22=>0xF52D, + 0xEB23=>0xF52E, + 0xEB24=>0xF52F, + 0xEB25=>0xF530, + 0xEB26=>0xF532, + 0xEB27=>0xF533, + 0xEB28=>0xF535, + 0xEB29=>0xF534, + 0xEB2A=>0xF536, + 0xEB2B=>0xF007, + 0xEB2C=>'[旗]', + 0xEB2D=>0xF236, + 0xEB2E=>0xF238, + 0xEB2F=>'!?', + 0xEB30=>'!!', + 0xEB31=>'〜', + 0xEB32=>'[メロン]', + 0xEB33=>'[パイナップル]', + 0xEB34=>'[ブドウ]', + 0xEB35=>'[バナナ]', + 0xEB36=>'[とうもろこし]', + 0xEB37=>'[キノコ]', + 0xEB38=>'[栗]', + 0xEB39=>'[モモ]', + 0xEB3A=>'[やきいも]', + 0xEB3B=>'[ピザ]', + 0xEB3C=>'[チキン]', + 0xEB3D=>'[七夕]', + 0xEB3E=>0xF044, + 0xEB3F=>'[è¾°]', + 0xEB40=>'[ピアノ]', + 0xEB41=>0xF017, + 0xEB42=>0xF019, + 0xEB43=>'[ボーリング]', + 0xEB44=>'[なまはげ]', + 0xEB45=>'[天狗]', + 0xEB46=>'[パンダ]', + 0xEB47=>0xF409, + 0xEB48=>0xF10B, + 0xEB49=>0xF305, + 0xEB4A=>'[アイスクリーム]', + 0xEB4B=>'[ドーナツ]', + 0xEB4C=>'[クッキー]', + 0xEB4D=>'[チョコ]', + 0xEB4E=>'[キャンディ]', + 0xEB4F=>'[キャンディ]', + 0xEB50=>'(/_ï¼¼)', + 0xEB51=>'(・×・)', + 0xEB52=>'|(・×・)|', + 0xEB53=>'[火山]', + 0xEB54=>0xF328, + 0xEB55=>'[ABC]', + 0xEB56=>'[プリン]', + 0xEB57=>'[ミツバチ]', + 0xEB58=>'[てんとう虫]', + 0xEB59=>'[ハチミツ]', + 0xEB5A=>0xF345, + 0xEB5B=>'[飛んでいくお金]', + 0xEB5C=>0xF407, + 0xEB5D=>0xF416, + 0xEB5E=>0xF416, + 0xEB5F=>0xF44B, + 0xEB60=>0xF418, + 0xEB61=>0xF057, + 0xEB62=>0xF103, + 0xEB63=>0xF412, + 0xEB64=>0xF412, + 0xEB65=>0xF106, + 0xEB66=>0xF403, + 0xEB67=>0xF403, + 0xEB68=>0xF413, + 0xEB69=>0xF413, + 0xEB6A=>0xF404, + 0xEB6B=>0xF319, + 0xEB6C=>'[モアイ]', + 0xEB6D=>0xF039, + 0xEB6E=>'[花札]', + 0xEB6F=>'[ジョーカー]', + 0xEB70=>'[エビフライ]', + 0xEB71=>0xF103, + 0xEB72=>0xF201, + 0xEB73=>0xF432, + 0xEB74=>'[EZムービー]', + 0xEB75=>0xF327, + 0xEB76=>0xF523, + 0xEB77=>'[ジーンズ]', + 0xEB78=>'%s103%%s340%', + 0xEB79=>'↑↓', + 0xEB7A=>'⇔', + 0xEB7B=>'↑↓', + 0xEB7C=>0xF43E, + 0xEB7D=>0xF110, + 0xEB7E=>'[カタツムリ]', + 0xEB7F=>0xF404, + 0xEB80=>0xF404, + 0xEB81=>'[Cメール]', + 0xEB82=>0xF110, + 0xEB83=>0xF010, + 0xEB84=>0xF210, + 0xEB85=>0xF012, + 0xEB86=>0xF427, + 0xEB87=>0xF403, + 0xEB88=>0xF416, + 0xF001=>0xF001, + 0xF002=>0xF002, + 0xF003=>0xF003, + 0xF004=>0xF004, + 0xF005=>0xF005, + 0xF006=>0xF006, + 0xF007=>0xF007, + 0xF008=>0xF008, + 0xF009=>0xF009, + 0xF00A=>0xF00A, + 0xF00B=>0xF00B, + 0xF00C=>0xF00C, + 0xF00D=>0xF00D, + 0xF00E=>0xF00E, + 0xF00F=>0xF00F, + 0xF010=>0xF010, + 0xF011=>0xF011, + 0xF012=>0xF012, + 0xF013=>0xF013, + 0xF014=>0xF014, + 0xF015=>0xF015, + 0xF016=>0xF016, + 0xF017=>0xF017, + 0xF018=>0xF018, + 0xF019=>0xF019, + 0xF01A=>0xF01A, + 0xF01B=>0xF01B, + 0xF01C=>0xF01C, + 0xF01D=>0xF01D, + 0xF01E=>0xF01E, + 0xF01F=>0xF01F, + 0xF020=>0xF020, + 0xF021=>0xF021, + 0xF022=>0xF022, + 0xF023=>0xF023, + 0xF024=>0xF024, + 0xF025=>0xF025, + 0xF026=>0xF026, + 0xF027=>0xF027, + 0xF028=>0xF028, + 0xF029=>0xF029, + 0xF02A=>0xF02A, + 0xF02B=>0xF02B, + 0xF02C=>0xF02C, + 0xF02D=>0xF02D, + 0xF02E=>0xF02E, + 0xF02F=>0xF02F, + 0xF030=>0xF030, + 0xF031=>0xF031, + 0xF032=>0xF032, + 0xF033=>0xF033, + 0xF034=>0xF034, + 0xF035=>0xF035, + 0xF036=>0xF036, + 0xF037=>0xF037, + 0xF038=>0xF038, + 0xF039=>0xF039, + 0xF03A=>0xF03A, + 0xF03B=>0xF03B, + 0xF03C=>0xF03C, + 0xF03D=>0xF03D, + 0xF03E=>0xF03E, + 0xF03F=>0xF03F, + 0xF040=>0xF040, + 0xF041=>0xF041, + 0xF042=>0xF042, + 0xF043=>0xF043, + 0xF044=>0xF044, + 0xF045=>0xF045, + 0xF046=>0xF046, + 0xF047=>0xF047, + 0xF048=>0xF048, + 0xF049=>0xF049, + 0xF04A=>0xF04A, + 0xF04B=>0xF04B, + 0xF04C=>0xF04C, + 0xF04D=>0xF04D, + 0xF04E=>0xF04E, + 0xF04F=>0xF04F, + 0xF050=>0xF050, + 0xF051=>0xF051, + 0xF052=>0xF052, + 0xF053=>0xF053, + 0xF054=>0xF054, + 0xF055=>0xF055, + 0xF056=>0xF056, + 0xF057=>0xF057, + 0xF058=>0xF058, + 0xF059=>0xF059, + 0xF05A=>0xF05A, + 0xF101=>0xF101, + 0xF102=>0xF102, + 0xF103=>0xF103, + 0xF104=>0xF104, + 0xF105=>0xF105, + 0xF106=>0xF106, + 0xF107=>0xF107, + 0xF108=>0xF108, + 0xF109=>0xF109, + 0xF10A=>0xF10A, + 0xF10B=>0xF10B, + 0xF10C=>0xF10C, + 0xF10D=>0xF10D, + 0xF10E=>0xF10E, + 0xF10F=>0xF10F, + 0xF110=>0xF110, + 0xF111=>0xF111, + 0xF112=>0xF112, + 0xF113=>0xF113, + 0xF114=>0xF114, + 0xF115=>0xF115, + 0xF116=>0xF116, + 0xF117=>0xF117, + 0xF118=>0xF118, + 0xF119=>0xF119, + 0xF11A=>0xF11A, + 0xF11B=>0xF11B, + 0xF11C=>0xF11C, + 0xF11D=>0xF11D, + 0xF11E=>0xF11E, + 0xF11F=>0xF11F, + 0xF120=>0xF120, + 0xF121=>0xF121, + 0xF122=>0xF122, + 0xF123=>0xF123, + 0xF124=>0xF124, + 0xF125=>0xF125, + 0xF126=>0xF126, + 0xF127=>0xF127, + 0xF128=>0xF128, + 0xF129=>0xF129, + 0xF12A=>0xF12A, + 0xF12B=>0xF12B, + 0xF12C=>0xF12C, + 0xF12D=>0xF12D, + 0xF12E=>0xF12E, + 0xF12F=>0xF12F, + 0xF130=>0xF130, + 0xF131=>0xF131, + 0xF132=>0xF132, + 0xF133=>0xF133, + 0xF134=>0xF134, + 0xF135=>0xF135, + 0xF136=>0xF136, + 0xF137=>0xF137, + 0xF138=>0xF138, + 0xF139=>0xF139, + 0xF13A=>0xF13A, + 0xF13B=>0xF13B, + 0xF13C=>0xF13C, + 0xF13D=>0xF13D, + 0xF13E=>0xF13E, + 0xF13F=>0xF13F, + 0xF140=>0xF140, + 0xF141=>0xF141, + 0xF142=>0xF142, + 0xF143=>0xF143, + 0xF144=>0xF144, + 0xF145=>0xF145, + 0xF146=>0xF146, + 0xF147=>0xF147, + 0xF148=>0xF148, + 0xF149=>0xF149, + 0xF14A=>0xF14A, + 0xF14B=>0xF14B, + 0xF14C=>0xF14C, + 0xF14D=>0xF14D, + 0xF14E=>0xF14E, + 0xF14F=>0xF14F, + 0xF150=>0xF150, + 0xF151=>0xF151, + 0xF152=>0xF152, + 0xF153=>0xF153, + 0xF154=>0xF154, + 0xF155=>0xF155, + 0xF156=>0xF156, + 0xF157=>0xF157, + 0xF158=>0xF158, + 0xF159=>0xF159, + 0xF15A=>0xF15A, + 0xF201=>0xF201, + 0xF202=>0xF202, + 0xF203=>0xF203, + 0xF204=>0xF204, + 0xF205=>0xF205, + 0xF206=>0xF206, + 0xF207=>0xF207, + 0xF208=>0xF208, + 0xF209=>0xF209, + 0xF20A=>0xF20A, + 0xF20B=>0xF20B, + 0xF20C=>0xF20C, + 0xF20D=>0xF20D, + 0xF20E=>0xF20E, + 0xF20F=>0xF20F, + 0xF210=>0xF210, + 0xF211=>0xF211, + 0xF212=>0xF212, + 0xF213=>0xF213, + 0xF214=>0xF214, + 0xF215=>0xF215, + 0xF216=>0xF216, + 0xF217=>0xF217, + 0xF218=>0xF218, + 0xF219=>0xF219, + 0xF21A=>0xF21A, + 0xF21B=>0xF21B, + 0xF21C=>0xF21C, + 0xF21D=>0xF21D, + 0xF21E=>0xF21E, + 0xF21F=>0xF21F, + 0xF220=>0xF220, + 0xF221=>0xF221, + 0xF222=>0xF222, + 0xF223=>0xF223, + 0xF224=>0xF224, + 0xF225=>0xF225, + 0xF226=>0xF226, + 0xF227=>0xF227, + 0xF228=>0xF228, + 0xF229=>0xF229, + 0xF22A=>0xF22A, + 0xF22B=>0xF22B, + 0xF22C=>0xF22C, + 0xF22D=>0xF22D, + 0xF22E=>0xF22E, + 0xF22F=>0xF22F, + 0xF230=>0xF230, + 0xF231=>0xF231, + 0xF232=>0xF232, + 0xF233=>0xF233, + 0xF234=>0xF234, + 0xF235=>0xF235, + 0xF236=>0xF236, + 0xF237=>0xF237, + 0xF238=>0xF238, + 0xF239=>0xF239, + 0xF23A=>0xF23A, + 0xF23B=>0xF23B, + 0xF23C=>0xF23C, + 0xF23D=>0xF23D, + 0xF23E=>0xF23E, + 0xF23F=>0xF23F, + 0xF240=>0xF240, + 0xF241=>0xF241, + 0xF242=>0xF242, + 0xF243=>0xF243, + 0xF244=>0xF244, + 0xF245=>0xF245, + 0xF246=>0xF246, + 0xF247=>0xF247, + 0xF248=>0xF248, + 0xF249=>0xF249, + 0xF24A=>0xF24A, + 0xF24B=>0xF24B, + 0xF24C=>0xF24C, + 0xF24D=>0xF24D, + 0xF24E=>0xF24E, + 0xF24F=>0xF24F, + 0xF250=>0xF250, + 0xF251=>0xF251, + 0xF252=>0xF252, + 0xF253=>0xF253, + 0xF255=>0xF255, + 0xF256=>0xF256, + 0xF257=>0xF257, + 0xF301=>0xF301, + 0xF302=>0xF302, + 0xF303=>0xF303, + 0xF304=>0xF304, + 0xF305=>0xF305, + 0xF306=>0xF306, + 0xF307=>0xF307, + 0xF308=>0xF308, + 0xF309=>0xF309, + 0xF30A=>0xF30A, + 0xF30B=>0xF30B, + 0xF30C=>0xF30C, + 0xF30D=>0xF30D, + 0xF30E=>0xF30E, + 0xF30F=>0xF30F, + 0xF310=>0xF310, + 0xF311=>0xF311, + 0xF312=>0xF312, + 0xF313=>0xF313, + 0xF314=>0xF314, + 0xF315=>0xF315, + 0xF316=>0xF316, + 0xF317=>0xF317, + 0xF318=>0xF318, + 0xF319=>0xF319, + 0xF31A=>0xF31A, + 0xF31B=>0xF31B, + 0xF31C=>0xF31C, + 0xF31D=>0xF31D, + 0xF31E=>0xF31E, + 0xF31F=>0xF31F, + 0xF320=>0xF320, + 0xF321=>0xF321, + 0xF322=>0xF322, + 0xF323=>0xF323, + 0xF324=>0xF324, + 0xF325=>0xF325, + 0xF326=>0xF326, + 0xF327=>0xF327, + 0xF328=>0xF328, + 0xF329=>0xF329, + 0xF32A=>0xF32A, + 0xF32B=>0xF32B, + 0xF32C=>0xF32C, + 0xF32D=>0xF32D, + 0xF32E=>0xF32E, + 0xF32F=>0xF32F, + 0xF330=>0xF330, + 0xF331=>0xF331, + 0xF332=>0xF332, + 0xF333=>0xF333, + 0xF334=>0xF334, + 0xF335=>0xF335, + 0xF336=>0xF336, + 0xF337=>0xF337, + 0xF338=>0xF338, + 0xF339=>0xF339, + 0xF33A=>0xF33A, + 0xF33B=>0xF33B, + 0xF33C=>0xF33C, + 0xF33D=>0xF33D, + 0xF33E=>0xF33E, + 0xF33F=>0xF33F, + 0xF340=>0xF340, + 0xF341=>0xF341, + 0xF342=>0xF342, + 0xF343=>0xF343, + 0xF344=>0xF344, + 0xF345=>0xF345, + 0xF346=>0xF346, + 0xF347=>0xF347, + 0xF348=>0xF348, + 0xF349=>0xF349, + 0xF34A=>0xF34A, + 0xF34B=>0xF34B, + 0xF34C=>0xF34C, + 0xF34D=>0xF34D, + 0xF401=>0xF401, + 0xF402=>0xF402, + 0xF403=>0xF403, + 0xF404=>0xF404, + 0xF405=>0xF405, + 0xF406=>0xF406, + 0xF407=>0xF407, + 0xF408=>0xF408, + 0xF409=>0xF409, + 0xF40A=>0xF40A, + 0xF40B=>0xF40B, + 0xF40C=>0xF40C, + 0xF40D=>0xF40D, + 0xF40E=>0xF40E, + 0xF40F=>0xF40F, + 0xF410=>0xF410, + 0xF411=>0xF411, + 0xF412=>0xF412, + 0xF413=>0xF413, + 0xF414=>0xF414, + 0xF415=>0xF415, + 0xF416=>0xF416, + 0xF417=>0xF417, + 0xF418=>0xF418, + 0xF419=>0xF419, + 0xF41A=>0xF41A, + 0xF41B=>0xF41B, + 0xF41C=>0xF41C, + 0xF41D=>0xF41D, + 0xF41E=>0xF41E, + 0xF41F=>0xF41F, + 0xF420=>0xF420, + 0xF421=>0xF421, + 0xF422=>0xF422, + 0xF423=>0xF423, + 0xF424=>0xF424, + 0xF425=>0xF425, + 0xF426=>0xF426, + 0xF427=>0xF427, + 0xF428=>0xF428, + 0xF429=>0xF429, + 0xF42A=>0xF42A, + 0xF42B=>0xF42B, + 0xF42C=>0xF42C, + 0xF42D=>0xF42D, + 0xF42E=>0xF42E, + 0xF42F=>0xF42F, + 0xF430=>0xF430, + 0xF431=>0xF431, + 0xF432=>0xF432, + 0xF433=>0xF433, + 0xF434=>0xF434, + 0xF435=>0xF435, + 0xF436=>0xF436, + 0xF437=>0xF437, + 0xF438=>0xF438, + 0xF439=>0xF439, + 0xF43A=>0xF43A, + 0xF43B=>0xF43B, + 0xF43C=>0xF43C, + 0xF43D=>0xF43D, + 0xF43E=>0xF43E, + 0xF43F=>0xF43F, + 0xF440=>0xF440, + 0xF441=>0xF441, + 0xF442=>0xF442, + 0xF443=>0xF443, + 0xF444=>0xF444, + 0xF445=>0xF445, + 0xF446=>0xF446, + 0xF447=>0xF447, + 0xF448=>0xF448, + 0xF449=>0xF449, + 0xF44A=>0xF44A, + 0xF44B=>0xF44B, + 0xF44C=>0xF44C, + 0xF501=>0xF501, + 0xF502=>0xF502, + 0xF503=>0xF503, + 0xF504=>0xF504, + 0xF505=>0xF505, + 0xF506=>0xF506, + 0xF507=>0xF507, + 0xF508=>0xF508, + 0xF509=>0xF509, + 0xF50A=>0xF50A, + 0xF50B=>0xF50B, + 0xF50C=>0xF50C, + 0xF50D=>0xF50D, + 0xF50E=>0xF50E, + 0xF50F=>0xF50F, + 0xF510=>0xF510, + 0xF511=>0xF511, + 0xF512=>0xF512, + 0xF513=>0xF513, + 0xF514=>0xF514, + 0xF515=>0xF515, + 0xF516=>0xF516, + 0xF517=>0xF517, + 0xF518=>0xF518, + 0xF519=>0xF519, + 0xF51A=>0xF51A, + 0xF51B=>0xF51B, + 0xF51C=>0xF51C, + 0xF51D=>0xF51D, + 0xF51E=>0xF51E, + 0xF51F=>0xF51F, + 0xF520=>0xF520, + 0xF521=>0xF521, + 0xF522=>0xF522, + 0xF523=>0xF523, + 0xF524=>0xF524, + 0xF525=>0xF525, + 0xF526=>0xF526, + 0xF527=>0xF527, + 0xF528=>0xF528, + 0xF529=>0xF529, + 0xF52A=>0xF52A, + 0xF52B=>0xF52B, + 0xF52C=>0xF52C, + 0xF52D=>0xF52D, + 0xF52E=>0xF52E, + 0xF52F=>0xF52F, + 0xF530=>0xF530, + 0xF531=>0xF531, + 0xF532=>0xF532, + 0xF533=>0xF533, + 0xF534=>0xF534, + 0xF535=>0xF535, + 0xF536=>0xF536, + 0xF537=>0xF537, +} + + end +end diff --git a/lib/emoticon/conversion_table/au.rb b/lib/emoticon/conversion_table/au.rb new file mode 100644 index 0000000..b155d9b --- /dev/null +++ b/lib/emoticon/conversion_table/au.rb @@ -0,0 +1,1291 @@ +module Emoticon + module ConversionTable + AU_SJIS_TO_UNICODE = { + 0xF659=>0xE481, + 0xF75E=>0xE542, + 0xF65A=>0xE482, + 0xF75F=>0xE543, + 0xF65B=>0xE483, + 0xF760=>0xE544, + 0xF748=>0xE52C, + 0xF761=>0xE545, + 0xF749=>0xE52D, + 0xF762=>0xE546, + 0xF74A=>0xE52E, + 0xF763=>0xE547, + 0xF74B=>0xE52F, + 0xF764=>0xE548, + 0xF74C=>0xE530, + 0xF765=>0xE549, + 0xF74D=>0xE531, + 0xF766=>0xE54A, + 0xF74E=>0xE532, + 0xF767=>0xE54B, + 0xF74F=>0xE533, + 0xF768=>0xE54C, + 0xF69A=>0xE4C1, + 0xF769=>0xE54D, + 0xF6EA=>0xE511, + 0xF660=>0xE488, + 0xF796=>0xE579, + 0xF693=>0xE4BA, + 0xF65E=>0xE486, + 0xF7B1=>0xE594, + 0xF65F=>0xE487, + 0xF661=>0xE489, + 0xF750=>0xE534, + 0xF6EB=>0xE512, + 0xF751=>0xE535, + 0xF77C=>0xE560, + 0xF752=>0xE536, + 0xF6D3=>0xE4FA, + 0xF753=>0xE537, + 0xF7B2=>0xE595, + 0xF754=>0xE538, + 0xF69B=>0xE4C2, + 0xF755=>0xE539, + 0xF6EC=>0xE513, + 0xF756=>0xE53A, + 0xF76A=>0xE54E, + 0xF757=>0xE53B, + 0xF76B=>0xE54F, + 0xF797=>0xE57A, + 0xF77D=>0xE561, + 0xF758=>0xE53C, + 0xF798=>0xE57B, + 0xF759=>0xE53D, + 0xF654=>0xE47C, + 0xF75A=>0xE53E, + 0xF77E=>0xE562, + 0xF75B=>0xE53F, + 0xF662=>0xE48A, + 0xF75C=>0xE540, + 0xF76C=>0xE550, + 0xF75D=>0xE541, + 0xF76D=>0xE551, + 0xF76E=>0xE552, + 0xF6EE=>0xE515, + 0xF76F=>0xE553, + 0xF664=>0xE48C, + 0xF69C=>0xE4C3, + 0xF694=>0xE4BB, + 0xF770=>0xE554, + 0xF782=>0xE565, + 0xF780=>0xE563, + 0xF65C=>0xE484, + 0xF6D4=>0xE4FB, + 0xF642=>0xE46A, + 0xF663=>0xE48B, + 0xF783=>0xE566, + 0xF771=>0xE555, + 0xF784=>0xE567, + 0xF772=>0xE556, + 0xF785=>0xE568, + 0xF6ED=>0xE514, + 0xF786=>0xE569, + 0xF773=>0xE557, + 0xF6EF=>0xE516, + 0xF6B8=>0xE4DF, + 0xF787=>0xE56A, + 0xF640=>0xE468, + 0xF676=>0xE49E, + 0xF644=>0xE46C, + 0xF665=>0xE48D, + 0xF64E=>0xE476, + 0xF6FA=>0xE521, + 0xF6B9=>0xE4E0, + 0xF79A=>0xE57D, + 0xF7AC=>0xE58F, + 0xF6F0=>0xE517, + 0xF6D5=>0xE4FC, + 0xF79B=>0xE57E, + 0xF774=>0xE558, + 0xF684=>0xE4AB, + 0xF775=>0xE559, + 0xF6BD=>0xE4E4, + 0xF674=>0xE49C, + 0xF79C=>0xE57F, + 0xF7AD=>0xE590, + 0xF79D=>0xE580, + 0xF7B3=>0xE596, + 0xF6D7=>0xE4FE, + 0xF6D6=>0xE4FD, + 0xF778=>0xE55C, + 0xF799=>0xE57C, + 0xF779=>0xE55D, + 0xF776=>0xE55A, + 0xF6F1=>0xE518, + 0xF777=>0xE55B, + 0xF6F2=>0xE519, + 0xF790=>0xE573, + 0xF788=>0xE56B, + 0xF675=>0xE49D, + 0xF677=>0xE49F, + 0xF781=>0xE564, + 0xF79E=>0xE581, + 0xF7B4=>0xE597, + 0xF6F3=>0xE51A, + 0xF68A=>0xE4B1, + 0xF686=>0xE4AD, + 0xF79F=>0xE582, + 0xF78D=>0xE570, + 0xF791=>0xE574, + 0xF67A=>0xE4A2, + 0xF792=>0xE575, + 0xF793=>0xE576, + 0xF6F4=>0xE51B, + 0xF69D=>0xE4C4, + 0xF7A0=>0xE583, + 0xF7A5=>0xE588, + 0xF789=>0xE56C, + 0xF7A6=>0xE589, + 0xF77A=>0xE55E, + 0xF6DA=>0xE501, + 0xF6A7=>0xE4CE, + 0xF7A7=>0xE58A, + 0xF6BA=>0xE4E1, + 0xF6F8=>0xE51F, + 0xF7A1=>0xE584, + 0xF6F9=>0xE520, + 0xF77B=>0xE55F, + 0xF666=>0xE48E, + 0xF78A=>0xE56D, + 0xF68C=>0xE4B3, + 0xF6F5=>0xE51C, + 0xF68D=>0xE4B4, + 0xF7A2=>0xE585, + 0xF6A1=>0xE4C8, + 0xF6D8=>0xE4FF, + 0xF7A8=>0xE58B, + 0xF6D9=>0xE500, + 0xF68E=>0xE4B5, + 0xF78B=>0xE56E, + 0xF7A9=>0xE58C, + 0xF678=>0xE4A0, + 0xF7AA=>0xE58D, + 0xF6A8=>0xE4CF, + 0xF7AB=>0xE58E, + 0xF6F6=>0xE51D, + 0xF655=>0xE47D, + 0xF685=>0xE4AC, + 0xF656=>0xE47E, + 0xF78C=>0xE56F, + 0xF657=>0xE47F, + 0xF68B=>0xE4B2, + 0xF658=>0xE480, + 0xF679=>0xE4A1, + 0xF6FB=>0xE522, + 0xF7A3=>0xE586, + 0xF6FC=>0xE523, + 0xF7AE=>0xE591, + 0xF740=>0xE524, + 0xF7A4=>0xE587, + 0xF741=>0xE525, + 0xF7AF=>0xE592, + 0xF742=>0xE526, + 0xF7B0=>0xE593, + 0xF743=>0xE527, + 0xF6F7=>0xE51E, + 0xF744=>0xE528, + 0xF745=>0xE529, + 0xF643=>0xE46B, + 0xF746=>0xE52A, + 0xF68F=>0xE4B6, + 0xF747=>0xE52B, + 0xF690=>0xE4B7, + 0xF641=>0xE469, + 0xF691=>0xE4B8, + 0xF65D=>0xE485, + 0xF692=>0xE4B9, + 0xF667=>0xE48F, + 0xF645=>0xE46D, + 0xF668=>0xE490, + 0xF695=>0xE4BC, + 0xF669=>0xE491, + 0xF696=>0xE4BD, + 0xF66A=>0xE492, + 0xF697=>0xE4BE, + 0xF66B=>0xE493, + 0xF698=>0xE4BF, + 0xF66C=>0xE494, + 0xF699=>0xE4C0, + 0xF66D=>0xE495, + 0xF646=>0xE46E, + 0xF66E=>0xE496, + 0xF647=>0xE46F, + 0xF66F=>0xE497, + 0xF69E=>0xE4C5, + 0xF670=>0xE498, + 0xF69F=>0xE4C6, + 0xF671=>0xE499, + 0xF6A0=>0xE4C7, + 0xF672=>0xE49A, + 0xF6A2=>0xE4C9, + 0xF673=>0xE49B, + 0xF6A3=>0xE4CA, + 0xF67B=>0xE4A3, + 0xF6A4=>0xE4CB, + 0xF67C=>0xE4A4, + 0xF6A5=>0xE4CC, + 0xF67D=>0xE4A5, + 0xF6A6=>0xE4CD, + 0xF67E=>0xE4A6, + 0xF6A9=>0xE4D0, + 0xF680=>0xE4A7, + 0xF6AA=>0xE4D1, + 0xF681=>0xE4A8, + 0xF6AB=>0xE4D2, + 0xF682=>0xE4A9, + 0xF6AC=>0xE4D3, + 0xF683=>0xE4AA, + 0xF6AD=>0xE4D4, + 0xF78E=>0xE571, + 0xF6AE=>0xE4D5, + 0xF78F=>0xE572, + 0xF6AF=>0xE4D6, + 0xF687=>0xE4AE, + 0xF648=>0xE470, + 0xF688=>0xE4AF, + 0xF6B0=>0xE4D7, + 0xF689=>0xE4B0, + 0xF6B1=>0xE4D8, + 0xF6B2=>0xE4D9, + 0xF6CB=>0xE4F2, + 0xF6B3=>0xE4DA, + 0xF6CC=>0xE4F3, + 0xF6B4=>0xE4DB, + 0xF6CD=>0xE4F4, + 0xF6B5=>0xE4DC, + 0xF6CE=>0xE4F5, + 0xF6B6=>0xE4DD, + 0xF6CF=>0xE4F6, + 0xF6B7=>0xE4DE, + 0xF6D0=>0xE4F7, + 0xF6BB=>0xE4E2, + 0xF6D1=>0xE4F8, + 0xF6BC=>0xE4E3, + 0xF6D2=>0xE4F9, + 0xF649=>0xE471, + 0xF6DB=>0xE502, + 0xF64A=>0xE472, + 0xF6DC=>0xE503, + 0xF64B=>0xE473, + 0xF6DD=>0xE504, + 0xF64C=>0xE474, + 0xF6DE=>0xE505, + 0xF64D=>0xE475, + 0xF6DF=>0xE506, + 0xF6BE=>0xE4E5, + 0xF6E0=>0xE507, + 0xF6BF=>0xE4E6, + 0xF6E1=>0xE508, + 0xF6C0=>0xE4E7, + 0xF6E2=>0xE509, + 0xF64F=>0xE477, + 0xF6E3=>0xE50A, + 0xF650=>0xE478, + 0xF6E4=>0xE50B, + 0xF651=>0xE479, + 0xF794=>0xE577, + 0xF652=>0xE47A, + 0xF795=>0xE578, + 0xF653=>0xE47B, + 0xF6E5=>0xE50C, + 0xF6C1=>0xE4E8, + 0xF6E6=>0xE50D, + 0xF6C2=>0xE4E9, + 0xF6E7=>0xE50E, + 0xF6C3=>0xE4EA, + 0xF6E8=>0xE50F, + 0xF6C4=>0xE4EB, + 0xF6E9=>0xE510, + 0xF6C5=>0xE4EC, + 0xF7B5=>0xE598, + 0xF6C6=>0xE4ED, + 0xF7B6=>0xE599, + 0xF6C7=>0xE4EE, + 0xF7B7=>0xE59A, + 0xF6C8=>0xE4EF, + 0xF7B8=>0xE59B, + 0xF6C9=>0xE4F0, + 0xF7B9=>0xE59C, + 0xF6CA=>0xE4F1, + 0xF7BA=>0xE59D, + 0xF7BB=>0xE59E, + 0xF7ED=>0xE5BD, + 0xF7BC=>0xE59F, + 0xF7EE=>0xE5BE, + 0xF7BD=>0xE5A0, + 0xF7EF=>0xE5BF, + 0xF7BE=>0xE5A1, + 0xF7F0=>0xE5C0, + 0xF7BF=>0xE5A2, + 0xF7F1=>0xE5C1, + 0xF7C0=>0xE5A3, + 0xF7F2=>0xE5C2, + 0xF7C1=>0xE5A4, + 0xF7F3=>0xE5C3, + 0xF7C2=>0xE5A5, + 0xF7F4=>0xE5C4, + 0xF7C3=>0xE5A6, + 0xF7F5=>0xE5C5, + 0xF7C4=>0xE5A7, + 0xF7F6=>0xE5C6, + 0xF7C5=>0xE5A8, + 0xF7F7=>0xE5C7, + 0xF7C6=>0xE5A9, + 0xF7F8=>0xE5C8, + 0xF7C7=>0xE5AA, + 0xF7F9=>0xE5C9, + 0xF7C8=>0xE5AB, + 0xF7FA=>0xE5CA, + 0xF7C9=>0xE5AC, + 0xF7FB=>0xE5CB, + 0xF7CA=>0xE5AD, + 0xF7FC=>0xE5CC, + 0xF7CB=>0xE5AE, + 0xF340=>0xE5CD, + 0xF7CC=>0xE5AF, + 0xF341=>0xE5CE, + 0xF7CD=>0xE5B0, + 0xF342=>0xE5CF, + 0xF7CE=>0xE5B1, + 0xF343=>0xE5D0, + 0xF7CF=>0xE5B2, + 0xF344=>0xE5D1, + 0xF7D0=>0xE5B3, + 0xF345=>0xE5D2, + 0xF7D1=>0xE5B4, + 0xF346=>0xE5D3, + 0xF7E5=>0xE5B5, + 0xF347=>0xE5D4, + 0xF7E6=>0xE5B6, + 0xF348=>0xE5D5, + 0xF7E7=>0xE5B7, + 0xF349=>0xE5D6, + 0xF7E8=>0xE5B8, + 0xF34A=>0xE5D7, + 0xF7E9=>0xE5B9, + 0xF34B=>0xE5D8, + 0xF7EA=>0xE5BA, + 0xF34C=>0xE5D9, + 0xF7EB=>0xE5BB, + 0xF34D=>0xE5DA, + 0xF7EC=>0xE5BC, + 0xF34E=>0xE5DB, + 0xF34F=>0xE5DC, + 0xF36E=>0xEA9B, + 0xF350=>0xE5DD, + 0xF36F=>0xEA9C, + 0xF351=>0xE5DE, + 0xF370=>0xEA9D, + 0xF352=>0xE5DF, + 0xF371=>0xEA9E, + 0xF353=>0xEA80, + 0xF372=>0xEA9F, + 0xF354=>0xEA81, + 0xF373=>0xEAA0, + 0xF355=>0xEA82, + 0xF374=>0xEAA1, + 0xF356=>0xEA83, + 0xF375=>0xEAA2, + 0xF357=>0xEA84, + 0xF376=>0xEAA3, + 0xF358=>0xEA85, + 0xF377=>0xEAA4, + 0xF359=>0xEA86, + 0xF378=>0xEAA5, + 0xF35A=>0xEA87, + 0xF379=>0xEAA6, + 0xF35B=>0xEA88, + 0xF37A=>0xEAA7, + 0xF35C=>0xEA89, + 0xF37B=>0xEAA8, + 0xF35D=>0xEA8A, + 0xF37C=>0xEAA9, + 0xF35E=>0xEA8B, + 0xF37D=>0xEAAA, + 0xF35F=>0xEA8C, + 0xF37E=>0xEAAB, + 0xF360=>0xEA8D, + 0xF380=>0xEAAC, + 0xF361=>0xEA8E, + 0xF381=>0xEAAD, + 0xF362=>0xEA8F, + 0xF382=>0xEAAE, + 0xF363=>0xEA90, + 0xF383=>0xEAAF, + 0xF364=>0xEA91, + 0xF384=>0xEAB0, + 0xF365=>0xEA92, + 0xF385=>0xEAB1, + 0xF366=>0xEA93, + 0xF386=>0xEAB2, + 0xF367=>0xEA94, + 0xF387=>0xEAB3, + 0xF368=>0xEA95, + 0xF388=>0xEAB4, + 0xF369=>0xEA96, + 0xF389=>0xEAB5, + 0xF36A=>0xEA97, + 0xF38A=>0xEAB6, + 0xF36B=>0xEA98, + 0xF38B=>0xEAB7, + 0xF36C=>0xEA99, + 0xF38C=>0xEAB8, + 0xF36D=>0xEA9A, + 0xF38D=>0xEAB9, + 0xF38E=>0xEABA, + 0xF3AD=>0xEAD9, + 0xF38F=>0xEABB, + 0xF3AE=>0xEADA, + 0xF390=>0xEABC, + 0xF3AF=>0xEADB, + 0xF391=>0xEABD, + 0xF3B0=>0xEADC, + 0xF392=>0xEABE, + 0xF3B1=>0xEADD, + 0xF393=>0xEABF, + 0xF3B2=>0xEADE, + 0xF394=>0xEAC0, + 0xF3B3=>0xEADF, + 0xF395=>0xEAC1, + 0xF3B4=>0xEAE0, + 0xF396=>0xEAC2, + 0xF3B5=>0xEAE1, + 0xF397=>0xEAC3, + 0xF3B6=>0xEAE2, + 0xF398=>0xEAC4, + 0xF3B7=>0xEAE3, + 0xF399=>0xEAC5, + 0xF3B8=>0xEAE4, + 0xF39A=>0xEAC6, + 0xF3B9=>0xEAE5, + 0xF39B=>0xEAC7, + 0xF3BA=>0xEAE6, + 0xF39C=>0xEAC8, + 0xF3BB=>0xEAE7, + 0xF39D=>0xEAC9, + 0xF3BC=>0xEAE8, + 0xF39E=>0xEACA, + 0xF3BD=>0xEAE9, + 0xF39F=>0xEACB, + 0xF3BE=>0xEAEA, + 0xF3A0=>0xEACC, + 0xF3BF=>0xEAEB, + 0xF3A1=>0xEACD, + 0xF3C0=>0xEAEC, + 0xF3A2=>0xEACE, + 0xF3C1=>0xEAED, + 0xF3A3=>0xEACF, + 0xF3C2=>0xEAEE, + 0xF3A4=>0xEAD0, + 0xF3C3=>0xEAEF, + 0xF3A5=>0xEAD1, + 0xF3C4=>0xEAF0, + 0xF3A6=>0xEAD2, + 0xF3C5=>0xEAF1, + 0xF3A7=>0xEAD3, + 0xF3C6=>0xEAF2, + 0xF3A8=>0xEAD4, + 0xF3C7=>0xEAF3, + 0xF3A9=>0xEAD5, + 0xF3C8=>0xEAF4, + 0xF3AA=>0xEAD6, + 0xF3C9=>0xEAF5, + 0xF3AB=>0xEAD7, + 0xF3CA=>0xEAF6, + 0xF3AC=>0xEAD8, + 0xF3CB=>0xEAF7, + 0xF3CC=>0xEAF8, + 0xF3D8=>0xEB17, + 0xF3CD=>0xEAF9, + 0xF3D9=>0xEB18, + 0xF3CE=>0xEAFA, + 0xF3DA=>0xEB19, + 0xF7D2=>0xEAFB, + 0xF3DB=>0xEB1A, + 0xF7D3=>0xEAFC, + 0xF3DC=>0xEB1B, + 0xF7D4=>0xEAFD, + 0xF3DD=>0xEB1C, + 0xF7D5=>0xEAFE, + 0xF3DE=>0xEB1D, + 0xF7D6=>0xEAFF, + 0xF3DF=>0xEB1E, + 0xF7D7=>0xEB00, + 0xF3E0=>0xEB1F, + 0xF7D8=>0xEB01, + 0xF3E1=>0xEB20, + 0xF7D9=>0xEB02, + 0xF3E2=>0xEB21, + 0xF7DA=>0xEB03, + 0xF3E3=>0xEB22, + 0xF7DB=>0xEB04, + 0xF3E4=>0xEB23, + 0xF7DC=>0xEB05, + 0xF3E5=>0xEB24, + 0xF7DD=>0xEB06, + 0xF3E6=>0xEB25, + 0xF7DE=>0xEB07, + 0xF3E7=>0xEB26, + 0xF7DF=>0xEB08, + 0xF3E8=>0xEB27, + 0xF7E0=>0xEB09, + 0xF3E9=>0xEB28, + 0xF7E1=>0xEB0A, + 0xF3EA=>0xEB29, + 0xF7E2=>0xEB0B, + 0xF3EB=>0xEB2A, + 0xF7E3=>0xEB0C, + 0xF3EC=>0xEB2B, + 0xF7E4=>0xEB0D, + 0xF3ED=>0xEB2C, + 0xF3CF=>0xEB0E, + 0xF3EE=>0xEB2D, + 0xF3D0=>0xEB0F, + 0xF3EF=>0xEB2E, + 0xF3D1=>0xEB10, + 0xF3F0=>0xEB2F, + 0xF3D2=>0xEB11, + 0xF3F1=>0xEB30, + 0xF3D3=>0xEB12, + 0xF3F2=>0xEB31, + 0xF3D4=>0xEB13, + 0xF3F3=>0xEB32, + 0xF3D5=>0xEB14, + 0xF3F4=>0xEB33, + 0xF3D6=>0xEB15, + 0xF3F5=>0xEB34, + 0xF3D7=>0xEB16, + 0xF3F6=>0xEB35, + 0xF3F7=>0xEB36, + 0xF459=>0xEB55, + 0xF3F8=>0xEB37, + 0xF45A=>0xEB56, + 0xF3F9=>0xEB38, + 0xF45B=>0xEB57, + 0xF3FA=>0xEB39, + 0xF45C=>0xEB58, + 0xF3FB=>0xEB3A, + 0xF45D=>0xEB59, + 0xF3FC=>0xEB3B, + 0xF45E=>0xEB5A, + 0xF440=>0xEB3C, + 0xF45F=>0xEB5B, + 0xF441=>0xEB3D, + 0xF460=>0xEB5C, + 0xF442=>0xEB3E, + 0xF461=>0xEB5D, + 0xF443=>0xEB3F, + 0xF462=>0xEB5E, + 0xF444=>0xEB40, + 0xF463=>0xEB5F, + 0xF445=>0xEB41, + 0xF464=>0xEB60, + 0xF446=>0xEB42, + 0xF465=>0xEB61, + 0xF447=>0xEB43, + 0xF466=>0xEB62, + 0xF448=>0xEB44, + 0xF467=>0xEB63, + 0xF449=>0xEB45, + 0xF468=>0xEB64, + 0xF44A=>0xEB46, + 0xF469=>0xEB65, + 0xF44B=>0xEB47, + 0xF46A=>0xEB66, + 0xF44C=>0xEB48, + 0xF46B=>0xEB67, + 0xF44D=>0xEB49, + 0xF46C=>0xEB68, + 0xF44E=>0xEB4A, + 0xF46D=>0xEB69, + 0xF44F=>0xEB4B, + 0xF46E=>0xEB6A, + 0xF450=>0xEB4C, + 0xF46F=>0xEB6B, + 0xF451=>0xEB4D, + 0xF470=>0xEB6C, + 0xF452=>0xEB4E, + 0xF471=>0xEB6D, + 0xF453=>0xEB4F, + 0xF472=>0xEB6E, + 0xF454=>0xEB50, + 0xF473=>0xEB6F, + 0xF455=>0xEB51, + 0xF474=>0xEB70, + 0xF456=>0xEB52, + 0xF475=>0xEB71, + 0xF457=>0xEB53, + 0xF476=>0xEB72, + 0xF458=>0xEB54, + 0xF477=>0xEB73, + 0xF478=>0xEB74, + 0xF479=>0xEB75, + 0xF47A=>0xEB76, + 0xF47B=>0xEB77, + 0xF47C=>0xEB78, + 0xF47D=>0xEB79, + 0xF47E=>0xEB7A, + 0xF480=>0xEB7B, + 0xF481=>0xEB7C, + 0xF482=>0xEB7D, + 0xF483=>0xEB7E, + 0xF484=>0xEB7F, + 0xF485=>0xEB80, + 0xF486=>0xEB81, + 0xF487=>0xEB82, + 0xF488=>0xEB83, + 0xF489=>0xEB84, + 0xF48A=>0xEB85, + 0xF48B=>0xEB86, + 0xF48C=>0xEB87, + 0xF48D=>0xEB88, + }.freeze + AU_UNICODE_TO_SJIS = AU_SJIS_TO_UNICODE.invert.freeze + AU_EMAILJIS_TO_UNICODE = { + 0x753A=>0xE481, + 0x773F=>0xE542, + 0x753B=>0xE482, + 0x7740=>0xE543, + 0x753C=>0xE483, + 0x7741=>0xE544, + 0x7729=>0xE52C, + 0x7742=>0xE545, + 0x772A=>0xE52D, + 0x7743=>0xE546, + 0x772B=>0xE52E, + 0x7744=>0xE547, + 0x772C=>0xE52F, + 0x7745=>0xE548, + 0x772D=>0xE530, + 0x7746=>0xE549, + 0x772E=>0xE531, + 0x7747=>0xE54A, + 0x772F=>0xE532, + 0x7748=>0xE54B, + 0x7730=>0xE533, + 0x7749=>0xE54C, + 0x757A=>0xE4C1, + 0x774A=>0xE54D, + 0x766C=>0xE511, + 0x7541=>0xE488, + 0x7776=>0xE579, + 0x7573=>0xE4BA, + 0x753F=>0xE486, + 0x7833=>0xE594, + 0x7540=>0xE487, + 0x7542=>0xE489, + 0x7731=>0xE534, + 0x766D=>0xE512, + 0x7732=>0xE535, + 0x775D=>0xE560, + 0x7733=>0xE536, + 0x7655=>0xE4FA, + 0x7734=>0xE537, + 0x7834=>0xE595, + 0x7735=>0xE538, + 0x757B=>0xE4C2, + 0x7736=>0xE539, + 0x766E=>0xE513, + 0x7737=>0xE53A, + 0x774B=>0xE54E, + 0x7738=>0xE53B, + 0x774C=>0xE54F, + 0x7777=>0xE57A, + 0x775E=>0xE561, + 0x7739=>0xE53C, + 0x7778=>0xE57B, + 0x773A=>0xE53D, + 0x7535=>0xE47C, + 0x773B=>0xE53E, + 0x775F=>0xE562, + 0x773C=>0xE53F, + 0x7543=>0xE48A, + 0x773D=>0xE540, + 0x774D=>0xE550, + 0x773E=>0xE541, + 0x774E=>0xE551, + 0x774F=>0xE552, + 0x7670=>0xE515, + 0x7750=>0xE553, + 0x7545=>0xE48C, + 0x757C=>0xE4C3, + 0x7574=>0xE4BB, + 0x7751=>0xE554, + 0x7762=>0xE565, + 0x7760=>0xE563, + 0x753D=>0xE484, + 0x7656=>0xE4FB, + 0x7523=>0xE46A, + 0x7544=>0xE48B, + 0x7763=>0xE566, + 0x7752=>0xE555, + 0x7764=>0xE567, + 0x7753=>0xE556, + 0x7765=>0xE568, + 0x766F=>0xE514, + 0x7766=>0xE569, + 0x7754=>0xE557, + 0x7671=>0xE516, + 0x763A=>0xE4DF, + 0x7767=>0xE56A, + 0x7521=>0xE468, + 0x7557=>0xE49E, + 0x7525=>0xE46C, + 0x7546=>0xE48D, + 0x752F=>0xE476, + 0x767C=>0xE521, + 0x763B=>0xE4E0, + 0x777A=>0xE57D, + 0x782E=>0xE58F, + 0x7672=>0xE517, + 0x7657=>0xE4FC, + 0x777B=>0xE57E, + 0x7755=>0xE558, + 0x7564=>0xE4AB, + 0x7756=>0xE559, + 0x763F=>0xE4E4, + 0x7555=>0xE49C, + 0x777C=>0xE57F, + 0x782F=>0xE590, + 0x777D=>0xE580, + 0x7835=>0xE596, + 0x7659=>0xE4FE, + 0x7658=>0xE4FD, + 0x7759=>0xE55C, + 0x7779=>0xE57C, + 0x775A=>0xE55D, + 0x7757=>0xE55A, + 0x7673=>0xE518, + 0x7758=>0xE55B, + 0x7674=>0xE519, + 0x7770=>0xE573, + 0x7768=>0xE56B, + 0x7556=>0xE49D, + 0x7558=>0xE49F, + 0x7761=>0xE564, + 0x777E=>0xE581, + 0x7836=>0xE597, + 0x7675=>0xE51A, + 0x756A=>0xE4B1, + 0x7566=>0xE4AD, + 0x7821=>0xE582, + 0x776D=>0xE570, + 0x7771=>0xE574, + 0x755B=>0xE4A2, + 0x7772=>0xE575, + 0x7773=>0xE576, + 0x7676=>0xE51B, + 0x757D=>0xE4C4, + 0x7822=>0xE583, + 0x7827=>0xE588, + 0x7769=>0xE56C, + 0x7828=>0xE589, + 0x775B=>0xE55E, + 0x765C=>0xE501, + 0x7629=>0xE4CE, + 0x7829=>0xE58A, + 0x763C=>0xE4E1, + 0x767A=>0xE51F, + 0x7823=>0xE584, + 0x767B=>0xE520, + 0x775C=>0xE55F, + 0x7547=>0xE48E, + 0x776A=>0xE56D, + 0x756C=>0xE4B3, + 0x7677=>0xE51C, + 0x756D=>0xE4B4, + 0x7824=>0xE585, + 0x7623=>0xE4C8, + 0x765A=>0xE4FF, + 0x782A=>0xE58B, + 0x765B=>0xE500, + 0x756E=>0xE4B5, + 0x776B=>0xE56E, + 0x782B=>0xE58C, + 0x7559=>0xE4A0, + 0x782C=>0xE58D, + 0x762A=>0xE4CF, + 0x782D=>0xE58E, + 0x7678=>0xE51D, + 0x7536=>0xE47D, + 0x7565=>0xE4AC, + 0x7537=>0xE47E, + 0x776C=>0xE56F, + 0x7538=>0xE47F, + 0x756B=>0xE4B2, + 0x7539=>0xE480, + 0x755A=>0xE4A1, + 0x767D=>0xE522, + 0x7825=>0xE586, + 0x767E=>0xE523, + 0x7830=>0xE591, + 0x7721=>0xE524, + 0x7826=>0xE587, + 0x7722=>0xE525, + 0x7831=>0xE592, + 0x7723=>0xE526, + 0x7832=>0xE593, + 0x7724=>0xE527, + 0x7679=>0xE51E, + 0x7725=>0xE528, + 0x7726=>0xE529, + 0x7524=>0xE46B, + 0x7727=>0xE52A, + 0x756F=>0xE4B6, + 0x7728=>0xE52B, + 0x7570=>0xE4B7, + 0x7522=>0xE469, + 0x7571=>0xE4B8, + 0x753E=>0xE485, + 0x7572=>0xE4B9, + 0x7548=>0xE48F, + 0x7526=>0xE46D, + 0x7549=>0xE490, + 0x7575=>0xE4BC, + 0x754A=>0xE491, + 0x7576=>0xE4BD, + 0x754B=>0xE492, + 0x7577=>0xE4BE, + 0x754C=>0xE493, + 0x7578=>0xE4BF, + 0x754D=>0xE494, + 0x7579=>0xE4C0, + 0x754E=>0xE495, + 0x7527=>0xE46E, + 0x754F=>0xE496, + 0x7528=>0xE46F, + 0x7550=>0xE497, + 0x757E=>0xE4C5, + 0x7551=>0xE498, + 0x7621=>0xE4C6, + 0x7552=>0xE499, + 0x7622=>0xE4C7, + 0x7553=>0xE49A, + 0x7624=>0xE4C9, + 0x7554=>0xE49B, + 0x7625=>0xE4CA, + 0x755C=>0xE4A3, + 0x7626=>0xE4CB, + 0x755D=>0xE4A4, + 0x7627=>0xE4CC, + 0x755E=>0xE4A5, + 0x7628=>0xE4CD, + 0x755F=>0xE4A6, + 0x762B=>0xE4D0, + 0x7560=>0xE4A7, + 0x762C=>0xE4D1, + 0x7561=>0xE4A8, + 0x762D=>0xE4D2, + 0x7562=>0xE4A9, + 0x762E=>0xE4D3, + 0x7563=>0xE4AA, + 0x762F=>0xE4D4, + 0x776E=>0xE571, + 0x7630=>0xE4D5, + 0x776F=>0xE572, + 0x7631=>0xE4D6, + 0x7567=>0xE4AE, + 0x7529=>0xE470, + 0x7568=>0xE4AF, + 0x7632=>0xE4D7, + 0x7569=>0xE4B0, + 0x7633=>0xE4D8, + 0x7634=>0xE4D9, + 0x764D=>0xE4F2, + 0x7635=>0xE4DA, + 0x764E=>0xE4F3, + 0x7636=>0xE4DB, + 0x764F=>0xE4F4, + 0x7637=>0xE4DC, + 0x7650=>0xE4F5, + 0x7638=>0xE4DD, + 0x7651=>0xE4F6, + 0x7639=>0xE4DE, + 0x7652=>0xE4F7, + 0x763D=>0xE4E2, + 0x7653=>0xE4F8, + 0x763E=>0xE4E3, + 0x7654=>0xE4F9, + 0x752A=>0xE471, + 0x765D=>0xE502, + 0x752B=>0xE472, + 0x765E=>0xE503, + 0x752C=>0xE473, + 0x765F=>0xE504, + 0x752D=>0xE474, + 0x7660=>0xE505, + 0x752E=>0xE475, + 0x7661=>0xE506, + 0x7640=>0xE4E5, + 0x7662=>0xE507, + 0x7641=>0xE4E6, + 0x7663=>0xE508, + 0x7642=>0xE4E7, + 0x7664=>0xE509, + 0x7530=>0xE477, + 0x7665=>0xE50A, + 0x7531=>0xE478, + 0x7666=>0xE50B, + 0x7532=>0xE479, + 0x7774=>0xE577, + 0x7533=>0xE47A, + 0x7775=>0xE578, + 0x7534=>0xE47B, + 0x7667=>0xE50C, + 0x7643=>0xE4E8, + 0x7668=>0xE50D, + 0x7644=>0xE4E9, + 0x7669=>0xE50E, + 0x7645=>0xE4EA, + 0x766A=>0xE50F, + 0x7646=>0xE4EB, + 0x766B=>0xE510, + 0x7647=>0xE4EC, + 0x7837=>0xE598, + 0x7648=>0xE4ED, + 0x7838=>0xE599, + 0x7649=>0xE4EE, + 0x7839=>0xE59A, + 0x764A=>0xE4EF, + 0x783A=>0xE59B, + 0x764B=>0xE4F0, + 0x783B=>0xE59C, + 0x764C=>0xE4F1, + 0x783C=>0xE59D, + 0x783D=>0xE59E, + 0x786F=>0xE5BD, + 0x783E=>0xE59F, + 0x7870=>0xE5BE, + 0x783F=>0xE5A0, + 0x7871=>0xE5BF, + 0x7840=>0xE5A1, + 0x7872=>0xE5C0, + 0x7841=>0xE5A2, + 0x7873=>0xE5C1, + 0x7842=>0xE5A3, + 0x7874=>0xE5C2, + 0x7843=>0xE5A4, + 0x7875=>0xE5C3, + 0x7844=>0xE5A5, + 0x7876=>0xE5C4, + 0x7845=>0xE5A6, + 0x7877=>0xE5C5, + 0x7846=>0xE5A7, + 0x7878=>0xE5C6, + 0x7847=>0xE5A8, + 0x7879=>0xE5C7, + 0x7848=>0xE5A9, + 0x787A=>0xE5C8, + 0x7849=>0xE5AA, + 0x787B=>0xE5C9, + 0x784A=>0xE5AB, + 0x787C=>0xE5CA, + 0x784B=>0xE5AC, + 0x787D=>0xE5CB, + 0x784C=>0xE5AD, + 0x787E=>0xE5CC, + 0x784D=>0xE5AE, + 0x7921=>0xE5CD, + 0x784E=>0xE5AF, + 0x7922=>0xE5CE, + 0x784F=>0xE5B0, + 0x7923=>0xE5CF, + 0x7850=>0xE5B1, + 0x7924=>0xE5D0, + 0x7851=>0xE5B2, + 0x7925=>0xE5D1, + 0x7852=>0xE5B3, + 0x7926=>0xE5D2, + 0x7853=>0xE5B4, + 0x7927=>0xE5D3, + 0x7867=>0xE5B5, + 0x7928=>0xE5D4, + 0x7868=>0xE5B6, + 0x7929=>0xE5D5, + 0x7869=>0xE5B7, + 0x792A=>0xE5D6, + 0x786A=>0xE5B8, + 0x792B=>0xE5D7, + 0x786B=>0xE5B9, + 0x792C=>0xE5D8, + 0x786C=>0xE5BA, + 0x792D=>0xE5D9, + 0x786D=>0xE5BB, + 0x792E=>0xE5DA, + 0x786E=>0xE5BC, + 0x792F=>0xE5DB, + 0x7930=>0xE5DC, + 0x794F=>0xEA9B, + 0x7931=>0xE5DD, + 0x7950=>0xEA9C, + 0x7932=>0xE5DE, + 0x7951=>0xEA9D, + 0x7933=>0xE5DF, + 0x7952=>0xEA9E, + 0x7934=>0xEA80, + 0x7953=>0xEA9F, + 0x7935=>0xEA81, + 0x7954=>0xEAA0, + 0x7936=>0xEA82, + 0x7955=>0xEAA1, + 0x7937=>0xEA83, + 0x7956=>0xEAA2, + 0x7938=>0xEA84, + 0x7957=>0xEAA3, + 0x7939=>0xEA85, + 0x7958=>0xEAA4, + 0x793A=>0xEA86, + 0x7959=>0xEAA5, + 0x793B=>0xEA87, + 0x795A=>0xEAA6, + 0x793C=>0xEA88, + 0x795B=>0xEAA7, + 0x793D=>0xEA89, + 0x795C=>0xEAA8, + 0x793E=>0xEA8A, + 0x795D=>0xEAA9, + 0x793F=>0xEA8B, + 0x795E=>0xEAAA, + 0x7940=>0xEA8C, + 0x795F=>0xEAAB, + 0x7941=>0xEA8D, + 0x7960=>0xEAAC, + 0x7942=>0xEA8E, + 0x7961=>0xEAAD, + 0x7943=>0xEA8F, + 0x7962=>0xEAAE, + 0x7944=>0xEA90, + 0x7963=>0xEAAF, + 0x7945=>0xEA91, + 0x7964=>0xEAB0, + 0x7946=>0xEA92, + 0x7965=>0xEAB1, + 0x7947=>0xEA93, + 0x7966=>0xEAB2, + 0x7948=>0xEA94, + 0x7967=>0xEAB3, + 0x7949=>0xEA95, + 0x7968=>0xEAB4, + 0x794A=>0xEA96, + 0x7969=>0xEAB5, + 0x794B=>0xEA97, + 0x796A=>0xEAB6, + 0x794C=>0xEA98, + 0x796B=>0xEAB7, + 0x794D=>0xEA99, + 0x796C=>0xEAB8, + 0x794E=>0xEA9A, + 0x796D=>0xEAB9, + 0x796E=>0xEABA, + 0x7A2F=>0xEAD9, + 0x796F=>0xEABB, + 0x7A30=>0xEADA, + 0x7970=>0xEABC, + 0x7A31=>0xEADB, + 0x7971=>0xEABD, + 0x7A32=>0xEADC, + 0x7972=>0xEABE, + 0x7A33=>0xEADD, + 0x7973=>0xEABF, + 0x7A34=>0xEADE, + 0x7974=>0xEAC0, + 0x7A35=>0xEADF, + 0x7975=>0xEAC1, + 0x7A36=>0xEAE0, + 0x7976=>0xEAC2, + 0x7A37=>0xEAE1, + 0x7977=>0xEAC3, + 0x7A38=>0xEAE2, + 0x7978=>0xEAC4, + 0x7A39=>0xEAE3, + 0x7979=>0xEAC5, + 0x7A3A=>0xEAE4, + 0x797A=>0xEAC6, + 0x7A3B=>0xEAE5, + 0x797B=>0xEAC7, + 0x7A3C=>0xEAE6, + 0x797C=>0xEAC8, + 0x7A3D=>0xEAE7, + 0x797D=>0xEAC9, + 0x7A3E=>0xEAE8, + 0x797E=>0xEACA, + 0x7A3F=>0xEAE9, + 0x7A21=>0xEACB, + 0x7A40=>0xEAEA, + 0x7A22=>0xEACC, + 0x7A41=>0xEAEB, + 0x7A23=>0xEACD, + 0x7A42=>0xEAEC, + 0x7A24=>0xEACE, + 0x7A43=>0xEAED, + 0x7A25=>0xEACF, + 0x7A44=>0xEAEE, + 0x7A26=>0xEAD0, + 0x7A45=>0xEAEF, + 0x7A27=>0xEAD1, + 0x7A46=>0xEAF0, + 0x7A28=>0xEAD2, + 0x7A47=>0xEAF1, + 0x7A29=>0xEAD3, + 0x7A48=>0xEAF2, + 0x7A2A=>0xEAD4, + 0x7A49=>0xEAF3, + 0x7A2B=>0xEAD5, + 0x7A4A=>0xEAF4, + 0x7A2C=>0xEAD6, + 0x7A4B=>0xEAF5, + 0x7A2D=>0xEAD7, + 0x7A4C=>0xEAF6, + 0x7A2E=>0xEAD8, + 0x7A4D=>0xEAF7, + 0x7A4E=>0xEAF8, + 0x7A5A=>0xEB17, + 0x7A4F=>0xEAF9, + 0x7A5B=>0xEB18, + 0x7A50=>0xEAFA, + 0x7A5C=>0xEB19, + 0x7854=>0xEAFB, + 0x7A5D=>0xEB1A, + 0x7855=>0xEAFC, + 0x7A5E=>0xEB1B, + 0x7856=>0xEAFD, + 0x7A5F=>0xEB1C, + 0x7857=>0xEAFE, + 0x7A60=>0xEB1D, + 0x7858=>0xEAFF, + 0x7A61=>0xEB1E, + 0x7859=>0xEB00, + 0x7A62=>0xEB1F, + 0x785A=>0xEB01, + 0x7A63=>0xEB20, + 0x785B=>0xEB02, + 0x7A64=>0xEB21, + 0x785C=>0xEB03, + 0x7A65=>0xEB22, + 0x785D=>0xEB04, + 0x7A66=>0xEB23, + 0x785E=>0xEB05, + 0x7A67=>0xEB24, + 0x785F=>0xEB06, + 0x7A68=>0xEB25, + 0x7860=>0xEB07, + 0x7A69=>0xEB26, + 0x7861=>0xEB08, + 0x7A6A=>0xEB27, + 0x7862=>0xEB09, + 0x7A6B=>0xEB28, + 0x7863=>0xEB0A, + 0x7A6C=>0xEB29, + 0x7864=>0xEB0B, + 0x7A6D=>0xEB2A, + 0x7865=>0xEB0C, + 0x7A6E=>0xEB2B, + 0x7866=>0xEB0D, + 0x7A6F=>0xEB2C, + 0x7A51=>0xEB0E, + 0x7A70=>0xEB2D, + 0x7A52=>0xEB0F, + 0x7A71=>0xEB2E, + 0x7A53=>0xEB10, + 0x7A72=>0xEB2F, + 0x7A54=>0xEB11, + 0x7A73=>0xEB30, + 0x7A55=>0xEB12, + 0x7A74=>0xEB31, + 0x7A56=>0xEB13, + 0x7A75=>0xEB32, + 0x7A57=>0xEB14, + 0x7A76=>0xEB33, + 0x7A58=>0xEB15, + 0x7A77=>0xEB34, + 0x7A59=>0xEB16, + 0x7A78=>0xEB35, + 0x7A79=>0xEB36, + 0x7B3A=>0xEB55, + 0x7A7A=>0xEB37, + 0x7B3B=>0xEB56, + 0x7A7B=>0xEB38, + 0x7B3C=>0xEB57, + 0x7A7C=>0xEB39, + 0x7B3D=>0xEB58, + 0x7A7D=>0xEB3A, + 0x7B3E=>0xEB59, + 0x7A7E=>0xEB3B, + 0x7B3F=>0xEB5A, + 0x7B21=>0xEB3C, + 0x7B40=>0xEB5B, + 0x7B22=>0xEB3D, + 0x7B41=>0xEB5C, + 0x7B23=>0xEB3E, + 0x7B42=>0xEB5D, + 0x7B24=>0xEB3F, + 0x7B43=>0xEB5E, + 0x7B25=>0xEB40, + 0x7B44=>0xEB5F, + 0x7B26=>0xEB41, + 0x7B45=>0xEB60, + 0x7B27=>0xEB42, + 0x7B46=>0xEB61, + 0x7B28=>0xEB43, + 0x7B47=>0xEB62, + 0x7B29=>0xEB44, + 0x7B48=>0xEB63, + 0x7B2A=>0xEB45, + 0x7B49=>0xEB64, + 0x7B2B=>0xEB46, + 0x7B4A=>0xEB65, + 0x7B2C=>0xEB47, + 0x7B4B=>0xEB66, + 0x7B2D=>0xEB48, + 0x7B4C=>0xEB67, + 0x7B2E=>0xEB49, + 0x7B4D=>0xEB68, + 0x7B2F=>0xEB4A, + 0x7B4E=>0xEB69, + 0x7B30=>0xEB4B, + 0x7B4F=>0xEB6A, + 0x7B31=>0xEB4C, + 0x7B50=>0xEB6B, + 0x7B32=>0xEB4D, + 0x7B51=>0xEB6C, + 0x7B33=>0xEB4E, + 0x7B52=>0xEB6D, + 0x7B34=>0xEB4F, + 0x7B53=>0xEB6E, + 0x7B35=>0xEB50, + 0x7B54=>0xEB6F, + 0x7B36=>0xEB51, + 0x7B55=>0xEB70, + 0x7B37=>0xEB52, + 0x7B56=>0xEB71, + 0x7B38=>0xEB53, + 0x7B57=>0xEB72, + 0x7B39=>0xEB54, + 0x7B58=>0xEB73, + 0x7B59=>0xEB74, + 0x7B5A=>0xEB75, + 0x7B5B=>0xEB76, + 0x7B5C=>0xEB77, + 0x7B5D=>0xEB78, + 0x7B5E=>0xEB79, + 0x7B5F=>0xEB7A, + 0x7B60=>0xEB7B, + 0x7B61=>0xEB7C, + 0x7B62=>0xEB7D, + 0x7B63=>0xEB7E, + 0x7B64=>0xEB7F, + 0x7B65=>0xEB80, + 0x7B66=>0xEB81, + 0x7B67=>0xEB82, + 0x7B68=>0xEB83, + 0x7B69=>0xEB84, + 0x7B6A=>0xEB85, + 0x7B6B=>0xEB86, + 0x7B6C=>0xEB87, + 0x7B6D=>0xEB88, + }.freeze + end +end \ No newline at end of file diff --git a/lib/emoticon/conversion_table/docomo.rb b/lib/emoticon/conversion_table/docomo.rb new file mode 100644 index 0000000..4f51043 --- /dev/null +++ b/lib/emoticon/conversion_table/docomo.rb @@ -0,0 +1,259 @@ +module Emoticon + module ConversionTable + DOCOMO_SJIS_TO_UNICODE = { + 0xF89F=>0xE63E, + 0xF8A0=>0xE63F, + 0xF8A1=>0xE640, + 0xF8A2=>0xE641, + 0xF8A3=>0xE642, + 0xF8A4=>0xE643, + 0xF8A5=>0xE644, + 0xF8A6=>0xE645, + 0xF8A7=>0xE646, + 0xF8A8=>0xE647, + 0xF8A9=>0xE648, + 0xF8AA=>0xE649, + 0xF8AB=>0xE64A, + 0xF8AC=>0xE64B, + 0xF8AD=>0xE64C, + 0xF8AE=>0xE64D, + 0xF8AF=>0xE64E, + 0xF8B0=>0xE64F, + 0xF8B1=>0xE650, + 0xF8B2=>0xE651, + 0xF8B3=>0xE652, + 0xF8B4=>0xE653, + 0xF8B5=>0xE654, + 0xF8B6=>0xE655, + 0xF8B7=>0xE656, + 0xF8B8=>0xE657, + 0xF8B9=>0xE658, + 0xF8BA=>0xE659, + 0xF8BB=>0xE65A, + 0xF8BC=>0xE65B, + 0xF8BD=>0xE65C, + 0xF8BE=>0xE65D, + 0xF8BF=>0xE65E, + 0xF8C0=>0xE65F, + 0xF8C1=>0xE660, + 0xF8C2=>0xE661, + 0xF8C3=>0xE662, + 0xF8C4=>0xE663, + 0xF8C5=>0xE664, + 0xF8C6=>0xE665, + 0xF8C7=>0xE666, + 0xF8C8=>0xE667, + 0xF8C9=>0xE668, + 0xF8CA=>0xE669, + 0xF8CB=>0xE66A, + 0xF8CC=>0xE66B, + 0xF8CD=>0xE66C, + 0xF8CE=>0xE66D, + 0xF8CF=>0xE66E, + 0xF8D0=>0xE66F, + 0xF8D1=>0xE670, + 0xF8D2=>0xE671, + 0xF8D3=>0xE672, + 0xF8D4=>0xE673, + 0xF8D5=>0xE674, + 0xF8D6=>0xE675, + 0xF8D7=>0xE676, + 0xF8D8=>0xE677, + 0xF8D9=>0xE678, + 0xF8DA=>0xE679, + 0xF8DB=>0xE67A, + 0xF8DC=>0xE67B, + 0xF8DD=>0xE67C, + 0xF8DE=>0xE67D, + 0xF8DF=>0xE67E, + 0xF8E0=>0xE67F, + 0xF8E1=>0xE680, + 0xF8E2=>0xE681, + 0xF8E3=>0xE682, + 0xF8E4=>0xE683, + 0xF8E5=>0xE684, + 0xF8E6=>0xE685, + 0xF8E7=>0xE686, + 0xF8E8=>0xE687, + 0xF8E9=>0xE688, + 0xF8EA=>0xE689, + 0xF8EB=>0xE68A, + 0xF8EC=>0xE68B, + 0xF8ED=>0xE68C, + 0xF8EE=>0xE68D, + 0xF8EF=>0xE68E, + 0xF8F0=>0xE68F, + 0xF8F1=>0xE690, + 0xF8F2=>0xE691, + 0xF8F3=>0xE692, + 0xF8F4=>0xE693, + 0xF8F5=>0xE694, + 0xF8F6=>0xE695, + 0xF8F7=>0xE696, + 0xF8F8=>0xE697, + 0xF8F9=>0xE698, + 0xF8FA=>0xE699, + 0xF8FB=>0xE69A, + 0xF8FC=>0xE69B, + 0xF940=>0xE69C, + 0xF941=>0xE69D, + 0xF942=>0xE69E, + 0xF943=>0xE69F, + 0xF944=>0xE6A0, + 0xF945=>0xE6A1, + 0xF946=>0xE6A2, + 0xF947=>0xE6A3, + 0xF948=>0xE6A4, + 0xF949=>0xE6A5, + 0xF972=>0xE6CE, + 0xF973=>0xE6CF, + 0xF974=>0xE6D0, + 0xF975=>0xE6D1, + 0xF976=>0xE6D2, + 0xF977=>0xE6D3, + 0xF978=>0xE6D4, + 0xF979=>0xE6D5, + 0xF97A=>0xE6D6, + 0xF97B=>0xE6D7, + 0xF97C=>0xE6D8, + 0xF97D=>0xE6D9, + 0xF97E=>0xE6DA, + 0xF980=>0xE6DB, + 0xF981=>0xE6DC, + 0xF982=>0xE6DD, + 0xF983=>0xE6DE, + 0xF984=>0xE6DF, + 0xF985=>0xE6E0, + 0xF986=>0xE6E1, + 0xF987=>0xE6E2, + 0xF988=>0xE6E3, + 0xF989=>0xE6E4, + 0xF98A=>0xE6E5, + 0xF98B=>0xE6E6, + 0xF98C=>0xE6E7, + 0xF98D=>0xE6E8, + 0xF98E=>0xE6E9, + 0xF98F=>0xE6EA, + 0xF990=>0xE6EB, + 0xF9B0=>0xE70B, + 0xF991=>0xE6EC, + 0xF992=>0xE6ED, + 0xF993=>0xE6EE, + 0xF994=>0xE6EF, + 0xF995=>0xE6F0, + 0xF996=>0xE6F1, + 0xF997=>0xE6F2, + 0xF998=>0xE6F3, + 0xF999=>0xE6F4, + 0xF99A=>0xE6F5, + 0xF99B=>0xE6F6, + 0xF99C=>0xE6F7, + 0xF99D=>0xE6F8, + 0xF99E=>0xE6F9, + 0xF99F=>0xE6FA, + 0xF9A0=>0xE6FB, + 0xF9A1=>0xE6FC, + 0xF9A2=>0xE6FD, + 0xF9A3=>0xE6FE, + 0xF9A4=>0xE6FF, + 0xF9A5=>0xE700, + 0xF9A6=>0xE701, + 0xF9A7=>0xE702, + 0xF9A8=>0xE703, + 0xF9A9=>0xE704, + 0xF9AA=>0xE705, + 0xF9AB=>0xE706, + 0xF9AC=>0xE707, + 0xF9AD=>0xE708, + 0xF9AE=>0xE709, + 0xF9AF=>0xE70A, + 0xF950=>0xE6AC, + 0xF951=>0xE6AD, + 0xF952=>0xE6AE, + 0xF955=>0xE6B1, + 0xF956=>0xE6B2, + 0xF957=>0xE6B3, + 0xF95B=>0xE6B7, + 0xF95C=>0xE6B8, + 0xF95D=>0xE6B9, + 0xF95E=>0xE6BA, + 0xF9B1=>0xE70C, + 0xF9B2=>0xE70D, + 0xF9B3=>0xE70E, + 0xF9B4=>0xE70F, + 0xF9B5=>0xE710, + 0xF9B6=>0xE711, + 0xF9B7=>0xE712, + 0xF9B8=>0xE713, + 0xF9B9=>0xE714, + 0xF9BA=>0xE715, + 0xF9BB=>0xE716, + 0xF9BC=>0xE717, + 0xF9BD=>0xE718, + 0xF9BE=>0xE719, + 0xF9BF=>0xE71A, + 0xF9C0=>0xE71B, + 0xF9C1=>0xE71C, + 0xF9C2=>0xE71D, + 0xF9C3=>0xE71E, + 0xF9C4=>0xE71F, + 0xF9C5=>0xE720, + 0xF9C6=>0xE721, + 0xF9C7=>0xE722, + 0xF9C8=>0xE723, + 0xF9C9=>0xE724, + 0xF9CA=>0xE725, + 0xF9CB=>0xE726, + 0xF9CC=>0xE727, + 0xF9CD=>0xE728, + 0xF9CE=>0xE729, + 0xF9CF=>0xE72A, + 0xF9D0=>0xE72B, + 0xF9D1=>0xE72C, + 0xF9D2=>0xE72D, + 0xF9D3=>0xE72E, + 0xF9D4=>0xE72F, + 0xF9D5=>0xE730, + 0xF9D6=>0xE731, + 0xF9D7=>0xE732, + 0xF9D8=>0xE733, + 0xF9D9=>0xE734, + 0xF9DA=>0xE735, + 0xF9DB=>0xE736, + 0xF9DC=>0xE737, + 0xF9DD=>0xE738, + 0xF9DE=>0xE739, + 0xF9DF=>0xE73A, + 0xF9E0=>0xE73B, + 0xF9E1=>0xE73C, + 0xF9E2=>0xE73D, + 0xF9E3=>0xE73E, + 0xF9E4=>0xE73F, + 0xF9E5=>0xE740, + 0xF9E6=>0xE741, + 0xF9E7=>0xE742, + 0xF9E8=>0xE743, + 0xF9E9=>0xE744, + 0xF9EA=>0xE745, + 0xF9EB=>0xE746, + 0xF9EC=>0xE747, + 0xF9ED=>0xE748, + 0xF9EE=>0xE749, + 0xF9EF=>0xE74A, + 0xF9F0=>0xE74B, + 0xF9F1=>0xE74C, + 0xF9F2=>0xE74D, + 0xF9F3=>0xE74E, + 0xF9F4=>0xE74F, + 0xF9F5=>0xE750, + 0xF9F6=>0xE751, + 0xF9F7=>0xE752, + 0xF9F8=>0xE753, + 0xF9F9=>0xE754, + 0xF9FA=>0xE755, + 0xF9FB=>0xE756, + 0xF9FC=>0xE757, + }.freeze + DOCOMO_UNICODE_TO_SJIS = DOCOMO_SJIS_TO_UNICODE.invert.freeze + end +end diff --git a/lib/emoticon/conversion_table/softbank.rb b/lib/emoticon/conversion_table/softbank.rb new file mode 100644 index 0000000..dd5be64 --- /dev/null +++ b/lib/emoticon/conversion_table/softbank.rb @@ -0,0 +1,481 @@ +module Emoticon + module ConversionTable + SOFTBANK_UNICODE_TO_WEBCODE = { + 0xE001 => "G!", + 0xE002 => "G\"", + 0xE003 => "G#", + 0xE004 => "G$", + 0xE005 => "G%", + 0xE006 => "G&", + 0xE007 => "G'", + 0xE008 => "G(", + 0xE009 => "G)", + 0xE00A => "G*", + 0xE00B => "G+", + 0xE00C => "G,", + 0xE00D => "G-", + 0xE00E => "G.", + 0xE00F => "G/", + 0xE010 => "G0", + 0xE011 => "G1", + 0xE012 => "G2", + 0xE013 => "G3", + 0xE014 => "G4", + 0xE015 => "G5", + 0xE016 => "G6", + 0xE017 => "G7", + 0xE018 => "G8", + 0xE019 => "G9", + 0xE01A => "G:", + 0xE01B => "G;", + 0xE01C => "G<", + 0xE01D => "G=", + 0xE01E => "G>", + 0xE01F => "G?", + 0xE020 => "G@", + 0xE021 => "GA", + 0xE022 => "GB", + 0xE023 => "GC", + 0xE024 => "GD", + 0xE025 => "GE", + 0xE026 => "GF", + 0xE027 => "GG", + 0xE028 => "GH", + 0xE029 => "GI", + 0xE02A => "GJ", + 0xE02B => "GK", + 0xE02C => "GL", + 0xE02D => "GM", + 0xE02E => "GN", + 0xE02F => "GO", + 0xE030 => "GP", + 0xE031 => "GQ", + 0xE032 => "GR", + 0xE033 => "GS", + 0xE034 => "GT", + 0xE035 => "GU", + 0xE036 => "GV", + 0xE037 => "GW", + 0xE038 => "GX", + 0xE039 => "GY", + 0xE03A => "GZ", + 0xE03B => "G[", + 0xE03C => "G\\", + 0xE03D => "G]", + 0xE03E => "G^", + 0xE03F => "G_", + 0xE040 => "G`", + 0xE041 => "Ga", + 0xE042 => "Gb", + 0xE043 => "Gc", + 0xE044 => "Gd", + 0xE045 => "Ge", + 0xE046 => "Gf", + 0xE047 => "Gg", + 0xE048 => "Gh", + 0xE049 => "Gi", + 0xE04A => "Gj", + 0xE04B => "Gk", + 0xE04C => "Gl", + 0xE04D => "Gm", + 0xE04E => "Gn", + 0xE04F => "Go", + 0xE050 => "Gp", + 0xE051 => "Gq", + 0xE052 => "Gr", + 0xE053 => "Gs", + 0xE054 => "Gt", + 0xE055 => "Gu", + 0xE056 => "Gv", + 0xE057 => "Gw", + 0xE058 => "Gx", + 0xE059 => "Gy", + 0xE05A => "Gz", + 0xE101 => "E!", + 0xE102 => "E\"", + 0xE103 => "E#", + 0xE104 => "E$", + 0xE105 => "E%", + 0xE106 => "E&", + 0xE107 => "E'", + 0xE108 => "E(", + 0xE109 => "E)", + 0xE10A => "E*", + 0xE10B => "E+", + 0xE10C => "E,", + 0xE10D => "E-", + 0xE10E => "E.", + 0xE10F => "E/", + 0xE110 => "E0", + 0xE111 => "E1", + 0xE112 => "E2", + 0xE113 => "E3", + 0xE114 => "E4", + 0xE115 => "E5", + 0xE116 => "E6", + 0xE117 => "E7", + 0xE118 => "E8", + 0xE119 => "E9", + 0xE11A => "E:", + 0xE11B => "E;", + 0xE11C => "E<", + 0xE11D => "E=", + 0xE11E => "E>", + 0xE11F => "E?", + 0xE120 => "E@", + 0xE121 => "EA", + 0xE122 => "EB", + 0xE123 => "EC", + 0xE124 => "ED", + 0xE125 => "EE", + 0xE126 => "EF", + 0xE127 => "EG", + 0xE128 => "EH", + 0xE129 => "EI", + 0xE12A => "EJ", + 0xE12B => "EK", + 0xE12C => "EL", + 0xE12D => "EM", + 0xE12E => "EN", + 0xE12F => "EO", + 0xE130 => "EP", + 0xE131 => "EQ", + 0xE132 => "ER", + 0xE133 => "ES", + 0xE134 => "ET", + 0xE135 => "EU", + 0xE136 => "EV", + 0xE137 => "EW", + 0xE138 => "EX", + 0xE139 => "EY", + 0xE13A => "EZ", + 0xE13B => "E[", + 0xE13C => "E\\", + 0xE13D => "E]", + 0xE13E => "E^", + 0xE13F => "E_", + 0xE140 => "E`", + 0xE141 => "Ea", + 0xE142 => "Eb", + 0xE143 => "Ec", + 0xE144 => "Ed", + 0xE145 => "Ee", + 0xE146 => "Ef", + 0xE147 => "Eg", + 0xE148 => "Eh", + 0xE149 => "Ei", + 0xE14A => "Ej", + 0xE14B => "Ek", + 0xE14C => "El", + 0xE14D => "Em", + 0xE14E => "En", + 0xE14F => "Eo", + 0xE150 => "Ep", + 0xE151 => "Eq", + 0xE152 => "Er", + 0xE153 => "Es", + 0xE154 => "Et", + 0xE155 => "Eu", + 0xE156 => "Ev", + 0xE157 => "Ew", + 0xE158 => "Ex", + 0xE159 => "Ey", + 0xE15A => "Ez", + 0xE201 => "F!", + 0xE202 => "F\"", + 0xE203 => "F#", + 0xE204 => "F$", + 0xE205 => "F%", + 0xE206 => "F&", + 0xE207 => "F'", + 0xE208 => "F(", + 0xE209 => "F)", + 0xE20A => "F*", + 0xE20B => "F+", + 0xE20C => "F,", + 0xE20D => "F-", + 0xE20E => "F.", + 0xE20F => "F/", + 0xE210 => "F0", + 0xE211 => "F1", + 0xE212 => "F2", + 0xE213 => "F3", + 0xE214 => "F4", + 0xE215 => "F5", + 0xE216 => "F6", + 0xE217 => "F7", + 0xE218 => "F8", + 0xE219 => "F9", + 0xE21A => "F:", + 0xE21B => "F;", + 0xE21C => "F<", + 0xE21D => "F=", + 0xE21E => "F>", + 0xE21F => "F?", + 0xE220 => "F@", + 0xE221 => "FA", + 0xE222 => "FB", + 0xE223 => "FC", + 0xE224 => "FD", + 0xE225 => "FE", + 0xE226 => "FF", + 0xE227 => "FG", + 0xE228 => "FH", + 0xE229 => "FI", + 0xE22A => "FJ", + 0xE22B => "FK", + 0xE22C => "FL", + 0xE22D => "FM", + 0xE22E => "FN", + 0xE22F => "FO", + 0xE230 => "FP", + 0xE231 => "FQ", + 0xE232 => "FR", + 0xE233 => "FS", + 0xE234 => "FT", + 0xE235 => "FU", + 0xE236 => "FV", + 0xE237 => "FW", + 0xE238 => "FX", + 0xE239 => "FY", + 0xE23A => "FZ", + 0xE23B => "F[", + 0xE23C => "F\\", + 0xE23D => "F]", + 0xE23E => "F^", + 0xE23F => "F_", + 0xE240 => "F`", + 0xE241 => "Fa", + 0xE242 => "Fb", + 0xE243 => "Fc", + 0xE244 => "Fd", + 0xE245 => "Fe", + 0xE246 => "Ff", + 0xE247 => "Fg", + 0xE248 => "Fh", + 0xE249 => "Fi", + 0xE24A => "Fj", + 0xE24B => "Fk", + 0xE24C => "Fl", + 0xE24D => "Fm", + 0xE24E => "Fn", + 0xE24F => "Fo", + 0xE250 => "Fp", + 0xE251 => "Fq", + 0xE252 => "Fr", + 0xE253 => "Fs", + 0xE255 => "Fu", + 0xE256 => "Fv", + 0xE257 => "Fw", + 0xE301 => "O!", + 0xE302 => "O\"", + 0xE303 => "O#", + 0xE304 => "O$", + 0xE305 => "O%", + 0xE306 => "O&", + 0xE307 => "O'", + 0xE308 => "O(", + 0xE309 => "O)", + 0xE30A => "O*", + 0xE30B => "O+", + 0xE30C => "O,", + 0xE30D => "O-", + 0xE30E => "O.", + 0xE30F => "O/", + 0xE310 => "O0", + 0xE311 => "O1", + 0xE312 => "O2", + 0xE313 => "O3", + 0xE314 => "O4", + 0xE315 => "O5", + 0xE316 => "O6", + 0xE317 => "O7", + 0xE318 => "O8", + 0xE319 => "O9", + 0xE31A => "O:", + 0xE31B => "O;", + 0xE31C => "O<", + 0xE31D => "O=", + 0xE31E => "O>", + 0xE31F => "O?", + 0xE320 => "O@", + 0xE321 => "OA", + 0xE322 => "OB", + 0xE323 => "OC", + 0xE324 => "OD", + 0xE325 => "OE", + 0xE326 => "OF", + 0xE327 => "OG", + 0xE328 => "OH", + 0xE329 => "OI", + 0xE32A => "OJ", + 0xE32B => "OK", + 0xE32C => "OL", + 0xE32D => "OM", + 0xE32E => "ON", + 0xE32F => "OO", + 0xE330 => "OP", + 0xE331 => "OQ", + 0xE332 => "OR", + 0xE333 => "OS", + 0xE334 => "OT", + 0xE335 => "OU", + 0xE336 => "OV", + 0xE337 => "OW", + 0xE338 => "OX", + 0xE339 => "OY", + 0xE33A => "OZ", + 0xE33B => "O[", + 0xE33C => "O\\", + 0xE33D => "O]", + 0xE33E => "O^", + 0xE33F => "O_", + 0xE340 => "O`", + 0xE341 => "Oa", + 0xE342 => "Ob", + 0xE343 => "Oc", + 0xE344 => "Od", + 0xE345 => "Oe", + 0xE346 => "Of", + 0xE347 => "Og", + 0xE348 => "Oh", + 0xE349 => "Oi", + 0xE34A => "Oj", + 0xE34B => "Ok", + 0xE34C => "Ol", + 0xE34D => "Om", + 0xE401 => "P!", + 0xE402 => "P\"", + 0xE403 => "P#", + 0xE404 => "P$", + 0xE405 => "P%", + 0xE406 => "P&", + 0xE407 => "P'", + 0xE408 => "P(", + 0xE409 => "P)", + 0xE40A => "P*", + 0xE40B => "P+", + 0xE40C => "P,", + 0xE40D => "P-", + 0xE40E => "P.", + 0xE40F => "P/", + 0xE410 => "P0", + 0xE411 => "P1", + 0xE412 => "P2", + 0xE413 => "P3", + 0xE414 => "P4", + 0xE415 => "P5", + 0xE416 => "P6", + 0xE417 => "P7", + 0xE418 => "P8", + 0xE419 => "P9", + 0xE41A => "P:", + 0xE41B => "P;", + 0xE41C => "P<", + 0xE41D => "P=", + 0xE41E => "P>", + 0xE41F => "P?", + 0xE420 => "P@", + 0xE421 => "PA", + 0xE422 => "PB", + 0xE423 => "PC", + 0xE424 => "PD", + 0xE425 => "PE", + 0xE426 => "PF", + 0xE427 => "PG", + 0xE428 => "PH", + 0xE429 => "PI", + 0xE42A => "PJ", + 0xE42B => "PK", + 0xE42C => "PL", + 0xE42D => "PM", + 0xE42E => "PN", + 0xE42F => "PO", + 0xE430 => "PP", + 0xE431 => "PQ", + 0xE432 => "PR", + 0xE433 => "PS", + 0xE434 => "PT", + 0xE435 => "PU", + 0xE436 => "PV", + 0xE437 => "PW", + 0xE438 => "PX", + 0xE439 => "PY", + 0xE43A => "PZ", + 0xE43B => "P[", + 0xE43C => "P\\", + 0xE43D => "P]", + 0xE43E => "P^", + 0xE43F => "P_", + 0xE440 => "P`", + 0xE441 => "Pa", + 0xE442 => "Pb", + 0xE443 => "Pc", + 0xE444 => "Pd", + 0xE445 => "Pe", + 0xE446 => "Pf", + 0xE447 => "Pg", + 0xE448 => "Ph", + 0xE449 => "Pi", + 0xE44A => "Pj", + 0xE44B => "Pk", + 0xE44C => "Pl", + 0xE501 => "Q!", + 0xE502 => "Q\"", + 0xE503 => "Q#", + 0xE504 => "Q$", + 0xE505 => "Q%", + 0xE506 => "Q&", + 0xE507 => "Q'", + 0xE508 => "Q(", + 0xE509 => "Q)", + 0xE50A => "Q*", + 0xE50B => "Q+", + 0xE50C => "Q,", + 0xE50D => "Q-", + 0xE50E => "Q.", + 0xE50F => "Q/", + 0xE510 => "Q0", + 0xE511 => "Q1", + 0xE512 => "Q2", + 0xE513 => "Q3", + 0xE514 => "Q4", + 0xE515 => "Q5", + 0xE516 => "Q6", + 0xE517 => "Q7", + 0xE518 => "Q8", + 0xE519 => "Q9", + 0xE51A => "Q:", + 0xE51B => "Q;", + 0xE51C => "Q<", + 0xE51D => "Q=", + 0xE51E => "Q>", + 0xE51F => "Q?", + 0xE520 => "Q@", + 0xE521 => "QA", + 0xE522 => "QB", + 0xE523 => "QC", + 0xE524 => "QD", + 0xE525 => "QE", + 0xE526 => "QF", + 0xE527 => "QG", + 0xE528 => "QH", + 0xE529 => "QI", + 0xE52A => "QJ", + 0xE52B => "QK", + 0xE52C => "QL", + 0xE52D => "QM", + 0xE52E => "QN", + 0xE52F => "QO", + 0xE530 => "QP", + 0xE531 => "QQ", + 0xE532 => "QR", + 0xE533 => "QS", + 0xE534 => "QT", + 0xE535 => "QU", + 0xE536 => "QV", + 0xE537 => "QW", + } + SOFTBANK_WEBCODE_TO_UNICODE = SOFTBANK_UNICODE_TO_WEBCODE.invert + end +end diff --git a/lib/emoticon/transcoder.rb b/lib/emoticon/transcoder.rb new file mode 100644 index 0000000..52ab7eb --- /dev/null +++ b/lib/emoticon/transcoder.rb @@ -0,0 +1,72 @@ +require "emoticon/conversion_table" +require 'scanf' +require "kconv" + +module Emoticon + class Transcoder + include Emoticon::ConversionTable + + def unicodecr_to_external(str) + str.gsub(/&#x([0-9a-f]{4});/i) do |match| + unicode = $1.scanf("%x").first + if conversion_table + converted = conversion_table[unicode] # キャリア間変換 + else + converted = unicode # 変換しない + end + + # 携帯側エンコーディングに変換する + case converted + when Integer + # 変換先がUnicodeで指定されている。つまり対応する絵文字がある。 + if sjis = UNICODE_TO_SJIS[converted] + [sjis].pack('n') + elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000] + "\x1b\x24#{webcode}\x0f" + else + # キャリア変換テーブルに指定されていたUnicodeに対応する + # 携帯側エンコーディングが見つからない(変換テーブルの不備の可能性あり)。 + match + end + when String + # 変換先がUnicodeで指定されている。 + to_sjis ? Kconv::kconv(converted, Kconv::SJIS, Kconv::UTF8) : converted + when nil + # 変換先が定義されていない。 + match + end + end + end + + def utf8_to_unicodecr(str) + str.gsub(UTF8_REGEXP) do |match| + "&#x%04x;" % match.unpack('U').first + end + end + + def unicodecr_to_utf8(str) + str.gsub(/&#x([0-9a-f]{4});/i) do |match| + unicode = $1.scanf("%x").first + if UNICODE_TO_SJIS[unicode] || SOFTBANK_UNICODE_TO_WEBCODE[unicode-0x1000] + [unicode].pack('U') + else + match + end + end + end + + def internal_to_external(s) + unicodecr_to_external(utf8_to_unicodecr(s)) + end + + private + + def to_sjis + false + end + + def conversion_table + nil + end + end +end diff --git a/lib/emoticon/transcoder/au.rb b/lib/emoticon/transcoder/au.rb new file mode 100644 index 0000000..1450aad --- /dev/null +++ b/lib/emoticon/transcoder/au.rb @@ -0,0 +1,22 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") + +class Emoticon::Transcoder::Au < Emoticon::Transcoder + # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。 + def external_to_unicodecr(str) + str.gsub(AU_SJIS_REGEXP) do |match| + sjis = match.unpack('n').first + unicode = AU_SJIS_TO_UNICODE[sjis] + unicode ? ("&#x%04x;"%unicode) : match + end + end + + private + + def to_sjis + true + end + + def conversion_table + CONVERSION_TABLE_TO_AU + end +end diff --git a/lib/emoticon/transcoder/docomo.rb b/lib/emoticon/transcoder/docomo.rb new file mode 100644 index 0000000..0a18060 --- /dev/null +++ b/lib/emoticon/transcoder/docomo.rb @@ -0,0 +1,23 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") + +class Emoticon::Transcoder::Docomo < Emoticon::Transcoder + + # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。 + def external_to_unicodecr(str) + str.gsub(SJIS_REGEXP) do |match| + sjis = match.unpack('n').first + unicode = SJIS_TO_UNICODE[sjis] + unicode ? ("&#x%04x;"%unicode) : match + end + end + + private + + def to_sjis + true + end + + def conversion_table + CONVERSION_TABLE_TO_DOCOMO + end +end diff --git a/lib/emoticon/transcoder/jphone.rb b/lib/emoticon/transcoder/jphone.rb new file mode 100644 index 0000000..0d2c6ff --- /dev/null +++ b/lib/emoticon/transcoder/jphone.rb @@ -0,0 +1,25 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder", "softbank") + +class Emoticon::Transcoder::Jphone < Emoticon::Transcoder::Softbank + # +str+のなかでWebcodeのSoftBank絵文字を(+0x1000だけシフトして)Unicode数値文字参照に変換した文字列を返す。 + def external_to_unicodecr(str) + # SoftBank Webcode + s = str.clone + # 連続したエスケープコードが省略されている場合は切りはなす。 + s.gsub!(/\x1b\x24(.)(.+?)\x0f/) do |match| + a = $1 + $2.split(//).map{|x| "\x1b\x24#{a}#{x}\x0f"}.join('') + end + # Webcodeを変換 + s.gsub(SOFTBANK_WEBCODE_REGEXP) do |match| + unicode = SOFTBANK_WEBCODE_TO_UNICODE[match[2,2]] + 0x1000 + unicode ? ("&#x%04x;"%unicode) : match + end + end + + private + + def to_sjis + true + end +end diff --git a/lib/emoticon/transcoder/null.rb b/lib/emoticon/transcoder/null.rb new file mode 100644 index 0000000..8150488 --- /dev/null +++ b/lib/emoticon/transcoder/null.rb @@ -0,0 +1,9 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") + +class Emoticon::Transcoder::Null < Emoticon::Transcoder + + # 対応する変換メソッドが定義されていない場合は素通し + def external_to_unicodecr(str) + str + end +end diff --git a/lib/emoticon/transcoder/softbank.rb b/lib/emoticon/transcoder/softbank.rb new file mode 100644 index 0000000..5d462c4 --- /dev/null +++ b/lib/emoticon/transcoder/softbank.rb @@ -0,0 +1,19 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder") + +class Emoticon::Transcoder::Softbank < Emoticon::Transcoder + + # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。 + def external_to_unicodecr(str) + # SoftBank Unicode + str.gsub(SOFTBANK_UNICODE_REGEXP) do |match| + unicode = match.unpack('U').first + "&#x%04x;" % (unicode+0x1000) + end + end + + private + + def conversion_table + CONVERSION_TABLE_TO_SOFTBANK + end +end diff --git a/lib/emoticon/transcoder/vodafone.rb b/lib/emoticon/transcoder/vodafone.rb new file mode 100644 index 0000000..fa07fa9 --- /dev/null +++ b/lib/emoticon/transcoder/vodafone.rb @@ -0,0 +1,3 @@ +require File.join(File.dirname(File.dirname(__FILE__)), "transcoder", "softbank") + +Emoticon::Transcoder::Vodafone = Emoticon::Transcoder::Softbank diff --git a/test/emoticon/transcoder/au_test.rb b/test/emoticon/transcoder/au_test.rb new file mode 100644 index 0000000..560741d --- /dev/null +++ b/test/emoticon/transcoder/au_test.rb @@ -0,0 +1,20 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../test_helper' +require "emoticon/transcoder/au" + + +class AuTest < Test::Unit::TestCase + def setup + @transcoder = Emoticon::Transcoder::Au.new + end + + def test_internal_to_external + assert_equal "\xf6\x60", @transcoder.internal_to_external(DOCOMO_CR) + assert_equal "\xf6\x60", @transcoder.internal_to_external(DOCOMO_UTF8) + assert_equal "[ドコモポイント]".tosjis, @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "\xf6\x60", @transcoder.internal_to_external(AU_CR) + assert_equal "\xf6\x60", @transcoder.internal_to_external(AU_UTF8) + assert_equal "\xf6\x60", @transcoder.internal_to_external(SOFTBANK_CR) + assert_equal "\xf6\x60", @transcoder.internal_to_external(SOFTBANK_UTF8) + end +end diff --git a/test/emoticon/transcoder/docomo_test.rb b/test/emoticon/transcoder/docomo_test.rb new file mode 100644 index 0000000..0d7998b --- /dev/null +++ b/test/emoticon/transcoder/docomo_test.rb @@ -0,0 +1,20 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../test_helper' +require "emoticon/transcoder/docomo" + + +class DocomoTest < Test::Unit::TestCase + def setup + @transcoder = Emoticon::Transcoder::Docomo.new + end + + def test_internal_to_external + assert_equal "\xf8\x9f", @transcoder.internal_to_external(DOCOMO_CR) + assert_equal "\xf8\x9f", @transcoder.internal_to_external(DOCOMO_UTF8) + assert_equal "\xf9\x79", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "\xf8\x9f", @transcoder.internal_to_external(AU_CR) + assert_equal "\xf8\x9f", @transcoder.internal_to_external(AU_UTF8) + assert_equal "\xf8\x9f", @transcoder.internal_to_external(SOFTBANK_CR) + assert_equal "\xf8\x9f", @transcoder.internal_to_external(SOFTBANK_UTF8) + end +end diff --git a/test/emoticon/transcoder/jphone_test.rb b/test/emoticon/transcoder/jphone_test.rb new file mode 100644 index 0000000..b1807b3 --- /dev/null +++ b/test/emoticon/transcoder/jphone_test.rb @@ -0,0 +1,18 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../test_helper' +require "emoticon/transcoder/jphone" + + +class JphoneTest < Test::Unit::TestCase + def setup + @transcoder = Emoticon::Transcoder::Jphone.new + end + + def test_internal_to_external + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) + assert_equal "[ドコモポイント]".tosjis, @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) + end +end diff --git a/test/emoticon/transcoder/softbank_test.rb b/test/emoticon/transcoder/softbank_test.rb new file mode 100644 index 0000000..b8b75c5 --- /dev/null +++ b/test/emoticon/transcoder/softbank_test.rb @@ -0,0 +1,20 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../test_helper' +require "emoticon/transcoder/softbank" + + +class SoftbankTest < Test::Unit::TestCase + def setup + @transcoder = Emoticon::Transcoder::Softbank.new + end + + def test_internal_to_external + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) + assert_equal "[ドコモポイント]", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_UTF8) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) + end +end diff --git a/test/emoticon/transcoder/vodafone_test.rb b/test/emoticon/transcoder/vodafone_test.rb new file mode 100644 index 0000000..5a0d78d --- /dev/null +++ b/test/emoticon/transcoder/vodafone_test.rb @@ -0,0 +1,20 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../test_helper' +require "emoticon/transcoder/vodafone" + + +class VodafoneTest < Test::Unit::TestCase + def setup + @transcoder = Emoticon::Transcoder::Vodafone.new + end + + def test_internal_to_external + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(DOCOMO_UTF8) + assert_equal "[ドコモポイント]", @transcoder.internal_to_external(DOCOMO_DOCOMO_POINT) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(AU_UTF8) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_CR) + assert_equal "\e$Gj\x0f", @transcoder.internal_to_external(SOFTBANK_UTF8) + end +end diff --git a/test/emoticon_test.rb b/test/emoticon_test.rb new file mode 100644 index 0000000..3400351 --- /dev/null +++ b/test/emoticon_test.rb @@ -0,0 +1,14 @@ +require File.dirname(__FILE__) + '/test_helper' +require 'emoticon' + +class EmoticonTest < Test::Unit::TestCase + def test_transcoder_for_carrier + assert_instance_of(Emoticon::Transcoder::Docomo, Emoticon.transcoder_for_carrier("docomo")) + assert_instance_of(Emoticon::Transcoder::Au, Emoticon.transcoder_for_carrier("au")) + assert_instance_of(Emoticon::Transcoder::Softbank, Emoticon.transcoder_for_carrier("softbank")) + assert_instance_of(Emoticon::Transcoder::Softbank, Emoticon.transcoder_for_carrier("vodafone")) + assert_instance_of(Emoticon::Transcoder::Jphone, Emoticon.transcoder_for_carrier("jphone")) + assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier("emobile")) + assert_instance_of(Emoticon::Transcoder::Null, Emoticon.transcoder_for_carrier("willcom")) + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..dea6e82 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +require 'test/unit' +$:.unshift File.dirname(__FILE__) + '/../lib' + +DOCOMO_CR = "&#xE63E;" +DOCOMO_UTF8 = [0xe63e].pack("U") +DOCOMO_DOCOMO_POINT = "&#xE6D5;" +AU_CR = "&#xE488;" +AU_UTF8 = [0xe488].pack("U") +SOFTBANK_CR = "&#xF04A;" +SOFTBANK_UTF8 = [0xf04a].pack("U")
darxriggs/ip-world-map
69530ecf6383b0a1db9ab61db6d0cdc1e2f72f5d
remove gemcutter reference from README
diff --git a/README.rdoc b/README.rdoc index 3588eb2..d51b044 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,67 +1,66 @@ = IP World Map This tool can be used to visualize web access logfiles. It performs geo-location resolution on the IPs (using api.hostip.info) and can generate: * a fixed image * an animated image * a video == Installation -Install [Gemcutter](http://gemcutter.org) then execute: gem install ip-world-map == Usage ip-world-map [options] logfile1 [logfile2] ... == Options --version Display the version -h, --help Display this help message -v, --verbose Verbose output --map-filename VALUE The image to use as background --resolution VALUE (eg.: 640x480) --fps VALUE Animation frames per second (eg.: 25) --fill-dot-color VALUE (eg.: red, 'rgb(255,0,0)', '#FF0000') --fill-dot-scale VALUE (eg.: 10.0) --fill-dot-opacity VALUE range 0.0-1.0 (eg.: 0.0, 0.5, 1.0) --fill-dot-lifetime VALUE (eg.: 15) --time-slot VALUE real life time visualized per video frame (eg.: 10secs, 1min, 99hours, 1day) --output-format VALUE image format (e.g.: gif, jpg, png) or video format (avi, mpg, mp4) --[no-]animate generate an image or a video == Examples Generate PNG image. That's the default output. ip-world-map /var/log/apache2/access.log* Generate AVI video with 640x480 and 25fps (default settings). ip-world-map --animate --output-format avi /var/log/apache2/access.log* == Supported platforms Tested with Ruby 1.8.7, 1.9.1 under *nix == Author René Scheibe == License Copyright (C) 2010-2011 René Scheibe <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
darxriggs/ip-world-map
5d783a6c4c6151ee35a07e22b6bcefd1eb209df7
upgrade to version 1.0.1
diff --git a/Rakefile b/Rakefile index 1d629b3..36b5c35 100644 --- a/Rakefile +++ b/Rakefile @@ -1,47 +1,47 @@ # -*- coding: utf-8 -*- require 'rubygems' require 'rubygems/package_task' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new do |t| t.pattern = 'spec/**/*.rb' t.rcov = false t.rcov_opts = %q[--exclude "spec"] t.verbose = true end spec = Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 1.8.7' s.summary = 'A tool to generate images/videos of user locations based on Apache log files.' s.name = 'ip-world-map' - s.version = '1.0.0' + s.version = '1.0.1' s.license = 'GPL-2.0' s.executables = ['ip-world-map'] s.files = FileList['{lib,spec}/**/*'].to_a + ['Rakefile'] + ['resources/maps/earthmap-1920x960.tif'] s.has_rdoc = false s.description = s.summary s.homepage = 'http://github.com/darxriggs/ip-world-map' s.author = 'René Scheibe' s.email = '[email protected]' s.requirements = ['ImageMagick (used by rmagick)', 'ffmpeg (only for animations)'] s.required_ruby_version = '>= 1.8.7' s.add_runtime_dependency('rmagick', '~> 2.13', '>= 2.13.1') s.add_runtime_dependency('typhoeus', '~> 0.2', '>= 0.2.1') s.add_development_dependency('rspec', '~> 2.6', '>= 2.6.0') end Gem::PackageTask.new(spec) do |pkg| pkg.need_tar = false end desc 'Install gem locally' task :install_gem => :package do `gem install pkg/*.gem --no-ri --no-rdoc` end task :default => :install_gem diff --git a/bin/ip-world-map b/bin/ip-world-map index 5616bee..039e98a 100755 --- a/bin/ip-world-map +++ b/bin/ip-world-map @@ -1,183 +1,183 @@ #!/usr/bin/env ruby require 'rubygems' require 'optparse' require 'ostruct' require 'date' require 'ip-world-map' require 'RMagick' class App - VERSION = '0.0.1' + VERSION = '1.0.1' attr_reader :options def initialize arguments, stdin @arguments = arguments @stdin = stdin set_defaults end def run if parsed_arguments? && arguments_valid? output_options if @options.verbose process_command else output_help exit 1 end end protected def set_defaults @options = OpenStruct.new({ :verbose => false, :quiet => false, :map_filename => File.join(File.dirname(__FILE__), '..' , 'resources', 'maps', 'earthmap-1920x960.tif'), :map_width => 800, :map_height => 400, :frames_per_second => 25, :fill_dot_color => 'red', :fill_dot_scale => 10, :fill_dot_opacity => 1.0, :fill_dot_lifetime => 15, :time_format => nil, :group_seconds => 24 * 1 * 60 * 60, :output_format => 'png', :animate => false }) end def parsed_arguments? @opts = opts = OptionParser.new opts.banner = 'Usage: ip-world-map [options] log_file1 [logfile2] ...' opts.on('--version', 'Display the version') do output_version exit 0 end opts.on('-h', '--help', 'Display this help message') do output_help exit 0 end opts.on('-v', '--verbose', 'Verbose output') do @options.verbose = true end opts.on('--map-filename VALUE', 'The image to use as background') do |filename| raise 'invalid map file' unless File.readable? filename @options.map_filename = filename end opts.on('--resolution VALUE', '(eg.: 640x480)') do |resolution| raise 'invalid resolution format' unless resolution =~ /^[0-9]+x[0-9]+$/ width, height = resolution.split('x').collect{|v| v.to_i} @options.map_width = width @options.map_height = height end opts.on('--fps VALUE', 'Animation frames per second (eg.: 25)') do |fps| raise 'invalid fps format' unless fps =~ /^[1-9][0-9]*$/ @options.frames_per_second = fps.to_i end opts.on('--fill-dot-color VALUE', "(eg.: red, 'rgb(255,0,0)', '#FF0000')") do |color| Magick::Pixel.from_color color rescue raise 'invalid color (see help for examples)' @options.fill_dot_color = color end opts.on('--fill-dot-scale VALUE', '(eg.: 10.0)') do |scale| raise 'invalid dot scale' unless scale =~ /^[1-9][0-9]*([.][0-9]*)?$/ @options.fill_dot_scale = scale.to_f end opts.on('--fill-dot-opacity VALUE', 'range 0.0-1.0 (eg.: 0.0, 0.5, 1.0)') do |opacity| raise 'invalid dot opacity' unless opacity =~ /^(0([.][0-9]*)?|1([.]0*)?)$/ @options.fill_dot_opacity = opacity.to_f end opts.on('--fill-dot-lifetime VALUE', '(eg.: 15)') do |lifetime| raise 'invalid dot lifetime' unless lifetime =~ /^[1-9][0-9]*$/ @options.fill_dot_lifetime = lifetime.to_i end opts.on('--time-slot VALUE', 'real life time visualized per video frame (eg.: 10secs, 1min, 99hours, 1day)') do |slot| raise 'invalid time slot' unless slot =~ /^[1-9][0-9]*(sec|min|hour|day)s?$/ value = slot.scan(/[0-9]+/)[0].to_i unit = slot.scan(/[a-z]+[^s]/)[0] unit2secs = {'sec' => 1, 'min' => 60, 'hour' => 60*60, 'day' => 24*60*60} @options.group_seconds = value * unit2secs[unit] end # TODO # opts.on('--time-format', 'gets auto-detected if not specified') { |v| @options.time_format = v } opts.on('--output-format VALUE', 'image format (e.g.: gif, jpg, png) or video format (avi, mpg, mp4)') do |format| video_formats = %w[avi mpg mp4] is_supported = Magick.formats.any?{ |supported_format, properties| supported_format.upcase == format.upcase && properties.include?('w') } is_supported |= video_formats.any?{ |supported_format| supported_format.upcase == format.upcase } raise 'invalid output format' unless is_supported @options.output_format = format end opts.on('--[no-]animate', 'generate an image or a video') do |animate| @options.animate = animate end begin opts.parse!(@arguments) @log_files = Dir.glob(@arguments) raise 'no log files given' if @log_files.empty? raise 'invalid log file given' unless @log_files.all?{|file| File.readable? file} process_options rescue puts 'Error: ' + $!.to_s return false end true end # Performs post-parse processing on options def process_options $visualization_config = @options end def output_options puts 'Options:' @options.marshal_dump.sort{|a,b| a[0].to_s <=> b[0].to_s}.each do |name, val| puts " #{name} = #{val}" end end # True if required arguments were provided def arguments_valid? video_formats = %w[avi mpg mp4] is_video_format = video_formats.any?{ |video_format| video_format == @options.output_format.downcase } return false if [email protected] && is_video_format return false if @options.animate && !is_video_format true end def output_help puts @opts.help end def output_version puts "#{File.basename(__FILE__)} version #{VERSION}" end def process_command ApacheLogVisualizer.new(@log_files).visualize end end # Create and run the application app = App.new(ARGV, STDIN) app.run