mirror of
https://github.com/danbulant/api_docs
synced 2026-06-14 11:51:09 +00:00
Fixing an issue when no language is specified (#707)
parts[0] can lead to a nil class exception. Using the ternary gives the same functionality without causing things to fail
This commit is contained in:
parent
f7d1bd1da5
commit
599212e0ae
1 changed files with 1 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
module Multilang
|
||||
def block_code(code, full_lang_name)
|
||||
parts = full_lang_name.split('--')
|
||||
rouge_lang_name = parts[0] || ""
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue