root/galaxy-central/eggs/Cheetah-2.2.2-py2.6-macosx-10.6-universal-ucs2.egg/Cheetah/Utils/htmlEncode.py
| リビジョン 3, 508 bytes (コミッタ: kohda, 15 年 前) |
|---|
| 行番号 | |
|---|---|
| 1 | """This is a copy of the htmlEncode function in Webware. |
| 2 | |
| 3 | |
| 4 | @@TR: It implemented more efficiently. |
| 5 | |
| 6 | """ |
| 7 | htmlCodes = [ |
| 8 | ['&', '&'], |
| 9 | ['<', '<'], |
| 10 | ['>', '>'], |
| 11 | ['"', '"'], |
| 12 | ] |
| 13 | htmlCodesReversed = htmlCodes[:] |
| 14 | htmlCodesReversed.reverse() |
| 15 | |
| 16 | def htmlEncode(s, codes=htmlCodes): |
| 17 | """ Returns the HTML encoded version of the given string. This is useful to |
| 18 | display a plain ASCII text string on a web page.""" |
| 19 | for code in codes: |
| 20 | s = s.replace(code[0], code[1]) |
| 21 | return s |
Note: リポジトリブラウザについてのヘルプは TracBrowser
を参照してください。
![(trac.ini の [header_logo] セクションを設定してください)](/bh10.10/chrome/site/your_project_logo.png)