Class: Rouge::CSSTheme
Direct Known Subclasses
Themes::Base16, Themes::Colorful, Themes::Github, Themes::Gruvbox, Themes::Molokai, Themes::Monokai, Themes::MonokaiSublime, Themes::ThankfulEyes
Constant Summary
Constants included from Token::Tokens
Token::Tokens::Num, Token::Tokens::Str
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ CSSTheme
constructor
A new instance of CSSTheme.
- #render {|"#{@scope} table td { padding: 5px; }"| ... } ⇒ Object
- #render_base(selector, &b) ⇒ Object
- #style_for(tok) ⇒ Object
Methods inherited from Theme
base_style, find, #get_own_style, get_own_style, get_style, #get_style, name, palette, #palette, registry, render, style, styles, #styles
Methods included from Token::Tokens
Constructor Details
#initialize(opts = {}) ⇒ CSSTheme
Returns a new instance of CSSTheme.
149 150 151 |
# File 'lib/rouge/theme.rb', line 149 def initialize(opts={}) @scope = opts[:scope] || '.highlight' end |
Instance Method Details
#render {|"#{@scope} table td { padding: 5px; }"| ... } ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/rouge/theme.rb', line 153 def render(&b) return enum_for(:render).to_a.join("\n") unless b # shared styles for tableized line numbers yield "#{@scope} table td { padding: 5px; }" yield "#{@scope} table pre { margin: 0; }" styles.each do |tok, style| Style.new(self, style).render(css_selector(tok), &b) end end |
#render_base(selector, &b) ⇒ Object
165 166 167 |
# File 'lib/rouge/theme.rb', line 165 def render_base(selector, &b) self.class.base_style.render(selector, &b) end |
#style_for(tok) ⇒ Object
169 170 171 |
# File 'lib/rouge/theme.rb', line 169 def style_for(tok) self.class.get_style(tok) end |