api_docs/lib/multilang.rb
Matt Billock 599212e0ae 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
2017-02-28 12:35:58 -06:00

12 lines
468 B
Ruby

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
end
end
end
require 'middleman-core/renderers/redcarpet'
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang