Skip to content

Commit

Permalink
use public method to apply substitution to source in Pygments adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Apr 16, 2021
1 parent 8cbedeb commit b6d9c9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/asciidoctor/syntax_highlighter/pygments.rb
Expand Up @@ -33,13 +33,13 @@ def highlight node, source, lang, opts
highlighted = highlighted.sub WrapperTagRx, PreTagCs
opts[:callouts] ? [highlighted, (idx = highlighted.index CodeCellStartTagCs) ? idx + CodeCellStartTagCs.length : nil] : highlighted
else
node.sub_specialchars source # handles nil response from ::Pygments::Lexer#highlight
node.sub_source source, false # handles nil response from ::Pygments::Lexer#highlight
end
elsif (highlighted = lexer.highlight source, options: highlight_opts)
highlighted = highlighted.gsub StyledLinenoSpanTagRx, LinenoSpanTagCs if linenos && noclasses
highlighted.sub WrapperTagRx, '\1'
else
node.sub_specialchars source # handles nil response from ::Pygments::Lexer#highlight
node.sub_source source, false # handles nil response from ::Pygments::Lexer#highlight
end
end

Expand Down

0 comments on commit b6d9c9a

Please sign in to comment.