Skip to content

Commit

Permalink
rename pygments_config Hash to lexer_opts
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Feb 15, 2017
1 parent 7229dc4 commit dbea982
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/asciidoctor-pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1202,11 +1202,11 @@ def convert_listing_or_literal node
when 'pygments'
Helpers.require_library 'pygments', 'pygments.rb' unless defined? ::Pygments
lexer = ::Pygments::Lexer.find_by_alias(node.attr 'language', 'text', false) || ::Pygments::Lexer['text']
pygments_config = {
lexer_opts = {
nowrap: true,
noclasses: true,
stripnl: false,
style: style = (node.document.attr 'pygments-style') || 'pastie'
style: (style = (node.document.attr 'pygments-style') || 'pastie')
}
# TODO enable once we support background color on spans
#if node.attr? 'highlight', nil, false
Expand All @@ -1227,7 +1227,7 @@ def convert_listing_or_literal node
source_string, conum_mapping = extract_conums source_string
# NOTE pygments.rb strips trailing whitespace; preserve it in case there are conums on last line
num_trailing_spaces = source_string.size - (source_string = source_string.rstrip).size if conum_mapping
result = lexer.highlight source_string, options: pygments_config
result = lexer.highlight source_string, options: lexer_opts
fragments = guard_indentation text_formatter.format result
conum_mapping ? (restore_conums fragments, conum_mapping, num_trailing_spaces) : fragments
when 'rouge'
Expand Down

0 comments on commit dbea982

Please sign in to comment.