diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/code_block.rb | 3 | ||||
-rw-r--r-- | plugins/include_code.rb | 3 | ||||
-rw-r--r-- | plugins/pygments_code.rb | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 55267a36..d82893ea 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -77,9 +77,6 @@ module Jekyll source += @caption if @caption source = context['pygments_prefix'] + source if context['pygments_prefix'] if @filetype - @filetype = 'objc' if @filetype == 'm' - @filetype = 'perl' if @filetype == 'pl' - @filetype = 'yaml' if @filetype == 'yml' source += " #{highlight(code, @filetype)}</figure></div>" else source += "#{tableize_code(code.lstrip.rstrip.gsub(/</,'<'))}</figure></div>" diff --git a/plugins/include_code.rb b/plugins/include_code.rb index e064fe2c..d910c3e6 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -53,9 +53,6 @@ module Jekyll Dir.chdir(code_path) do code = file.read @filetype = file.extname.sub('.','') - @filetype = 'objc' if @filetype == 'm' - @filetype = 'perl' if @filetype == 'pl' - @filetype = 'yaml' if @filetype == 'yml' title = @title ? "#{@title} (#{file.basename})" : file.basename url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}" source = "<div><figure role=code><figcaption><span>#{title}</span> <a href='#{url}'>download</a></figcaption>\n" diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index 1930ec83..67ce8c34 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -7,6 +7,10 @@ FileUtils.mkdir_p(PYGMENTS_CACHE_DIR) module HighlightCode def highlight(str, lang) + lang = 'ruby' if lang == 'ru' + lang = 'objc' if lang == 'm' + lang = 'perl' if lang == 'pl' + lang = 'yaml' if lang == 'yml' str = pygments(str, lang).match(/<pre>(.+)<\/pre>/m)[1].to_s.gsub(/ *$/, '') #strip out divs <div class="highlight"> tableize_code(str, lang) end |