markup-email 1.1.4 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -2
- data/bin/markup-email +0 -0
- data/lib/markup_email/convert.rb +5 -3
- data/lib/markup_email/styling.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6e22e8296de7ddd7242789e78bd8a25eb16dc6e
|
4
|
+
data.tar.gz: '08cbb413bc026b07aed7f4038dc817d0ddf1dffe'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23578201d5c153d195ecd9920fd89e959f3110f8e2d9895aa913f8065c9078377ff0e4065c66f232d3ae3ea334660581fb200ba01d123df5f70c03a6316c56ff
|
7
|
+
data.tar.gz: 705649ffe717846d52e2ca792cf54ee419271dd16c63d9070819c5925792dc6b9fb19cf2fe62701b25c0d81e9b1ce42d5ab9ac458f0fce596898395d36ecb7eb
|
data/README.md
CHANGED
@@ -53,12 +53,28 @@ Markup/HTML will be sanitized,
|
|
53
53
|
### E-mail it
|
54
54
|
Then open `examples/veryExampleWow.html` in your browser and see for yourself, then you can open it in a text-editor, view the source and copy it in to your e-mail editor as `HTML` source.
|
55
55
|
|
56
|
+
## Add custom styling
|
57
|
+
Create a file named either: `.markup-email.css`, `.email.css`, `.markup.css` or `.markdown.css`.
|
58
|
+
|
59
|
+
Add your custom css for your email in wither one of these files.
|
60
|
+
|
61
|
+
e.g.
|
62
|
+
```css
|
63
|
+
body { width: 600px; }/* As opposed to 980px */
|
64
|
+
|
65
|
+
article {
|
66
|
+
border-radius: 0; /* 5px */
|
67
|
+
box-shadow: none; /* 0 10px 50px rgba(0, 0, 0, 0.2) */
|
68
|
+
padding: 20px; /* 45px */
|
69
|
+
}
|
70
|
+
```
|
71
|
+
|
56
72
|
## In Ruby
|
57
73
|
*Can* also be used in Ruby
|
58
74
|
```ruby
|
59
75
|
require 'markup_email'
|
60
76
|
|
61
|
-
file = ... #
|
77
|
+
file = ... # Markup file
|
62
78
|
title = ... # Title of the page
|
63
79
|
|
64
80
|
markup = MarkupEmail::Convert.new(file, title, sanitize)
|
@@ -69,4 +85,4 @@ markup.write "#{file.split('.')[0..-2].join('.')}-converted.html" # Makes a new
|
|
69
85
|
# then the new file from `markup.write()` would be called
|
70
86
|
# "hello.there-converted.html"
|
71
87
|
```
|
72
|
-
If this is not sufficient, perhaps see the [rubydoc.info](http://www.rubydoc.info/gems/markup-email/1.
|
88
|
+
If this is not sufficient, perhaps see the [rubydoc.info](http://www.rubydoc.info/gems/markup-email/1.2.4/) for autogenerated documentation.
|
data/bin/markup-email
CHANGED
File without changes
|
data/lib/markup_email/convert.rb
CHANGED
@@ -48,7 +48,9 @@ module MarkupEmail
|
|
48
48
|
puts "`#{package}` not installed for you chosen markup!\nSee `--help` for more information on installing the package."
|
49
49
|
exit 1
|
50
50
|
else
|
51
|
-
|
51
|
+
puts "`#{package}` installed!"
|
52
|
+
ensure
|
53
|
+
nil
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -70,7 +72,7 @@ module MarkupEmail
|
|
70
72
|
return true
|
71
73
|
end
|
72
74
|
if File.extname(@file) == '.creole'
|
73
|
-
require_test '
|
75
|
+
require_test 'creole'
|
74
76
|
return true
|
75
77
|
end
|
76
78
|
if %w(.mediawiki .wiki).include? File.extname(@file)
|
@@ -81,7 +83,7 @@ module MarkupEmail
|
|
81
83
|
begin
|
82
84
|
%x(python3 --version)
|
83
85
|
rescue
|
84
|
-
puts "python3 (Python version 3) not installed, please install python3
|
86
|
+
puts "python3 (Python version 3) not installed, please install `python3`!"
|
85
87
|
exit 1
|
86
88
|
end
|
87
89
|
unless %x(python3 -c "import sphinx" 2>&1).empty?
|
data/lib/markup_email/styling.rb
CHANGED
@@ -3,6 +3,15 @@ module MarkupEmail
|
|
3
3
|
def self.github_md content
|
4
4
|
document = Nokogiri::HTML(content)
|
5
5
|
|
6
|
+
custom_css = String.new
|
7
|
+
css_files = %w{ .markup-email.css .email.css .markup.css .markdown.css }
|
8
|
+
css_files.each do |css_file|
|
9
|
+
if File.file? "#{File.expand_path '~'}/#{css_file}"
|
10
|
+
custom_css = File.read "#{File.expand_path '~' }/#{css_file}"
|
11
|
+
break
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
6
15
|
github_css = Net::HTTP.get(URI.parse("https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css"))
|
7
16
|
document.at_css('head') << <<-HTML
|
8
17
|
<link rel="shortcut icon" href="https://user-images.githubusercontent.com/26842759/28286954-7d4e4b02-6b29-11e7-97d6-ca223344f755.png">
|
@@ -173,6 +182,12 @@ module MarkupEmail
|
|
173
182
|
border: none !important;
|
174
183
|
}
|
175
184
|
</style>
|
185
|
+
|
186
|
+
<!-- User custom style overide -->
|
187
|
+
<style>
|
188
|
+
#{custom_css}
|
189
|
+
</style>
|
190
|
+
|
176
191
|
HTML
|
177
192
|
document.to_s.gsub("<span aria-hidden=\"true\" class=\"octicon octicon-link\"></span>", "<svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0
|
178
193
|
3-1.69 3-3.5S14.5 6 13 6z\"></path></svg>")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markup-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Demonstrandum
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.6.
|
227
|
+
rubygems_version: 2.6.12
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: E-mails from Markup
|