Permalink
Browse files

Added config.ru

  • Loading branch information...
1 parent 326912d commit a98220b91b30cfc68f8cd1b1ef0cab65f5a771f5 @tomtaylor tomtaylor committed Jun 10, 2011
Showing with 8 additions and 19 deletions.
  1. +0 −5 Gemfile
  2. +3 −11 Gemfile.lock
  3. +2 −0 config.ru
  4. +3 −3 telepaper.rb
View
@@ -4,10 +4,5 @@ gem 'json'
gem 'oauth'
gem 'oauth2', :git => 'https://github.com/intridea/oauth2.git'
gem 'haml'
-#gem 'nokogiri'
-#gem 'mcbean'
-gem 'sanitize'
-gem 'pandoc-ruby'
-gem 'rdiscount'
gem 'i18n'
gem 'activesupport', :require => ['active_support/core_ext/array', 'active_support/core_ext/integer']
View
@@ -11,22 +11,17 @@ GEM
specs:
activesupport (3.0.8)
addressable (2.2.6)
- faraday (0.7.0)
- addressable (~> 2.2.4)
+ faraday (0.7.1)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
- rack (< 2, >= 1.1.0)
+ rack (>= 1.1.0, < 2)
haml (3.1.2)
i18n (0.6.0)
json (1.5.1)
multi_json (1.0.3)
multipart-post (1.1.2)
- nokogiri (1.4.4)
oauth (0.4.4)
- pandoc-ruby (0.4.1)
rack (1.3.0)
- rdiscount (1.6.8)
- sanitize (2.0.2)
- nokogiri (~> 1.4.4)
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
@@ -42,7 +37,4 @@ DEPENDENCIES
json
oauth
oauth2!
- pandoc-ruby
- rdiscount
- sanitize
sinatra
View
@@ -0,0 +1,2 @@
+require 'telepaper'
+run Sinatra::Application
View
@@ -86,9 +86,9 @@
# then convert the HTML to markdown using PanDoc.
@articles = params[:articles].map do |article_id|
JSON.parse(@readability_access_token.get("/api/rest/v1/articles/#{article_id}").body).tap do |article|
- article['html_content'] = article['content'].gsub(/\s+/, ' ')
- article['html_content'] = Sanitize.clean(article['html_content'], Sanitize::Config::RELAXED)
- article['markdown_content'] = PandocRuby.convert(article['html_content'], {:f => :html, :to => :markdown}, 'no-wrap', 'strict')
+ markdown_reply = @newspaperclub_access_token.post('/v1/utils/html_to_markdown', :body => { :html => article['content'] }.to_json, :headers => { 'Content-Type' => 'application/json'})
+ puts markdown_reply.inspect
+ article['markdown_content'] = markdown_reply.parsed['markdown']
end
end

0 comments on commit a98220b

Please sign in to comment.