markup-email 1.0.3 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/markup-email +5 -3
- data/lib/markup_email.rb +3 -1
- data/lib/markup_email/styling.rb +140 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8aa9c651794bce75c3d7316f2217da028ad5d8b
|
4
|
+
data.tar.gz: 1782406c9b6e438f2477cd80de6cfe7f26abf2cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dd216a4cb22f711566c32436c1ef6503a0446b9fde1a1ca684c283664cfa292399db7ba1426c26a37c532eb0b3946b6f74e9e08a951bb737e4b78e6a7245622
|
7
|
+
data.tar.gz: 46c049882fc73b42acd2983a3c27aca3d8b324c37d0d5c013c4ee7da4394042743461798fc558d100e8e9e1f7d49ea6e3df35cff60327466df926b21b019a5cf
|
data/bin/markup-email
CHANGED
@@ -72,15 +72,17 @@ end
|
|
72
72
|
title = ARGV[ARGV.index('-t') + 1] unless ARGV.index('-t').nil?
|
73
73
|
title = ARGV[ARGV.index('--title') + 1] unless ARGV.index('--title').nil?
|
74
74
|
title = String.new if title.nil?
|
75
|
-
puts "\
|
75
|
+
puts "\n\e[0;90;49mFilename and title not set,\na logical filename shall be chosen for you.\nPerhaps see `--help` for information.\e[0m" if title.empty?
|
76
76
|
puts "\nTitle is : #{title}\nFilename is : #{title}.html\n" unless title.empty?
|
77
77
|
|
78
78
|
if sanitize
|
79
79
|
puts "\nMarkup/HTML will be sanitized,\n(`class="..."` attributes and <script> tags will be disalowed)."
|
80
80
|
else
|
81
|
-
puts "\
|
81
|
+
puts "\n\e[0;33;49mMarkup/HTML will NOT be sanitized, this might be dangerous!\nType `--help` fore more information.\e[0m"
|
82
82
|
end
|
83
83
|
puts
|
84
84
|
|
85
85
|
filename = title.empty? ? String.new : "#{title}.html"
|
86
|
-
|
86
|
+
puts "Generating..."
|
87
|
+
htmlFile = MarkupEmail::Convert.new(file, title, sanitize).write filename
|
88
|
+
puts "Done, \"#{htmlFile}\" has been generated.\n "
|
data/lib/markup_email.rb
CHANGED
@@ -6,10 +6,11 @@ module MarkupEmail
|
|
6
6
|
class Convert
|
7
7
|
attr_reader :content
|
8
8
|
|
9
|
-
def initialize file, title, sanitize=false
|
9
|
+
def initialize file, title=String.new, sanitize=false
|
10
10
|
@file = file
|
11
11
|
body = Render.new(@file, sanitize).body
|
12
12
|
metadata = HTMLify.new(body)
|
13
|
+
title = "#{File.basename(file).split('.')[0..-2].join('.')}" if title.empty?
|
13
14
|
metadata.title = title
|
14
15
|
metadata.documentize
|
15
16
|
metadata.meta
|
@@ -22,6 +23,7 @@ module MarkupEmail
|
|
22
23
|
new_file = "#{ext_split[0, ext_split.length - 1][0]}-email.#{ext_split[-1]}.html" if name.empty?
|
23
24
|
|
24
25
|
File.open("#{File.dirname(@file)}/#{new_file}", 'w') { |file| file.write @content }
|
26
|
+
new_file
|
25
27
|
end
|
26
28
|
|
27
29
|
end
|
data/lib/markup_email/styling.rb
CHANGED
@@ -7,7 +7,118 @@ module MarkupEmail
|
|
7
7
|
document.at_css('head') << <<-HTML
|
8
8
|
<style>
|
9
9
|
#{github_css}
|
10
|
-
.c1,.cd,.cm,.cs,.markdown-body .c
|
10
|
+
.c1,.cd,.cm,.cs,.markdown-body .c {
|
11
|
+
color: #6a737d;
|
12
|
+
}
|
13
|
+
|
14
|
+
.markdown-body .no,.markdown-body .s, .nb, .v, .mi {
|
15
|
+
color: #005cc5;
|
16
|
+
}
|
17
|
+
|
18
|
+
.markdown-body .e,.markdown-body .en,.na,.nf,.nx {
|
19
|
+
color: #6f42c1;
|
20
|
+
}
|
21
|
+
|
22
|
+
.markdown-body .gh,.w {
|
23
|
+
color: #24292e;
|
24
|
+
}
|
25
|
+
|
26
|
+
.markdown-body .nt {
|
27
|
+
color: #22863a;
|
28
|
+
}
|
29
|
+
|
30
|
+
.highlight .k,.highlight .kn,.highlight .kp,.highlight .kr,.highlight .kv,.k,.kn,.kr,.markdown-body .o, .nb {
|
31
|
+
color: #d73a49;
|
32
|
+
}
|
33
|
+
.highlight-shell .o {
|
34
|
+
color: inherit;
|
35
|
+
}
|
36
|
+
.highlight-shell .nb {
|
37
|
+
color: #005cc5;
|
38
|
+
}
|
39
|
+
|
40
|
+
.markdown-body .cce,.markdown-body .pds,.markdown-body .s,.markdown-body .s1,.markdown-body .sr,.markdown-body .sra,.markdown-body .sre,.s2 {
|
41
|
+
color: #032f62;
|
42
|
+
}
|
43
|
+
|
44
|
+
.markdown-body .smw,.markdown-body .v {
|
45
|
+
color: #e36209;
|
46
|
+
}
|
47
|
+
|
48
|
+
.markdown-body .bu {
|
49
|
+
color: #b31d28;
|
50
|
+
}
|
51
|
+
|
52
|
+
.markdown-body .ii {
|
53
|
+
color: #fafbfc;
|
54
|
+
background-color: #b31d28;
|
55
|
+
}
|
56
|
+
|
57
|
+
.markdown-body .c2 {
|
58
|
+
color: #fafbfc;
|
59
|
+
background-color: #d73a49;
|
60
|
+
}
|
61
|
+
|
62
|
+
.markdown-body .c2::before {
|
63
|
+
content: "^M";
|
64
|
+
}
|
65
|
+
|
66
|
+
.markdown-body .sr .cce {
|
67
|
+
font-weight: 700;
|
68
|
+
color: #22863a;
|
69
|
+
}
|
70
|
+
|
71
|
+
.markdown-body .ml {
|
72
|
+
color: #735c0f;
|
73
|
+
}
|
74
|
+
|
75
|
+
.markdown-body .en,.markdown-body .mh,.markdown-body .ms {
|
76
|
+
font-weight: 700;
|
77
|
+
color: #005cc5;
|
78
|
+
}
|
79
|
+
|
80
|
+
.markdown-body .mb {
|
81
|
+
font-weight: 700;
|
82
|
+
color: #24292e;
|
83
|
+
}
|
84
|
+
|
85
|
+
.markdown-body .md {
|
86
|
+
color: #b31d28;
|
87
|
+
background-color: #ffeef0;
|
88
|
+
}
|
89
|
+
|
90
|
+
.markdown-body .mi1 {
|
91
|
+
color: #22863a;
|
92
|
+
background-color: #f0fff4;
|
93
|
+
}
|
94
|
+
|
95
|
+
.markdown-body .mc {
|
96
|
+
color: #e36209;
|
97
|
+
background-color: #ffebda;
|
98
|
+
}
|
99
|
+
|
100
|
+
.markdown-body .mi2 {
|
101
|
+
color: #f6f8fa;
|
102
|
+
background-color: #005cc5;
|
103
|
+
}
|
104
|
+
|
105
|
+
.markdown-body .mdr {
|
106
|
+
font-weight: 700;
|
107
|
+
color: #6f42c1;
|
108
|
+
}
|
109
|
+
|
110
|
+
.markdown-body .ba {
|
111
|
+
color: #586069;
|
112
|
+
}
|
113
|
+
|
114
|
+
.markdown-body .sg {
|
115
|
+
color: #959da5;
|
116
|
+
}
|
117
|
+
|
118
|
+
.markdown-body .corl {
|
119
|
+
text-decoration: underline;
|
120
|
+
color: #032f62;
|
121
|
+
}
|
11
122
|
</style>
|
12
123
|
|
13
124
|
<style>
|
@@ -31,9 +142,36 @@ module MarkupEmail
|
|
31
142
|
img {
|
32
143
|
border-radius: 5px;
|
33
144
|
}
|
145
|
+
a {
|
146
|
+
border-bottom: 1px solid rgba(3, 102, 214, 0.3);
|
147
|
+
transition: all .075s ease-in-out;
|
148
|
+
}
|
149
|
+
a:hover {
|
150
|
+
text-decoration: none !important;
|
151
|
+
border-bottom: 1px solid rgb(3, 102, 214);
|
152
|
+
}
|
153
|
+
.selected {
|
154
|
+
border-bottom: 1px solid #1c0ec4 !important;
|
155
|
+
text-decoration: none;
|
156
|
+
color: #1c0ec4 !important;
|
157
|
+
cursor: not-allowed;
|
158
|
+
-webkit-user-select: none;
|
159
|
+
-moz-user-select: none;
|
160
|
+
-ms-user-select: none;
|
161
|
+
user-select: none;
|
162
|
+
}
|
163
|
+
.selected:hover {
|
164
|
+
border-bottom: 1px solid #1c0ec4 !important;
|
165
|
+
color: #1c0ec4 !important;
|
166
|
+
cursor: not-allowed;
|
167
|
+
}
|
168
|
+
.anchor {
|
169
|
+
border: none !important;
|
170
|
+
}
|
34
171
|
</style>
|
35
172
|
HTML
|
36
|
-
document.to_s
|
173
|
+
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
|
174
|
+
3-1.69 3-3.5S14.5 6 13 6z\"></path></svg>")
|
37
175
|
end
|
38
176
|
end
|
39
177
|
end
|