Skip to content

Commit 0c30e8e

Browse files
committed
Fix bug with no-language code blocks erroring, fixes #716
1 parent 7090d80 commit 0c30e8e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/multilang.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
module Multilang
22
def block_code(code, full_lang_name)
3-
parts = full_lang_name.split('--')
4-
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
5-
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
6-
match + " tab-" + full_lang_name
3+
if full_lang_name
4+
parts = full_lang_name.split('--')
5+
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
6+
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
7+
match + " tab-" + full_lang_name
8+
end
9+
else
10+
super(code, full_lang_name)
711
end
812
end
913
end

0 commit comments

Comments
 (0)