mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2025-02-28 08:21:52 -05:00
Merge branch '2.1' into site
This commit is contained in:
commit
409897f209
1
Rakefile
1
Rakefile
@ -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}"
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
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
|
||||
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)
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user