Merge branch '2.1' into site

This commit is contained in:
Brandon Mathis 2012-05-24 15:42:40 -05:00
commit 409897f209
4 changed files with 8 additions and 14 deletions

View File

@ -292,6 +292,7 @@ multitask :push do
puts "\n## copying #{public_dir} to #{deploy_dir}"
cp_r "#{public_dir}/.", deploy_dir
cd "#{deploy_dir}" do
system "touch .nojekyll"
system "git add ."
system "git add -u"
message = "Site updated at #{Time.now.utc}"

View File

@ -75,7 +75,7 @@ module Jekyll
end
def paragraphize(input)
"<p>#{input.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>"
"<p>#{input.lstrip.rstrip.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>"
end
end
end

View File

@ -16,19 +16,16 @@ module HighlightCode
end
def pygments(code, lang)
if defined?(PYGMENTS_CACHE_DIR)
path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest(code)}.html")
path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest(code)}.html") if defined?(PYGMENTS_CACHE_DIR)
if File.exist?(path)
highlighted_code = File.read(path)
else
highlighted_code = render(code, lang)
File.open(path, 'w') {|f| f.print(highlighted_code) }
end
else
highlighted_code = render(code, lang)
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
File.open(path, 'w') {|f| f.print(highlighted_code) } if path
end
highlighted_code
end
def tableize_code (str, lang = '')
table = '<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers">'
code = ''
@ -38,8 +35,4 @@ module HighlightCode
end
table += "</pre></td><td class='code'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>"
end
def render(code, lang)
Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
end
end