#!/usr/bin/perl -w # 作者: http://www.cyut.edu.tw/~ckhung/ # 版權聲明: XFree86 Style use strict; # table of frequently referenced sites my (%site_official) = ( unixfaq => 'gopher://gopher.csie.nctu.edu.tw/00/NCTU/CSIE/center/ccfaq/unix-faq/', ASPAC => 'http://phi.sinica.edu.tw/aspac/', idv => 'http://www.cle.idv.tw/free-doc/', Netman => 'http://www.study-area.net/', ckhung => 'http://www.cyut.edu.tw/~ckhung/b/', ); my (%site_local_mirror) = ( ASPAC => 'file://localhost/mirror/phi.sinica.edu.tw/aspac/', ckhung => 'file://localhost/home/ckhung/b/', ); my ($S); $S = \%site_local_mirror; $S = \%site_official; # article index database my (%aidb) = ( ################################################################# '1. 使用者篇' => { '1. 電腦入門' => [ ], '2. 命令列操作/scripting' => [ ['洪朝貴', "$S->{ckhung}gnulinux/basictool.shtml", '基本求生工具' ], ['?', "$S->{unixfaq}unix", '常用指令簡介' ], ['蔡孟光', "$S->{idv}shell_script", 'Unix 的批次檔 - Shell Script' ], ['網中人', "$S->{Netman}linux/system/linux_shell.htm", 'Shell 和 Shell Script'], ['?', "$S->{idv}unix-manul", 'unix manual' ], ['ASPAC', "$S->{ASPAC}reports/94/94019/", 'Regular expression 簡介' ], ['洪朝貴', "$S->{ckhung}gnulinux/regexp.shtml", 'Regular Expressions' ], ['洪朝貴', "$S->{ckhung}liblet/textmode.shtml", '反樸歸真: 文字模式下的程式設計' ], ], '3. 視窗環境操作與設定' => [ ['ASPAC', "$S->{ASPAC}reports/94/94025/", 'X Window 入門' ], ], '4. 文字檔案編輯' => [ ['Edward Lee', "$S->{Netman}tips/vim/", '大家來學 Vim'], ['ASPAC', "$S->{ASPAC}reports/94/94016/", 'Emacs 使用手冊' ], ['Samuel Lu', "http://members.tripodasia.com.tw/phycomp/Articles/Html_Intro/Linux_HTML.html", '在 Linux 如何寫 HTML 文件' ], ], '5. 收發信件' => [ ['ASPAC', "$S->{ASPAC}reports/94/94012/", '電子郵件系統 ELM 簡介' ], ], '6. 遊戲' => [ ], '7. 繪圖' => [ ['李旬政', "http://micro.ee.nthu.edu.tw/~retry/", 'Gimp 範例教學' ], ['ASPAC', "$S->{ASPAC}reports/94/94001/chap4.html", '圖文整合軟體的介紹' ], ], '8. 聲音' => [ ['Edward Lee', "$S->{Netman}tips/rosegarden/rosegarden.html", '樂譜、midi 作曲軟體 Rosegarden 簡介'], ], '9. 資料庫' => [ ['Postgres Team', "$S->{idv}postgresql_big5/part-tutorial.htm", '(PostgreSQL) 教學課程' ], ], '10. 數學' => [ ['ASPAC', "$S->{ASPAC}reports/94/94002/", 'GNUPLOT 使用手冊' ], ['ASPAC', "$S->{ASPAC}reports/95/95006/", 'GNUPLOT 導讀' ], ['洪朝貴', "$S->{ckhung}mathtool/gnuplot.shtml", 'gnuplot: 函數與資料繪圖' ], ], }, ################################################################# '2. 管理者篇' => { '1. 安裝' => [ ['網中人', "$S->{Netman}linux/system/linux_install.htm", '安裝Linux' ], ], '2. 網路' => [ ], }, ################################################################# '3. 程式設計篇' => { }, ################################################################# ); sub genhtml { my ($key, $val, $level) = @_; my ($k); print "$key\n"; if (ref($val) eq "HASH") { foreach $k (sort keys %$val) { $k =~ m#^(\d+)\.\s*(.*)$#; genhtml($2, $val->{$k}, $level+1); } } elsif (ref($val) eq "ARRAY") { print "
    \n"; foreach $k (@$val) { print "
  1. [1]\">$k->[2] ($k->[0])
  2. \n"; } print "
\n"; } } print "Content-type: text/html\n\n"; open F, "resource.htm"; while () { print; next unless m""; my ($k); foreach $k (sort keys %aidb) { $k =~ m#^(\d+)\.\s*(.*)$#; print "
\n"; genhtml($2, $aidb{$k}, 2); } } close F;