Skip to content

Commit

Permalink
Fix bug with no-language code blocks erroring, fixes #716
Browse files Browse the repository at this point in the history
  • Loading branch information
lord committed Mar 6, 2017
1 parent 7090d80 commit 0c30e8e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/multilang.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module Multilang
def block_code(code, full_lang_name)
parts = full_lang_name.split('--')
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
match + " tab-" + full_lang_name
if full_lang_name
parts = full_lang_name.split('--')
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
match + " tab-" + full_lang_name
end
else
super(code, full_lang_name)
end
end
end
Expand Down

0 comments on commit 0c30e8e

Please sign in to comment.