##// END OF EJS Templates
Replaced french word "anonyme" at app/views/wiki/diff.rhtml with label_user_anonymous (#8994)....
Replaced french word "anonyme" at app/views/wiki/diff.rhtml with label_user_anonymous (#8994). Contributed by Tom Rochette. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6410 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r4619:144ca23442a5
r6290:77f0756bc046
Show More
css.rb
70 lines | 1.6 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Added syntax highlightment for repository files (using CodeRay)....
r638 module CodeRay
module Encoders
class HTML
class CSS
attr :stylesheet
def CSS.load_stylesheet style = nil
CodeRay::Styles[style]
end
def initialize style = :default
@classes = Hash.new
style = CSS.load_stylesheet style
@stylesheet = [
style::CSS_MAIN_STYLES,
style::TOKEN_COLORS.gsub(/^(?!$)/, '.CodeRay ')
].join("\n")
parse style::TOKEN_COLORS
end
def [] *styles
cl = @classes[styles.first]
return '' unless cl
style = ''
1.upto(styles.size) do |offset|
break if style = cl[styles[offset .. -1]]
end
Jean-Philippe Lang
Upgrade CodeRay to 0.9.2 (#3359)....
r3478 # warn 'Style not found: %p' % [styles] if style.empty?
Jean-Philippe Lang
Added syntax highlightment for repository files (using CodeRay)....
r638 return style
end
private
CSS_CLASS_PATTERN = /
Jean-Philippe Lang
Upgrade CodeRay to 0.9.2 (#3359)....
r3478 ( # $1 = selectors
(?:
(?: \s* \. [-\w]+ )+
\s* ,?
)+
)
Jean-Philippe Lang
Added syntax highlightment for repository files (using CodeRay)....
r638 \s* \{ \s*
( [^\}]+ )? # $2 = style
\s* \} \s*
|
( . ) # $3 = error
/mx
def parse stylesheet
Jean-Philippe Lang
Upgrade CodeRay to 0.9.2 (#3359)....
r3478 stylesheet.scan CSS_CLASS_PATTERN do |selectors, style, error|
Jean-Philippe Lang
Added syntax highlightment for repository files (using CodeRay)....
r638 raise "CSS parse error: '#{error.inspect}' not recognized" if error
Jean-Philippe Lang
Upgrade CodeRay to 0.9.2 (#3359)....
r3478 for selector in selectors.split(',')
classes = selector.scan(/[-\w]+/)
cl = classes.pop
@classes[cl] ||= Hash.new
@classes[cl][classes] = style.to_s.strip.delete(' ').chomp(';')
end
Jean-Philippe Lang
Added syntax highlightment for repository files (using CodeRay)....
r638 end
end
end
end
end
end
if $0 == __FILE__
require 'pp'
pp CodeRay::Encoders::HTML::CSS.new
end