lib/asciidoctor/syntax_highlighter/rouge.rb in asciidoctor-2.0.6 vs lib/asciidoctor/syntax_highlighter/rouge.rb in asciidoctor-2.0.7
- old
+ new
@@ -3,12 +3,11 @@
class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
register_for 'rouge'
def initialize *args
super
- @requires_stylesheet = nil
- @style = nil
+ @requires_stylesheet = @style = nil
end
def highlight?
library_available?
end
@@ -17,12 +16,12 @@
lexer = (::Rouge::Lexer.find_fancy lang) || ::Rouge::Lexers::PlainText
lexer_opts = lexer.tag == 'php' && !(node.option? 'mixed') ? { start_inline: true } : {}
@style ||= (style = opts[:style]) && (style_available? style) || DEFAULT_STYLE
if opts[:css_mode] == :class
@requires_stylesheet = true
- formatter = ::Rouge::Formatters::HTML.new @style
+ formatter = ::Rouge::Formatters::HTML.new inline_theme: @style
else
- formatter = ::Rouge::Formatters::HTMLInline.new @style
+ formatter = ::Rouge::Formatters::HTMLInline.new (::Rouge::Theme.find @style).new
end
if (highlight_lines = opts[:highlight_lines])
formatter = RougeExt::Formatters::HTMLLineHighlighter.new formatter, lines: highlight_lines
end
if opts[:number_lines]