mirror of
https://github.com/danbulant/api_docs
synced 2026-05-27 13:52:12 +00:00
Fix bug with no-language code blocks erroring, fixes #716
This commit is contained in:
parent
7090d80067
commit
0c30e8ed7a
1 changed files with 8 additions and 4 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
module Multilang
|
module Multilang
|
||||||
def block_code(code, full_lang_name)
|
def block_code(code, full_lang_name)
|
||||||
|
if full_lang_name
|
||||||
parts = full_lang_name.split('--')
|
parts = full_lang_name.split('--')
|
||||||
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
|
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|
|
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
|
||||||
match + " tab-" + full_lang_name
|
match + " tab-" + full_lang_name
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
super(code, full_lang_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue