From 23d2a5f2c6b876ba31a52e927973cdd57e2b6ef4 Mon Sep 17 00:00:00 2001 From: murphy Date: Wed, 15 Mar 2006 23:45:09 +0000 Subject: Fixed HTML encoder. Changed HTML::CSS.load_stylesheet behaviour. --- lib/coderay/encoders/html.rb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'lib/coderay/encoders/html.rb') diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index c57d20d..08390ad 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -120,18 +120,17 @@ module Encoders end def self.token_path_to_hint hint, classes - if hint - title = if hint == :debug - k.inspect - elsif hint == :info_long - classes.map { |kind| TOKEN_KIND_TO_INFO[kind] }.join('/') - elsif hint == :info + return '' unless hint + title = + case hint + when :info TOKEN_KIND_TO_INFO[classes.first] + when :info_long + classes.map { |kind| TOKEN_KIND_TO_INFO[kind] }.join('/') + when :debug + k.inspect end - " title=\"#{title}\"" - else - '' - end + " title=\"#{title}\"" end def setup options @@ -176,12 +175,12 @@ module Encoders styles = [k] end type = styles.first - styles.map! { |c| ClassOfKind[c] } - if styles.first == :NO_HIGHLIGHT and not hint + classes = styles.map { |c| ClassOfKind[c] } + if classes.first == :NO_HIGHLIGHT and not hint h[k] = false else title = HTML.token_path_to_hint hint, styles - style = @css[*styles] + style = @css[*classes] h[k] = if style '' % [title, style] -- cgit v1.2.1