lib/rouge/formatters/html_inline.rb in rouge-2.0.7 vs lib/rouge/formatters/html_inline.rb in rouge-2.1.0
- old
+ new
@@ -4,10 +4,18 @@
module Formatters
class HTMLInline < HTML
tag 'html_inline'
def initialize(theme)
- @theme = theme
+ if theme.is_a?(Class) && theme < Rouge::Theme
+ @theme = theme.new
+ elsif theme.is_a?(Rouge::Theme)
+ @theme = theme
+ elsif theme.is_a?(String)
+ @theme = Rouge::Theme.find(theme).new
+ else
+ raise ArgumentError, "invalid theme: #{theme.inspect}"
+ end
end
def safe_span(tok, safe_val)
return safe_val if tok == Token::Tokens::Text