summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r--lib/coderay/encoders/html.rb2
-rw-r--r--lib/coderay/encoders/html/css.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index 20f2409..6dd231a 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -142,6 +142,7 @@ module Encoders
HTML_ESCAPE = make_html_escape_hash
HTML_ESCAPE_PATTERN = /[\t"&><\0-\x8\xB-\x1F]/
+ # FIXME: cache attack
TOKEN_KIND_TO_INFO = Hash.new do |h, kind|
h[kind] = kind.to_s.gsub(/_/, ' ').gsub(/\b\w/) { $&.capitalize }
end
@@ -284,6 +285,7 @@ module Encoders
end
def make_span_for_kinds method, hint
+ # FIXME: cache attack
Hash.new do |h, kinds|
h[kinds.is_a?(Symbol) ? kinds : kinds.dup] = begin
css_class = css_class_for_kinds(kinds)
diff --git a/lib/coderay/encoders/html/css.rb b/lib/coderay/encoders/html/css.rb
index 164d7f8..de98f0e 100644
--- a/lib/coderay/encoders/html/css.rb
+++ b/lib/coderay/encoders/html/css.rb
@@ -21,6 +21,7 @@ module Encoders
end
def get_style_for_css_classes css_classes
+ # FIXME: cache attack
cl = @styles[css_classes.first]
return '' unless cl
style = ''
@@ -52,6 +53,7 @@ module Encoders
for selector in selectors.split(',')
classes = selector.scan(/[-\w]+/)
cl = classes.pop
+ # FIXME: cache attack
@styles[cl] ||= Hash.new
@styles[cl][classes] = style.to_s.strip.delete(' ').chomp(';')
end