lib/rouge/theme.rb in rouge-1.11.0 vs lib/rouge/theme.rb in rouge-1.11.1

- old
+ new

@@ -61,10 +61,12 @@ @palette[arg] or raise "not in palette: #{arg.inspect}" end end end + def palette(*a) self.class.palette(*a) end + @styles = {} def self.styles @styles ||= InheritableHash.new(superclass.styles) end @@ -74,31 +76,29 @@ class << self def style(*tokens) style = tokens.last.is_a?(Hash) ? tokens.pop : {} - style = Style.new(self, style) - tokens.each do |tok| styles[tok] = style end end def get_own_style(token) token.token_chain.reverse_each do |anc| - return styles[anc] if styles[anc] + return Style.new(self, styles[anc]) if styles[anc] end nil end def get_style(token) get_own_style(token) || base_style end def base_style - styles[Token::Tokens::Text] + get_own_style(Token::Tokens::Text) end def name(n=nil) return @name if n.nil? @@ -148,10 +148,10 @@ # shared styles for tableized line numbers yield "#{@scope} table td { padding: 5px; }" yield "#{@scope} table pre { margin: 0; }" styles.each do |tok, style| - style.render(css_selector(tok), &b) + Style.new(self, style).render(css_selector(tok), &b) end end def render_base(selector, &b) self.class.base_style.render(selector, &b)