diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-16 14:51:38 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-16 14:51:38 +0800 |
commit | 6586626ac878e99b9e3f5f15ac5ec37cd7484831 (patch) | |
tree | fca68420fa85ce89d84f723354d2feacd99e60e4 /staticweb | |
parent | d9a7b30d990e2bab67413fe11acb2d9f7096a61a (diff) | |
download | pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar.gz pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar.bz2 pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar.lz pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar.xz pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.tar.zst pttbbs-6586626ac878e99b9e3f5f15ac5ec37cd7484831.zip |
better big5=>gb2312 implementation
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1415 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'staticweb')
-rw-r--r-- | staticweb/article.html | 8 | ||||
-rw-r--r-- | staticweb/banner.html | 6 | ||||
-rw-r--r-- | staticweb/dir.html | 18 | ||||
-rw-r--r-- | staticweb/header.html | 2 | ||||
-rw-r--r-- | staticweb/index.html | 4 | ||||
-rwxr-xr-x | staticweb/index.pl | 21 | ||||
-rwxr-xr-x | staticweb/man.pl | 16 |
7 files changed, 43 insertions, 32 deletions
diff --git a/staticweb/article.html b/staticweb/article.html index 0d7d3e57..1386c3d6 100644 --- a/staticweb/article.html +++ b/staticweb/article.html @@ -1,7 +1,7 @@ [% INCLUDE header.html %] <table width="75%" align="center"><tr><td> -[% IF gb %]看板[% ELSE %]狾[% END %]: <a href="/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %]</a><br /> -<a href="./[% IF gb %]?gb=1[% END %]">[% IF gb %]回上页[% ELSE %][% END %]</a><br /> +狾: <a href="/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %]</a><br /> +<a href="./[% IF gb %]?gb=1[% END %]"></a><br /> <hr /> </tr></td><tr><td> <font size=+2><pre> @@ -9,8 +9,8 @@ </pre></font> </td></tr><tr><td> <hr> -<a href="./[% IF gb %]?gb=1[% END %]">[% IF gb %]回上页[% ELSE %][% END %]</a><br /> -<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>) +<a href="./[% IF gb %]?gb=1[% END %]"></a><br /> +<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>) </td></tr> </table> diff --git a/staticweb/banner.html b/staticweb/banner.html index 4a8d0678..c6b9688b 100644 --- a/staticweb/banner.html +++ b/staticweb/banner.html @@ -1,10 +1,10 @@ <div id="banner"> <h1><a href="http://blog.ptt.cc/blog.pl/ptt/" - accesskey="1">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a></h1> + accesskey="1">у金金龟穨</a></h1> <div style="position:absolute; right: 15%;"> -<a href="./">[% IF gb %]繁体中文[% ELSE %]羉砰いゅ[% END %](big5)</a> -<a href="./?gb=1">[% IF gb %]简体中文[% ELSE %]虏砰いゅ[% END %](gb2312)</a> +<a href="./">羉砰いゅ(big5)</a> +<a href="./?gb=1">虏砰いゅ(gb2312)</a> </div> </div> diff --git a/staticweb/dir.html b/staticweb/dir.html index 50f5ef63..2a40ae72 100644 --- a/staticweb/dir.html +++ b/staticweb/dir.html @@ -5,17 +5,17 @@ </td></tr> <tr><td> -<a href="http://man.ptt.cc/[% IF gb %]?gb=1[% END %]">[% IF gb %]网页版精华区首页[% ELSE %]呼弘地跋[% END %]</a> -<a href="http://man.ptt.cc/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %][% IF gb %]精华区首页[% ELSE %]弘地跋[% END %]</a> -<a href="http://blog.ptt.cc">[% IF gb %]批踢踢部落格(big5 only)[% ELSE %]у金金场辅[% END %]</a> +<a href="http://man.ptt.cc/[% IF gb %]?gb=1[% END %]">呼弘地跋</a> +<a href="http://man.ptt.cc/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %]弘地跋</a> +<a href="http://blog.ptt.cc">у金金场辅(big5 only)</a> <br /> -<font size=+1>[% IF gb %]看板名称[% ELSE %]狾嘿[% END %]: <a href="/man.pl/[% brdname %]/">[% brdname %]</a></font> +<font size=+1>狾嘿: <a href="/man.pl/[% brdname %]/">[% brdname %]</a></font> <hr /> </td></tr> <tr><td> [% IF !isroot %] -<a href="../[% IF gb %]?gb=1[% END %]"><img src="http://images.ptt.cc/folder.gif" style="border:0;" />[% IF gb %]返回上一层[% ELSE %]糷[% END %]</a><br /> +<a href="../[% IF gb %]?gb=1[% END %]"><img src="http://images.ptt.cc/folder.gif" style="border:0;" />糷</a><br /> [% END %] [% FOREACH x=dat %] @@ -28,14 +28,14 @@ [% IF !gb %] <hr /> <form method="POST" action="/man.pl/[% brdname %]/"> -[% IF gb %]在这个精华区内翻弄[% ELSE %]硂弘地跋ず陆[% END %] +硂弘地跋ず陆 <input type="text" name="key"> -<input type="submit" value="[% IF gb %]捞[% ELSE %]即[% END %]"> +<input type="submit" value="即"> </form> [% END %] <hr /> -<font size="-1">[% IF gb %]制作时间[% ELSE %]籹丁[% END %]: [% buildtime %]</font><br> -<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>) +<font size="-1">籹丁: [% buildtime %]</font><br> +<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>) </td></tr> </table> </body> diff --git a/staticweb/header.html b/staticweb/header.html index 9683178b..5dc7161b 100644 --- a/staticweb/header.html +++ b/staticweb/header.html @@ -5,7 +5,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="[% lang %]" lang="[% lang %]"> <head> - <title>[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %][% IF exttitle %] - [% exttitle %][% END %]</title> + <title>у金金龟穨[% IF exttitle %] - [% exttitle %][% END %]</title> <meta http-equiv="Content-Type" content="text/html; charset=[% charset %]"> <meta name="generator" content="pttMan" /> diff --git a/staticweb/index.html b/staticweb/index.html index 6ad6e831..e13f7d2d 100644 --- a/staticweb/index.html +++ b/staticweb/index.html @@ -5,7 +5,7 @@ </td></tr> <tr><td> -<a href="http://man.ptt.cc/index.pl/[% IF gb %]?gb=1[% END %]">[% IF gb %]批踢踢实业坊之精华区[% ELSE %]у金金龟穨ぇ弘地跋[% END %]</a> +<a href="http://man.ptt.cc/index.pl/[% IF gb %]?gb=1[% END %]">у金金龟穨ぇ弘地跋</a> [% FOREACH x=class %] »<a href="/index.pl[% x.path %]">[% x.title %]</a> [% END %] @@ -40,7 +40,7 @@ </td></tr> <tr><td> <hr /> -<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>) +<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>) </td></tr> </table> </body> diff --git a/staticweb/index.pl b/staticweb/index.pl index d4c9e14c..87c9b5f5 100755 --- a/staticweb/index.pl +++ b/staticweb/index.pl @@ -42,21 +42,17 @@ sub main foreach( @{$brd{$bid}} ){ next if( $_->[0] == -1 && ! -e "$MANDATA/$_->[1].db" ); - b2g::big5togb($_->[2]) if( $rh{gb} ); push @{$rh{dat}}, $_; } my $path = ''; foreach( $ENV{PATH_INFO} =~ m|(\w+)|g ){ - my $t = $brd{"$_.title"}; - b2g::big5togb($t) if( $rh{gb} ); push @{$rh{class}}, {path => "$path/$_/", - title => $t}; + title => $brd{"$_.title"}}; $path .= "/$_"; } $rh{exttitle} = ($rh{class} ? - $rh{class}[ $#{@{$rh{class}}} ]{title} : - ($rh{gb} ? '首页' : '')); + $rh{class}[ $#{@{$rh{class}}} ]{title} : ''); $tmpl = Template->new({INCLUDE_PATH => '.', ABSOLUTE => 0, @@ -64,8 +60,17 @@ sub main RECURSION => 0, EVAL_PERL => 0, COMPILE_EXT => '.tmpl', - COMPILE_DIR => $MANCACHE}); - $tmpl->process('index.html', \%rh); + COMPILE_DIR => $MANCACHE, + }); + if( !$rh{gb} ){ + $tmpl->process('index.html', \%rh); + } + else{ + my $output; + $tmpl->process('index.html', \%rh, \$output); + b2g::big5togb($output); + print $output; + } } main(); diff --git a/staticweb/man.pl b/staticweb/man.pl index 6afb7410..003f7ebf 100755 --- a/staticweb/man.pl +++ b/staticweb/man.pl @@ -59,7 +59,17 @@ sub main $rh->{lang} = 'zh_TW'; $rh->{charset} = 'big5'; } - $tmpl->process($rh->{tmpl}, $rh); + + if( !$rh->{gb} ){ + $tmpl->process($rh->{tmpl}, $rh); + } + else{ + my $output; + $tmpl->process($rh->{tmpl}, $rh, \$output); + b2g::big5togb($output); + print $output; + } + untie %db; } @@ -71,8 +81,6 @@ sub dirmode compress => 0, ); foreach( @{$serial->deserialize($db{$fpath}) || []} ){ - $_->[1] =~ s/([\xA1-\xF9].)/$b2g{$1}/eg if( $isgb ); - #Encode::from_to($_->[1], 'big5', 'gbk') if( $isgb ); $isdir = (($_->[0] =~ m|/$|) ? 1 : 0); push @{$th{dat}}, {isdir => $isdir, fn => "man.pl/$brdname$_->[0]", @@ -108,8 +116,6 @@ sub articlemode $th{content} =~ s|ptt\.twbbs\.org|<a href="telnet://ptt.cc">ptt.twbbs.org</a>|gs; - $th{content} =~ s/([\xA1-\xF9].)/$b2g{$1}/eg if( $isgb ); - #Encode::from_to($th{content}, 'big5', 'gbk') if( $isgb ); return \%th; } |