Permalink
Browse files

Merge pull request #103 from kgrz/1.4.x

This is not a final PR
  • Loading branch information...
2 parents e4c31bd + 7d7770b commit 71d7122008ea7c54ccfeebd9ce148b4d87ac5de4 @rkh rkh committed Mar 15, 2013
Showing with 14,506 additions and 9,322 deletions.
  1. +9 −14 Rakefile
  2. +0 −508 _includes/CHANGES.txt
  3. +1,726 −926 _includes/README.de.html
  4. +1,662 −855 _includes/README.es.html
  5. +1,823 −1,039 _includes/README.fr.html
  6. +1,771 −933 _includes/README.html
  7. +508 −268 _includes/README.hu.html
  8. +416 −206 _includes/README.jp.html
  9. +1,701 −885 _includes/README.ko.html
  10. +824 −420 _includes/README.pt-br.html
  11. +673 −327 _includes/README.pt-pt.html
  12. +1,707 −918 _includes/README.ru.html
  13. +1,686 −847 _includes/README.zh.html
  14. +0 −1,176 _includes/book.html
View
@@ -3,15 +3,9 @@ require 'rake/clean'
require 'rdoc/encoding'
require 'rdoc/markup/to_html'
require 'redcarpet'
-require 'rouge'
-require 'rouge/plugins/redcarpet'
require 'uri'
require 'nokogiri'
-
-
-class HTML < Redcarpet::Render::HTML
- include Rouge::Plugins::Redcarpet # yep, that's it.
-end
+require 'kramdown'
def cleanup(html)
@@ -72,7 +66,7 @@ end
task :default => ['_sinatra', '_contrib', :build]
desc "Build outdated static files and API docs"
-task :build => ['build:static']
+task :build => [:pull, 'build:static']
desc "Build outdated static files"
task 'build:static' => readme("_includes/%s.html") + contrib("_includes/%s.html")
@@ -109,16 +103,17 @@ task 'pull:contrib' => "_contrib" do
sh "cd _contrib && git pull &>/dev/null"
end
-readme("_sinatra/%s") { |fn| file fn => '_sinatra' }
+readme("_sinatra/%s.md") { |fn| file fn => '_sinatra' }
file 'AUTHORS' => '_sinatra'
-
readme do |fn|
- file "_includes/#{fn}.html" => ["_sinatra/#{fn}", "Rakefile"] do |f|
- rndr = HTML.new(:safe_links_only => true)
- markdown = Redcarpet::Markdown.new(rndr, :lax_spacing => true, :fenced_code_blocks => true)
+ file "_includes/#{fn}.html" => ["_sinatra/#{fn}.md", "Rakefile"] do |f|
markdown_string = File.read("_sinatra/#{fn}.md").encode('UTF-16le', :invalid => :replace, :replace => "").encode("UTF-8")
- html = cleanup(markdown.render(markdown_string))
+ markdown_string.gsub!(/```(\s?(\w+\n))?/) do |match|
+ match =~ /```\s?\n/ ? "~~~~~\n" : match.sub(/```\s?/, "~~~~")
+ end
+ markdown = Kramdown::Document.new(markdown_string, :fenced_code_blocks => true, :coderay_line_numbers => nil, :auto_ids => false)
+ html = cleanup(markdown.to_html)
File.open(f.name, 'w') { |io| io.write with_toc(html) }
end
end
Oops, something went wrong.

0 comments on commit 71d7122

Please sign in to comment.