Class: CodeRay::Encoders::HTML::CSS
- Inherits:
-
Object
- Object
- CodeRay::Encoders::HTML::CSS
- Defined in:
- vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb
Constant Summary
- CSS_CLASS_PATTERN =
/ ( # $1 = selectors (?: (?: \s* \. [-\w]+ )+ \s* ,? )+ ) \s* \{ \s* ( [^\}]+ )? # $2 = style \s* \} \s* | ( . ) # $3 = error /mx
Instance Attribute Summary
-
- (Object) stylesheet
readonly
Returns the value of attribute stylesheet.
Class Method Summary
Instance Method Summary
- - (Object) [](*styles)
-
- (CSS) initialize(style = :default)
constructor
A new instance of CSS.
Constructor Details
- (CSS) initialize(style = :default)
A new instance of CSS
13 14 15 16 17 18 19 20 21 |
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb', line 13 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 |
Instance Attribute Details
- (Object) stylesheet (readonly)
Returns the value of attribute stylesheet
7 8 9 |
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb', line 7 def stylesheet @stylesheet end |
Class Method Details
+ (Object) load_stylesheet(style = nil)
9 10 11 |
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb', line 9 def CSS.load_stylesheet style = nil CodeRay::Styles[style] end |
Instance Method Details
- (Object) [](*styles)
23 24 25 26 27 28 29 30 31 32 |
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb', line 23 def [] *styles cl = @classes[styles.first] return '' unless cl style = '' 1.upto(styles.size) do |offset| break if style = cl[styles[offset .. -1]] end # warn 'Style not found: %p' % [styles] if style.empty? return style end |