added <div> wrappers to code blocks because rdiscount stupidly wraps <figure> tags with paragraphs. Grr.
This commit is contained in:
parent
cc1cfa56b2
commit
6f646e7290
@ -45,10 +45,10 @@ module Jekyll
|
|||||||
@highlight = true
|
@highlight = true
|
||||||
if markup =~ CaptionUrlTitle
|
if markup =~ CaptionUrlTitle
|
||||||
@file = $1
|
@file = $1
|
||||||
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a</figcaption>"
|
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
|
||||||
elsif markup =~ CaptionUrl
|
elsif markup =~ CaptionUrl
|
||||||
@file = $1
|
@file = $1
|
||||||
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a</figcaption>"
|
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a></figcaption>"
|
||||||
elsif markup =~ Caption
|
elsif markup =~ Caption
|
||||||
@file = $1
|
@file = $1
|
||||||
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
|
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
|
||||||
@ -62,12 +62,12 @@ module Jekyll
|
|||||||
def render(context)
|
def render(context)
|
||||||
output = super
|
output = super
|
||||||
code = super.join
|
code = super.join
|
||||||
source = "<figure role=code>\n"
|
source = "<div><figure role=code>"
|
||||||
source += @caption if @caption
|
source += @caption if @caption
|
||||||
if @filetype
|
if @filetype
|
||||||
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}\n</figure>"
|
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
|
||||||
else
|
else
|
||||||
source += "<pre><code>" + code.gsub!(/</,'<') + "</code></pre>\n</figure>"
|
source += "<pre><code>" + code.gsub!(/</,'<') + "</code></pre></figure></div>"
|
||||||
end
|
end
|
||||||
partial = Liquid::Template.parse(source)
|
partial = Liquid::Template.parse(source)
|
||||||
context.stack do
|
context.stack do
|
||||||
|
@ -40,8 +40,8 @@ module Jekyll
|
|||||||
code = file.read
|
code = file.read
|
||||||
file_type = file.extname
|
file_type = file.extname
|
||||||
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
|
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
|
||||||
source = "<figure role=code><figcaption><span>#{file.basename}</span> <a href='#{url}'>download</a></figcaption>\n"
|
source = "<div><figure role=code><figcaption><span>#{file.basename}</span> <a href='#{url}'>download</a></figcaption>\n"
|
||||||
source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}</figure>"
|
source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}</figure></div>"
|
||||||
partial = Liquid::Template.parse(source)
|
partial = Liquid::Template.parse(source)
|
||||||
context.stack do
|
context.stack do
|
||||||
partial.render(context)
|
partial.render(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user