maildown 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/lib/maildown/ext/action_mailer.rb +2 -0
- data/lib/maildown/markdown_engine.rb +30 -5
- data/lib/maildown/md.rb +1 -1
- data/lib/maildown/version.rb +1 -1
- data/test/unit/markdown_engine_test.rb +11 -0
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 793a913246a2706d4336913e23b351e8c255c3f3
|
4
|
+
data.tar.gz: 0d5295b0a21a1e5d918af96c2ff3d0ed48ad5c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c8aaeaeaa264b09bea442e80e80e5652c6f3b3eaeb22051841b17da1508ded3b020b2980c9dd059597e66f8a684e55f9d331b338d6ff4cd69d6903e9500d09
|
7
|
+
data.tar.gz: 0bf4c6835f2e1b74f029eea5214e9ab00cc58d6dddc55b46ed51a8599d777ebe20916ca00c3d5b4f4c1f1557e63b6ea572b8982ec02c3eef466bebdfaaeceadc
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
10
|
rdoc.rdoc_dir = 'rdoc'
|
11
11
|
rdoc.title = 'Maildown'
|
12
12
|
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
@@ -32,5 +32,4 @@ end
|
|
32
32
|
|
33
33
|
task default: :test
|
34
34
|
|
35
|
-
|
36
35
|
require "bundler/gem_tasks"
|
@@ -1,21 +1,46 @@
|
|
1
1
|
module Maildown
|
2
2
|
module MarkdownEngine
|
3
3
|
def self.to_html(string)
|
4
|
-
|
4
|
+
html_block.call(string)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.to_text(string)
|
8
|
+
text_block.call(string)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.set_html(&block)
|
12
|
+
@maildown_markdown_engine_html_block = block
|
5
13
|
end
|
6
14
|
|
7
15
|
def self.set(&block)
|
8
|
-
|
16
|
+
set_html(&block)
|
17
|
+
end
|
18
|
+
|
19
|
+
class << self
|
20
|
+
extend Gem::Deprecate
|
21
|
+
deprecate :set, :set_html, 2017, 6
|
9
22
|
end
|
10
23
|
|
11
|
-
def self.block
|
12
|
-
|
24
|
+
def self.set_text(&block)
|
25
|
+
@maildown_markdown_engine_text_block = block
|
13
26
|
end
|
14
27
|
|
15
|
-
def self.
|
28
|
+
def self.html_block
|
29
|
+
@maildown_markdown_engine_html_block || default_html_block
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.text_block
|
33
|
+
@maildown_markdown_engine_text_block || default_text_block
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.default_html_block
|
16
37
|
require 'kramdown' unless defined? Kramdown
|
17
38
|
|
18
39
|
->(string) { Kramdown::Document.new(string).to_html }
|
19
40
|
end
|
41
|
+
|
42
|
+
def self.default_text_block
|
43
|
+
->(string) { string }
|
44
|
+
end
|
20
45
|
end
|
21
46
|
end
|
data/lib/maildown/md.rb
CHANGED
data/lib/maildown/version.rb
CHANGED
@@ -23,4 +23,15 @@ class MarkdownEngineTest < ActiveSupport::TestCase
|
|
23
23
|
end
|
24
24
|
thread.join
|
25
25
|
end
|
26
|
+
|
27
|
+
test "custom engine works in multiple threads" do
|
28
|
+
Maildown::MarkdownEngine.set do |text|
|
29
|
+
"foo: #{text}"
|
30
|
+
end
|
31
|
+
|
32
|
+
thread = Thread.new do
|
33
|
+
assert_equal "foo: bar", Maildown::MarkdownEngine.to_html("bar")
|
34
|
+
end
|
35
|
+
thread.join
|
36
|
+
end
|
26
37
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maildown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actionmailer
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: railties
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sqlite3
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Best practice is to send text/plain && text/html markdown works great
|
56
84
|
for both, so why write your templates twices?
|
57
85
|
email:
|
@@ -125,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
153
|
version: '0'
|
126
154
|
requirements: []
|
127
155
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.5.
|
156
|
+
rubygems_version: 2.5.2
|
129
157
|
signing_key:
|
130
158
|
specification_version: 4
|
131
159
|
summary: Markdown in your mailbox
|