From 6f646e7290114721a1b4d6b49f25496ad8d7ca7e Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Tue, 19 Jul 2011 18:00:56 -0400 Subject: [PATCH] added
wrappers to code blocks because rdiscount stupidly wraps
tags with paragraphs. Grr. --- plugins/code_block.rb | 10 +++++----- plugins/include_code.rb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 00762d8..d204e1b 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -45,10 +45,10 @@ module Jekyll @highlight = true if markup =~ CaptionUrlTitle @file = $1 - @caption = "
#{$1}#{$4}" + @caption = "
#{$1}#{$4}
" elsif markup =~ CaptionUrl @file = $1 - @caption = "
#{$1}link" + @caption = "
#{$1}link
" elsif markup =~ Caption @file = $1 @caption = "
#{$1}
\n" @@ -62,12 +62,12 @@ module Jekyll def render(context) output = super code = super.join - source = "
\n" + source = "
" source += @caption if @caption if @filetype - source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}\n
" + source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}
" else - source += "
" + code.gsub!(/
\n" + source += "
" + code.gsub!(/
" end partial = Liquid::Template.parse(source) context.stack do diff --git a/plugins/include_code.rb b/plugins/include_code.rb index b063f14..72a74ac 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -40,8 +40,8 @@ module Jekyll code = file.read file_type = file.extname url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}" - source = "
#{file.basename} download
\n" - source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}
" + source = "
#{file.basename} download
\n" + source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}
" partial = Liquid::Template.parse(source) context.stack do partial.render(context)