3-3「可標準化」 實驗

Tidy 是 w3c 發展的工具, 不僅可以將網頁修繕至符合 w3c 的標準, 亦可轉換出 xhtml 檔 。 筆者數年來用 vi "徒手" 建立的數百網頁, 靠一個命令: tidy `find ~/public_html -name '*.*htm*'` 就完成了大部分的轉換工作 (需配合設定檔) 。 當然有些工作必須人工處理, 例如圖形與表格的文字說明, 如果由程式自動產生無意義的代號, 就失去了建構無障礙網頁空間的原意。

Tidy 所產生出來的網頁, 符合w3c的標準, 所以你可以為他貼上「符合 xhtml 1.0」的標籤。 如果 alt 及 summary 等 attributes 也都經由人工仔細填入有意義的說明文字, 並且網站內沒有提供封閉格式的下載檔案 (還有一些細節要求, 詳見 Bobby 網站) 那麼還可以貼上「無障礙網頁」的標籤, 表明你尊重弱勢瀏覽者的用心。

本實驗目的在比較不同軟體所製作出來的檔案, 何者較容易以 tidy 進行 「標準化」 處理。

統計表

訊息\軟體 mozilla OO.o Word2000 WordXP
warnings 數目 1 13 72 63
errors 數目 0 0 23 19

mozilla 回應訊息

line 26 column 1 - warning: <table> lacks "summary" attribute
info: doctype given is "-//w3c//dtd html 4.01 transitional//en"
info: document content looks like xhtml 1.0 transitional
1 warning, 0 errors were found!

oo.o 回應訊息

line 27 column 119 - warning: replacing unexpected font by </font>
line 27 column 83 - warning: replacing unexpected span by </span>
line 44 column 120 - warning: replacing unexpected u by </u>
line 44 column 84 - warning: replacing unexpected span by </span>
line 44 column 75 - warning: replacing unexpected font by </font>
line 9 column 9 - warning: <style> inserting "type" attribute
line 29 column 31 - warning: <img> attribute "name" has invalid value "繒?禮?1"
line 29 column 31 - warning: <img> lacks "alt" attribute
line 29 column 31 - warning: <img> cannot copy name attribute to id
line 47 column 1 - warning: <table> proprietary attribute "bordercolor"
line 47 column 1 - warning: <table> lacks "summary" attribute
line 149 column 33 - warning: trimming empty <p>
line 157 column 33 - warning: trimming empty <p>
info: doctype given is "-//w3c//dtd html 4.0 transitional//en"
info: document content looks like html proprietary
13 warnings, 0 errors were found!

word2000 回應訊息

line 1 column 1 - warning: missing <!doctype> declaration
line 113 column 28 - error: <o:p> is not recognized!
line 113 column 28 - warning: discarding unexpected <o:p>
line 113 column 33 - warning: discarding unexpected </o:p>
line 115 column 79 - error: <o:p> is not recognized!
line 115 column 79 - warning: discarding unexpected <o:p>
line 115 column 84 - warning: discarding unexpected </o:p>
line 125 column 12 - error: <o:p> is not recognized!
line 125 column 12 - warning: discarding unexpected <o:p>
line 125 column 17 - warning: discarding unexpected </o:p>
line 127 column 79 - error: <o:p> is not recognized!
line 127 column 79 - warning: discarding unexpected <o:p>
line 127 column 84 - warning: discarding unexpected </o:p>
line 130 column 95 - warning: nested emphasis <span>
line 142 column 79 - error: <o:p> is not recognized!
line 142 column 79 - warning: discarding unexpected <o:p>
line 142 column 84 - warning: discarding unexpected </o:p>
line 175 column 41 - warning: nested emphasis <span>
line 180 column 50 - warning: nested emphasis <span>
line 195 column 79 - error: <o:p> is not recognized!
72 warnings, 23 errors were found! not all warnings/errors were shown.

wordxp 回應訊息

line 1 column 1 - warning: missing <!doctype> declaration
line 142 column 47 - error: <o:p> is not recognized!
line 142 column 47 - warning: discarding unexpected <o:p>
line 142 column 52 - warning: discarding unexpected </o:p>
line 146 column 47 - error: <o:p> is not recognized!
line 146 column 47 - warning: discarding unexpected <o:p>
line 146 column 58 - warning: discarding unexpected </o:p>
line 152 column 65 - error: <o:p> is not recognized!
line 152 column 65 - warning: discarding unexpected <o:p>
line 152 column 70 - warning: discarding unexpected </o:p>
line 156 column 30 - error: <o:p> is not recognized!
line 156 column 30 - warning: discarding unexpected <o:p>
line 156 column 41 - warning: discarding unexpected </o:p>
line 158 column 75 - warning: nested emphasis <span>
line 163 column 8 - error: <o:p> is not recognized!
line 163 column 8 - warning: discarding unexpected <o:p>
line 163 column 13 - warning: discarding unexpected </o:p>
line 169 column 30 - error: <o:p> is not recognized!
63 warnings, 19 errors were found! not all warnings/errors were shown.

config 設定檔內容

tidy-mark: yes
markup: yes
wrap: 72
tab-size: 8
indent: auto
indent-spaces: 2
output-xhtml: yes
doctype: loose
char-encoding: raw
clean: yes
logical-emphasis: yes
write-back: yes
keep-time: yes