From 0c30e8ed7a908fbeb77b0505781bd406d47107a8 Mon Sep 17 00:00:00 2001 From: Robert Lord Date: Mon, 6 Mar 2017 15:24:22 -0600 Subject: [PATCH] Fix bug with no-language code blocks erroring, fixes #716 --- lib/multilang.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/multilang.rb b/lib/multilang.rb index 2eaae439a7a..36fbe5b1f07 100644 --- a/lib/multilang.rb +++ b/lib/multilang.rb @@ -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