HTML Tidy Configuration Options
我們現在的網站大部分都是HTML的,如果希望將它們標準化,手工的一頁一頁修改非常麻煩。如果有一個工具能自動將HTML轉換成符合標準的XHTML就好了。其實在這方面已經有許多商業和免費的工具軟體可以使用,這裡將要介紹的HTML Tidy 就是一個很基本但很有用的工具,它可以運行在多種平台上,而且是開放原始碼的。
HTML Tidy 是一個能夠HTML檔案的錯誤及整齊的排列代碼(即縮排)的軟體及函式庫。
HTML Tidy 是由W3C的Dave Raggett開發,其後成為一個Sourceforge的專案,其源碼是使用ANSI C寫成,而適用於不同作業系統的執行檔則可因此而編譯而成。而HTML Tidy是根據W3C license(寬鬆的BSD許可證)授權下發布。
修正HTML錯誤如:
- 遺漏元素結束標籤或錯配元素標籤
- 補回遺漏的項目(例如一些元素標籤,引號等...)
- 回報檔案是否使用私人的HTML元素或擴充
- 根據預先設定的風格改變排版
- 將某些編碼的字元轉換至HTML字元編碼
- 清理呈現式元素
[myFormat]<br />add-xml-decl=no<br />add-xml-space=no<br />alt-text=<br />assume-xml-procins=no<br />bare=no<br />break-before-br=no<br />clean=no<br />doctype=auto<br />drop-empty-paras=yes<br />drop-font-tags=yes<br />drop-proprietary-attributes=no<br />enclose-block-text=yes<br />enclose-text=yes<br />escape-cdata=no<br />fix-bad-comments=yes<br />fix-uri=yes<br />hide-comments=no<br />hide-endtags=no<br />indent-cdata=no<br />input-xml=no<br />join-classes=no<br />join-styles=yes<br />logical-emphasis=yes<br />lower-literals=yes<br />ncr=yes<br />new-blocklevel-tags=<br />new-empty-tags=<br />new-inline-tags=<br />new-pre-tags=<br />numeric-entities=no<br />output-xhtml=no<br />output-xml=no<br />quote-ampersand=no<br />quote-marks=no<br />quote-nbsp=no<br />repeated-attributes=keep-last<br />replace-color=no<br />show-body-only=no<br />uppercase-attributes=no<br />uppercase-tags=no<br />word-2000=no<br />show-errors=6<br />show-warnings=yes<br />indent=auto<br />indent-attributes=no<br />indent-spaces=2<br />literal-attributes=no<br />markup=yes<br />tab-size=4<br />wrap=100<br />wrap-asp=yes<br />wrap-attributes=no<br />wrap-jste=yes<br />wrap-php=yes<br />wrap-script-literals=no<br />wrap-sections=yes<br />ascii-chars=no<br />char-encoding=raw<br />input-encoding=<br />language=<br />output-bom=auto<br />output-encoding=<br />newline=<br />fix-backslash=yes<br />force-output=no<br />gnu-emacs=no<br />quiet=no<br />keep-time=yes<br />write-back=yes<br />tidy-mark=no<br />default=0
下面的一些說明
[myFormat]
add-xml-decl=no
add-xml-space=no
alt-text=
assume-xml-procins=no
bare=no
break-before-br=no
clean=no
doctype=auto
drop-empty-paras=yes
drop-font-tags=no
drop-proprietary-attributes=no
enclose-block-text=yes
enclose-text=yes
escape-cdata=no
fix-bad-comments=yes
fix-uri=yes
hide-comments=no
hide-endtags=no
indent-cdata=no
input-xml=no
join-classes=no
join-styles=yes
logical-emphasis=yes
lower-literals=yes
ncr=yes
new-blocklevel-tags=
new-empty-tags=
new-inline-tags=
new-pre-tags=
numeric-entities=no
output-xhtml=no
output-xml=no
quote-ampersand=no
quote-marks=no
quote-nbsp=no
repeated-attributes=keep-last
replace-color=no
show-body-only=no
uppercase-attributes=no
uppercase-tags=no
word-2000=no
show-errors=6
show-warnings=yes
indent=auto
indent-attributes=no
indent-spaces=2
literal-attributes=no
markup=yes
tab-size=4
wrap=100
wrap-asp=yes
wrap-attributes=no
wrap-jste=yes
wrap-php=yes
wrap-script-literals=no
wrap-sections=yes
ascii-chars=no
char-encoding=raw
input-encoding=
language=
output-bom=auto
output-encoding=
newline=
fix-backslash=yes
force-output=no
gnu-emacs=no
quiet=no
keep-time=yes
write-back=yes
tidy-mark=no
default=0
下面貼上一張預設配置單,具體意義在google上找吧,很多
HTML Tidy Configuration Options
HTML, XHTML, XML
Diagnostics
Pretty Print
Character Encoding
Miscellaneous
| HTML, XHTML, XML Options |
Top |
| Option |
Type |
Default |
| add-xml-decl |
Boolean |
no |
| add-xml-pi |
Boolean |
no |
| add-xml-space |
Boolean |
no |
| alt-text |
String |
|
| assume-xml-procins |
Boolean |
no |
| bare |
Boolean |
no |
| break-before-br |
Boolean |
no |
| clean |
Boolean |
no |
| doctype |
DocType |
auto |
| drop-empty-paras |
Boolean |
yes |
| drop-font-tags |
Boolean |
no |
| drop-proprietary-attributes |
Boolean |
no |
| enclose-block-text |
Boolean |
no |
| enclose-text |
Boolean |
no |
| escape-cdata |
Boolean |
no |
| fix-bad-comments |
Boolean |
yes |
| fix-uri |
Boolean |
yes |
| hide-comments |
Boolean |
no |
| hide-endtags |
Boolean |
no |
| indent-cdata |
Boolean |
no |
| input-xml |
Boolean |
no |
| join-classes |
Boolean |
no |
| join-styles |
Boolean |
yes |
| logical-emphasis |
Boolean |
no |
| lower-literals |
Boolean |
yes |
| ncr |
Boolean |
yes |
| new-blocklevel-tags |
Tag names |
|
| new-empty-tags |
Tag names |
|
| new-inline-tags |
Tag names |
|
| new-pre-tags |
Tag names |
|
| numeric-entities |
Boolean |
no |
| output-xhtml |
Boolean |
no |
| output-xml |
Boolean |
no |
| quote-ampersand |
Boolean |
yes |
| quote-marks |
Boolean |
no |
| quote-nbsp |
Boolean |
yes |
| repeated-attributes |
- |
keep-last |
| replace-color |
Boolean |
no |
| show-body-only |
Boolean |
no |
| slide-style |
Name |
|
| split |
Boolean |
no |
| uppercase-attributes |
Boolean |
no |
| uppercase-tags |
Boolean |
no |
| word-2000 |
Boolean |
no |
|
| Diagnostics Options |
Top |
| Option |
Type |
Default |
| error-file |
String |
|
| force-output |
Boolean |
no |
| gnu-emacs |
Boolean |
no |
| quiet |
Boolean |
no |
| show-errors |
Integer |
6 |
| show-warnings |
Boolean |
yes |
| tidy-mark |
Boolean |
yes |
|
| Pretty Print Options |
Top |
| Option |
Type |
Default |
| indent |
AutoBool |
no |
| indent-attributes |
Boolean |
no |
| indent-spaces |
Integer |
2 |
| literal-attributes |
Boolean |
no |
| markup |
Boolean |
yes |
| tab-size |
Integer |
4 |
| wrap |
Integer |
68 |
| wrap-asp |
Boolean |
yes |
| wrap-attributes |
Boolean |
no |
| wrap-jste |
Boolean |
yes |
| wrap-php |
Boolean |
yes |
| wrap-script-literals |
Boolean |
no |
| wrap-sections |
Boolean |
yes |
|
| Character Encoding Options |
Top |
| Option |
Type |
Default |
| ascii-chars |
Boolean |
yes |
| char-encoding |
Encoding |
ascii |
| input-encoding |
Encoding |
latin1 |
| language |
Language |
|
| output-bom |
AutoBool |
auto |
| output-encoding |
Encoding |
ascii |
| raw |
Boolean |
no |
|
| Miscellaneous Options |
Top |
| Option |
Type |
Default |
| fix-backslash |
Boolean |
yes |
| keep-time |
Boolean |
yes |
| write-back |
Boolean |
no |