Class: CodeRay::Encoders::HTML::CSS
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/html/css.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#stylesheet ⇒ Object
readonly
Returns the value of attribute stylesheet.
Class Method Summary collapse
Instance Method Summary collapse
- #get_style_for_css_classes(css_classes) ⇒ Object
-
#initialize(style = :default) ⇒ CSS
constructor
A new instance of CSS.
Constructor Details
#initialize(style = :default) ⇒ CSS
Returns a new instance of CSS.
13 14 15 16 17 18 19 20 21 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/html/css.rb', line 13 def initialize style = :default @styles = 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
#stylesheet ⇒ Object (readonly)
Returns the value of attribute stylesheet.
7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/html/css.rb', line 7 def stylesheet @stylesheet end |
Class Method Details
Instance Method Details
#get_style_for_css_classes(css_classes) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/html/css.rb', line 23 def get_style_for_css_classes css_classes cl = @styles[css_classes.first] return '' unless cl style = '' 1.upto css_classes.size do |offset| break if style = cl[css_classes[offset .. -1]] end # warn 'Style not found: %p' % [styles] if style.empty? return style end |