summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2015-10-30 17:06:12 -0600
committerDan Allen <dan.j.allen@gmail.com>2015-10-30 17:06:12 -0600
commitbe65c93db245ef48266a0d25fa6bc7d4e0781a5c (patch)
tree2e036c0dcac766fd59299bee7eec83a5bbc9c2a1 /lib
parentcc4690c41eb60f5159f19069c8a6ba31752874d8 (diff)
handle case when CodeRay passes nil text to text_token
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb b/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb
index cd8586fc..8cedc278 100644
--- a/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb
+++ b/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb
@@ -86,7 +86,8 @@ class CodeRayEncoder < ::CodeRay::Encoders::Encoder
if text == EOL
@out << { text: text }
@start_of_line = true
- else
+ # NOTE text is nil and kind is :error when CodeRay ends parsing on an error
+ elsif text
# NOTE add guard character to prevent Prawn from trimming indentation
text[0] = GuardedIndent if @start_of_line && (text.start_with? ' ')
text.gsub! InnerIndent, GuardedInnerIndent if text.include? InnerIndent