require 'albino' require 'nokogiri' before 'index.html.haml' do @readme = Nokogiri::HTML(render('../README.md')).css('body') # Remove everything before the first
tags before the previous element (because its floated right) unless pre.previous_element.name == 'h2' pre.previous_element.add_previous_sibling(pre) end # Insertbefore eachtag pre.add_previous_sibling('') # Pygmentize pygmented = Albino.colorize(pre.css('code').text, language) # Highlight highlight.each do |str| pygmented = pygmented.gsub(str, '' + str + '') end # Replacepre.replace pygmented end # Insertbefore eachtag @readme.css('h3').each do |h3| h3.add_previous_sibling('') end # Replace colons at the end of
tags with arrows. @readme.css('p').each do |p| p.inner_html = p.inner_html.strip.gsub(/:$/, '') end @readme = @readme.inner_html end