Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue # 5 fix #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '2.6.1'
ruby '2.4.9'

gem 'aws-sdk-s3', '~> 1'
gem 'builder'
Expand Down
13 changes: 11 additions & 2 deletions premailer_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use Rack::Throttle::Minute, cache: Redis.new, key_prefix: :throttle

set :show_exceptions, false
set :show_exceptions, true

@url = ''
AWS_BUCKET = ENV['AWS_BUCKET']
Expand All @@ -39,7 +39,7 @@
end

get '/' do
@initial_doc = 'https://dialect.ca/premailer-tests/base.html'
@initial_doc = 'https://www.graphicxtreme.com/premailer/tests/base.html'

if !params[:bookmarklet].nil?
do_request
Expand Down Expand Up @@ -189,6 +189,15 @@ def process_url(url, opts = {})

s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])

if params[:remove_linebreaks] == 'yes'

out_plaintext = out_plaintext.gsub("\n\n", "\f")
out_plaintext = out_plaintext.gsub("\n", " ")
out_plaintext = out_plaintext.gsub("\f", "\n\n")
end
out_plaintext = out_plaintext.gsub(/%5D|%7D|%5B|%7B/, "%5B" => "[", "%5D" => "]", "%7B" => "{", "%7D" => "}")
out_html = out_html.gsub(/%5D|%7D|%5B|%7B/, "%5B" => "[", "%5D" => "]", "%7B" => "{", "%7D" => "}")
# out_html = out_html.gsub("%7D","}")
text_obj = s3.bucket(AWS_BUCKET).object("#{outfile}.txt")
text_obj.put(body: out_plaintext, content_type: 'text/plain', acl: 'authenticated-read', expires: Time.now + 7200)

Expand Down
4 changes: 2 additions & 2 deletions views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

<p>If you&rsquo;re using Firefox 3+, you can use a bookmarklet as a shortcut to processing pages.</p>

<p>To install, drag this link up to your toolbar: <a style="background: #eee none; padding: 2px 4px; border: 1px solid #ccc;" title="Make CSS inline with Premailer" href="javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://premailer.dialect.ca/inc/bookmarklet-1.0.js';})();">Premailer</a></p>
<p>To install, drag this link up to your toolbar: <a style="background: #eee none; padding: 2px 4px; border: 1px solid #ccc;" title="Make CSS inline with Premailer" href="javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://premailer.dialect.ca/inc/bookmarklet-1.0.js';})();">Premailer</a></p>

<h2><span>Premailer API</span></h2>

Expand All @@ -117,7 +117,7 @@

<h2><span>Under the hood</span></h2>

<p>Premailer is written in Ruby, with a lot of help from Nokogiri, Hpricot and the <a href="http://www.sinatrarb.com/">Sinatra</a> framework (goodbye eruby). The source is available on <a href="http://github.com/alexdunae/premailer/">GitHub</a>.</p>
<p>Premailer is written in Ruby, with a lot of help from Nokogiri, Hpricot and the <a href="https://www.sinatrarb.com/">Sinatra</a> framework (goodbye eruby). The source is available on <a href="https://github.com/alexdunae/premailer/">GitHub</a>.</p>

<p>Written by Alex Dunae at Dialect. Copyright 2007-.</p>
</div>
4 changes: 2 additions & 2 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->

<link href="http://fast.fonts.com/cssapi/b52d9922-6932-42b2-9d6f-48e3653a54af.css?1" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="http://dialect.ca/inc/screen.css">
<link href="https://fast.fonts.com/cssapi/b52d9922-6932-42b2-9d6f-48e3653a54af.css?1" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="https://dialect.ca/inc/screen.css">
<script type="text/javascript"> document.documentElement.className = 'js'; </script>
<script type="text/javascript" src="http://dialect.ca/inc/lib.min.js"></script>
<!--[if lt IE 8]> <link rel="stylesheet" type="text/css" href="http://dialect.ca/inc/ie.css"> <![endif]-->
Expand Down
4 changes: 2 additions & 2 deletions views/results.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<% if @results[:options][:adapter] == :nokogiri %><li>using the Nokogiri parser.</li><% end %>
</ul>

<div class="thanks meta"><a href="http://www.campaignmonitor.com/testing/">Time for some testing?<br>Campaign Monitor offers a thorough<br>e-mail client testing service</a>.</div>
<div class="thanks meta"><a href="https://www.campaignmonitor.com/testing/">Time for some testing?<br>Campaign Monitor offers a thorough<br>e-mail client testing service</a>.</div>


<h2><span><a href="<%= @results[:output][:html_file] %>" title="Contents of <%= @url %> with inline CSS">Click to View the HTML results</a></span></h2>
Expand All @@ -41,7 +41,7 @@

<% if @results[:warnings].length > 0 %>

<p>Warnings are generated from several sources, including the <a href="http://www.email-standards.org/">Email Standards Project&rsquo;s guides</a>.</p>
<p>Warnings are generated from several sources, including the <a href="https://www.email-standards.org/">Email Standards Project&rsquo;s guides</a>.</p>



Expand Down