summaryrefslogtreecommitdiff
path: root/lib/coderay
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2006-03-16 19:28:02 +0000
committermurphy <murphy@rubychan.de>2006-03-16 19:28:02 +0000
commitf8c4a4b0902575d1bfaafbd16379cc55bf3906c3 (patch)
treebb0c8468dc207255629ff20bc3815e62b92751ef /lib/coderay
parentace3fcea2ffccb6d88f155cd884eb05d2b2cb067 (diff)
downloadcoderay-f8c4a4b0902575d1bfaafbd16379cc55bf3906c3.tar.gz
Changed HTML encoder evil char handling (allowing for UTF-8 now.)
Diffstat (limited to 'lib/coderay')
-rw-r--r--lib/coderay/encoders/html.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index 02a718b..b75f9e5 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -100,14 +100,15 @@ module Encoders
'<' => '&lt;',
}
- # This is to prevent illegal HTML.
+ # This was to prevent illegal HTML.
# Strange chars should still be avoided in codes.
- evil_chars = Array(0x00...0x20) - [?n, ?t]
+ evil_chars = Array(0x00...0x20) - [?\n, ?\t, ?\s]
evil_chars.each { |i| HTML_ESCAPE[i.chr] = ' ' }
- ansi_chars = Array(0x7f..0xff)
- ansi_chars.each { |i| HTML_ESCAPE[i.chr] = '&#%d;' % i }
+ #ansi_chars = Array(0x7f..0xff)
+ #ansi_chars.each { |i| HTML_ESCAPE[i.chr] = '&#%d;' % i }
# \x9 (\t) and \xA (\n) not included
- HTML_ESCAPE_PATTERN = /[\t&"><\xB-\x1f\x7f-\xff\0-\x8]/
+ #HTML_ESCAPE_PATTERN = /[\t&"><\0-\x8\xB-\x1f\x7f-\xff]/
+ HTML_ESCAPE_PATTERN = /[\t"&><\0-\x8\xB-\x1f]/
TOKEN_KIND_TO_INFO = Hash.new { |h, kind|
h[kind] =