marky 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +62 -62
- data/README.md +59 -54
- data/SUBMISSION_GUIDELINES +13 -13
- data/lib/adapters/bluecloth.rb +14 -14
- data/lib/adapters/kramdown.rb +16 -0
- data/lib/adapters/maruku.rb +15 -15
- data/lib/adapters/rdiscount.rb +16 -16
- data/lib/marky.rb +30 -30
- data/marky.gemspec +14 -14
- data/test/marky_test.rb +42 -37
- metadata +4 -6
data/README
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
-- RMU SESSION 2 | PROBLEM 2
|
2
|
-
|
3
|
-
If in doubt about how to submit, see SUBMISSION_GUIDELINES file.
|
4
|
-
|
5
|
-
For this exercise, we'll be working with design patterns originally
|
6
|
-
described in the much-acclaimed "Gang of Four" book. While this book is over 15
|
7
|
-
years old, many of the ideas within it are still relevant to modern object
|
8
|
-
oriented design. The tricky thing is that sometimes they are mis-applied, and
|
9
|
-
often they are described with rather anemic examples that don't quite show their
|
10
|
-
true power.
|
11
|
-
|
12
|
-
Our goal will be to come up with some good Ruby examples that demonstrate how a
|
13
|
-
given pattern can be applied in real code, while sticking to Ruby idioms. Follow
|
14
|
-
the guidelines below to complete the exercise.
|
15
|
-
|
16
|
-
== GUIDELINES
|
17
|
-
|
18
|
-
1. Spend some time reviewing some of the classic patterns, reading at least a
|
19
|
-
few of them before deciding to focus on any one of them. There is a decent
|
20
|
-
resource at: http://sourcemaking.com/design_patterns and tons of information on
|
21
|
-
Wikipedia as well. You can use any of the patterns that are listed at that URL,
|
22
|
-
except for Command pattern, since we covered that in the entrance exam.
|
23
|
-
|
24
|
-
2. When you find a pattern that sounds interesting to you, try to think of a
|
25
|
-
scenario in which you could apply it in real code. If you can come up with one,
|
26
|
-
announce that you'll be working on this pattern on the mailing list, along with
|
27
|
-
the scenario you plan to explore.
|
28
|
-
|
29
|
-
3. Write up some example code that demonstrates the pattern in action. You do
|
30
|
-
not need to build a complete application, but the example you show should have
|
31
|
-
enough context to look and feel 'real', rather than being some contrived foo/bar
|
32
|
-
example. Download the PDF of my book (http://rubybestpractices.com) if you want
|
33
|
-
some examples of how to present ideas using real or realistic code.
|
34
|
-
|
35
|
-
4. Even if you're not building a complete application, stub out enough things to
|
36
|
-
create a runnable simulation that demonstrates how your code would be used.
|
37
|
-
Bonus points of course would be given to those who build a real app that uses
|
38
|
-
the pattern in action.
|
39
|
-
|
40
|
-
5. Feel free to help each other as much as needed to come up with the best
|
41
|
-
possible examples. You are encouraged to review each other's work and offer
|
42
|
-
suggestions.
|
43
|
-
|
44
|
-
== RESTRICTIONS:
|
45
|
-
|
46
|
-
* I don't want more than three students to cover the same problem, so be sure to keep
|
47
|
-
an eye on who's working on what
|
48
|
-
|
49
|
-
* Not every pattern that exists is relevant to Ruby. Try your best to
|
50
|
-
choose one that is, and if you're not reasonably sure, ask your fellow
|
51
|
-
students and/or me to comment on your choice.
|
52
|
-
|
53
|
-
* Do not submit a Command pattern demonstration.
|
54
|
-
|
55
|
-
* Do not intentionally copy a scenario you've found online. It's not a problem
|
56
|
-
if the example you pick happens to have been covered somewhere online before,
|
57
|
-
but you should not just port some example from another language into Ruby, try
|
58
|
-
to come up with your own use case.
|
59
|
-
|
60
|
-
== QUESTIONS?
|
61
|
-
|
62
|
-
Hit up the mailing list or IRC.
|
1
|
+
-- RMU SESSION 2 | PROBLEM 2
|
2
|
+
|
3
|
+
If in doubt about how to submit, see SUBMISSION_GUIDELINES file.
|
4
|
+
|
5
|
+
For this exercise, we'll be working with design patterns originally
|
6
|
+
described in the much-acclaimed "Gang of Four" book. While this book is over 15
|
7
|
+
years old, many of the ideas within it are still relevant to modern object
|
8
|
+
oriented design. The tricky thing is that sometimes they are mis-applied, and
|
9
|
+
often they are described with rather anemic examples that don't quite show their
|
10
|
+
true power.
|
11
|
+
|
12
|
+
Our goal will be to come up with some good Ruby examples that demonstrate how a
|
13
|
+
given pattern can be applied in real code, while sticking to Ruby idioms. Follow
|
14
|
+
the guidelines below to complete the exercise.
|
15
|
+
|
16
|
+
== GUIDELINES
|
17
|
+
|
18
|
+
1. Spend some time reviewing some of the classic patterns, reading at least a
|
19
|
+
few of them before deciding to focus on any one of them. There is a decent
|
20
|
+
resource at: http://sourcemaking.com/design_patterns and tons of information on
|
21
|
+
Wikipedia as well. You can use any of the patterns that are listed at that URL,
|
22
|
+
except for Command pattern, since we covered that in the entrance exam.
|
23
|
+
|
24
|
+
2. When you find a pattern that sounds interesting to you, try to think of a
|
25
|
+
scenario in which you could apply it in real code. If you can come up with one,
|
26
|
+
announce that you'll be working on this pattern on the mailing list, along with
|
27
|
+
the scenario you plan to explore.
|
28
|
+
|
29
|
+
3. Write up some example code that demonstrates the pattern in action. You do
|
30
|
+
not need to build a complete application, but the example you show should have
|
31
|
+
enough context to look and feel 'real', rather than being some contrived foo/bar
|
32
|
+
example. Download the PDF of my book (http://rubybestpractices.com) if you want
|
33
|
+
some examples of how to present ideas using real or realistic code.
|
34
|
+
|
35
|
+
4. Even if you're not building a complete application, stub out enough things to
|
36
|
+
create a runnable simulation that demonstrates how your code would be used.
|
37
|
+
Bonus points of course would be given to those who build a real app that uses
|
38
|
+
the pattern in action.
|
39
|
+
|
40
|
+
5. Feel free to help each other as much as needed to come up with the best
|
41
|
+
possible examples. You are encouraged to review each other's work and offer
|
42
|
+
suggestions.
|
43
|
+
|
44
|
+
== RESTRICTIONS:
|
45
|
+
|
46
|
+
* I don't want more than three students to cover the same problem, so be sure to keep
|
47
|
+
an eye on who's working on what
|
48
|
+
|
49
|
+
* Not every pattern that exists is relevant to Ruby. Try your best to
|
50
|
+
choose one that is, and if you're not reasonably sure, ask your fellow
|
51
|
+
students and/or me to comment on your choice.
|
52
|
+
|
53
|
+
* Do not submit a Command pattern demonstration.
|
54
|
+
|
55
|
+
* Do not intentionally copy a scenario you've found online. It's not a problem
|
56
|
+
if the example you pick happens to have been covered somewhere online before,
|
57
|
+
but you should not just port some example from another language into Ruby, try
|
58
|
+
to come up with your own use case.
|
59
|
+
|
60
|
+
== QUESTIONS?
|
61
|
+
|
62
|
+
Hit up the mailing list or IRC.
|
data/README.md
CHANGED
@@ -1,54 +1,59 @@
|
|
1
|
-
Marky
|
2
|
-
=====
|
3
|
-
|
4
|
-
Marky is simple wrapper for converting strings/text to html using different markdown processors. It's the solution to assingment #2 of
|
5
|
-
|
6
|
-
Installation
|
7
|
-
============
|
8
|
-
[sudo] gem install marky
|
9
|
-
|
10
|
-
By default, installing Marky will install also RDiscount, Maruku and BlueCloth if necessary.
|
11
|
-
|
12
|
-
Usage
|
13
|
-
=====
|
14
|
-
|
15
|
-
require 'marky'
|
16
|
-
Marky.adapter = :maruku
|
17
|
-
Marky.to_html("Hello, Marky")
|
18
|
-
=> "<p>Hello, Marky</p>"
|
19
|
-
|
20
|
-
Adapters
|
21
|
-
========
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
THE
|
1
|
+
Marky
|
2
|
+
=====
|
3
|
+
|
4
|
+
Marky is simple wrapper for converting strings/text to html using different markdown processors. It's the solution to assingment #2 of octobers Ruby Mendicant University. Based on intirdea's multi_json gem.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
============
|
8
|
+
[sudo] gem install marky
|
9
|
+
|
10
|
+
By default, installing Marky will install also RDiscount, Maruku and BlueCloth if necessary.
|
11
|
+
|
12
|
+
Usage
|
13
|
+
=====
|
14
|
+
|
15
|
+
require 'marky'
|
16
|
+
Marky.adapter = :maruku
|
17
|
+
Marky.to_html("Hello, Marky")
|
18
|
+
=> "<p>Hello, Marky</p>"
|
19
|
+
|
20
|
+
Adapters
|
21
|
+
========
|
22
|
+
|
23
|
+
* [RDiscount](https://github.com/rtomayko/rdiscount)
|
24
|
+
* [BlueCloth](http://deveiate.org/projects/BlueCloth)
|
25
|
+
* [Maruku](https://github.com/nex3/maruku)
|
26
|
+
* [Kramdown](https://github.com/gettalong/kramdown)
|
27
|
+
|
28
|
+
If you want to add another, just create a module into adapters dirrectory who implements to_html method.
|
29
|
+
|
30
|
+
Meta
|
31
|
+
====
|
32
|
+
|
33
|
+
* Author : Mitko Kostov
|
34
|
+
* Email : mitko.kostov@gmail.com
|
35
|
+
* Website : [http://mitkokostov.info](http://mitkokostov.info)
|
36
|
+
* Twitter : [http://twitter.com/mytrile](http://twitter.com/mytrile)
|
37
|
+
|
38
|
+
License
|
39
|
+
=======
|
40
|
+
|
41
|
+
Copyright (c) 2010 Mitko Kostov
|
42
|
+
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
44
|
+
of this software and associated documentation files (the "Software"), to deal
|
45
|
+
in the Software without restriction, including without limitation the rights
|
46
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
47
|
+
copies of the Software, and to permit persons to whom the Software is
|
48
|
+
furnished to do so, subject to the following conditions:
|
49
|
+
|
50
|
+
The above copyright notice and this permission notice shall be included in
|
51
|
+
all copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
54
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
55
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
56
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
57
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
58
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
59
|
+
THE SOFTWARE.
|
data/SUBMISSION_GUIDELINES
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
Fork this repository and hack away! When you are ready for a review, log into
|
2
|
-
the RMU web app and request a review for the appropriate exercise(*).
|
3
|
-
|
4
|
-
Do not share your solution or the problem description with anyone else without
|
5
|
-
talking to me about it first. Likewise, your submission won't be shared with
|
6
|
-
anyone else by me unless I talk to you first.
|
7
|
-
|
8
|
-
NOTE: No work done after 10/25 will be evaluated, be sure to request a review
|
9
|
-
before then!
|
10
|
-
|
11
|
-
(*) As of the time of writing this feature is not in place, but will be before
|
12
|
-
10/11. Should you wish to submit a problem for review before then, please just
|
13
|
-
email me.
|
1
|
+
Fork this repository and hack away! When you are ready for a review, log into
|
2
|
+
the RMU web app and request a review for the appropriate exercise(*).
|
3
|
+
|
4
|
+
Do not share your solution or the problem description with anyone else without
|
5
|
+
talking to me about it first. Likewise, your submission won't be shared with
|
6
|
+
anyone else by me unless I talk to you first.
|
7
|
+
|
8
|
+
NOTE: No work done after 10/25 will be evaluated, be sure to request a review
|
9
|
+
before then!
|
10
|
+
|
11
|
+
(*) As of the time of writing this feature is not in place, but will be before
|
12
|
+
10/11. Should you wish to submit a problem for review before then, please just
|
13
|
+
email me.
|
data/lib/adapters/bluecloth.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
begin
|
2
|
-
require 'bluecloth' unless defined?(::BlueCloth)
|
3
|
-
rescue LoadError
|
4
|
-
puts "BlueCloth is not installed. Please, do $ [sudo] gem install bluecloth"
|
5
|
-
end
|
6
|
-
module Marky
|
7
|
-
module Adapters
|
8
|
-
module Bluecloth
|
9
|
-
extend self
|
10
|
-
def to_html(string)
|
11
|
-
::BlueCloth.new(string).to_html
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
begin
|
2
|
+
require 'bluecloth' unless defined?(::BlueCloth)
|
3
|
+
rescue LoadError
|
4
|
+
puts "BlueCloth is not installed. Please, do $ [sudo] gem install bluecloth"
|
5
|
+
end
|
6
|
+
module Marky
|
7
|
+
module Adapters
|
8
|
+
module Bluecloth
|
9
|
+
extend self
|
10
|
+
def to_html(string)
|
11
|
+
::BlueCloth.new(string).to_html
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
begin
|
2
|
+
require 'kramdown' unless defined?(::Kremdown)
|
3
|
+
rescue LoadError
|
4
|
+
puts "Kramdown is not installed. Please, do $ [sudo] gem install kramdown"
|
5
|
+
end
|
6
|
+
|
7
|
+
module Marky
|
8
|
+
module Adapters
|
9
|
+
module Kramdown
|
10
|
+
extend self
|
11
|
+
def to_html(string)
|
12
|
+
::Kramdown::Document.new(string).to_html
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/adapters/maruku.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
begin
|
2
|
-
require 'maruku' unless defined?(::Maruku)
|
3
|
-
rescue LoadError
|
4
|
-
puts "Maruku is not installed. Please, do $ [sudo] gem install bluecloth"
|
5
|
-
end
|
6
|
-
|
7
|
-
module Marky
|
8
|
-
module Adapters
|
9
|
-
module Maruku
|
10
|
-
extend self
|
11
|
-
def to_html(string)
|
12
|
-
::Maruku.new(string).to_html
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
1
|
+
begin
|
2
|
+
require 'maruku' unless defined?(::Maruku)
|
3
|
+
rescue LoadError
|
4
|
+
puts "Maruku is not installed. Please, do $ [sudo] gem install bluecloth"
|
5
|
+
end
|
6
|
+
|
7
|
+
module Marky
|
8
|
+
module Adapters
|
9
|
+
module Maruku
|
10
|
+
extend self
|
11
|
+
def to_html(string)
|
12
|
+
::Maruku.new(string).to_html
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
data/lib/adapters/rdiscount.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
begin
|
2
|
-
require 'rdiscount' unless defined?(::RDiscount)
|
3
|
-
rescue LoadError
|
4
|
-
puts "RDiscount is not installed. Please, do $ [sudo] gem install rdiscount"
|
5
|
-
end
|
6
|
-
|
7
|
-
module Marky
|
8
|
-
module Adapters
|
9
|
-
module Rdiscount
|
10
|
-
extend self
|
11
|
-
def to_html(string)
|
12
|
-
::RDiscount.new(string).to_html
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
1
|
+
begin
|
2
|
+
require 'rdiscount' unless defined?(::RDiscount)
|
3
|
+
rescue LoadError
|
4
|
+
puts "RDiscount is not installed. Please, do $ [sudo] gem install rdiscount"
|
5
|
+
end
|
6
|
+
|
7
|
+
module Marky
|
8
|
+
module Adapters
|
9
|
+
module Rdiscount
|
10
|
+
extend self
|
11
|
+
def to_html(string)
|
12
|
+
::RDiscount.new(string).to_html
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/marky.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'adapters')
|
2
|
-
# Marky is simple wrapper for converting strings/text to html using different markdown processors.
|
3
|
-
module Marky
|
4
|
-
extend self
|
5
|
-
|
6
|
-
# Gets the default adapter. Sets it to RDiscount if adapter is not specified
|
7
|
-
def adapter
|
8
|
-
return @adapter if @adapter
|
9
|
-
self.adapter = :rdiscount
|
10
|
-
@adapter
|
11
|
-
end
|
12
|
-
|
13
|
-
# Sets the markdown processor and requires the adapter.
|
14
|
-
# @param [String, Symbol] name of the adapter
|
15
|
-
def adapter=(adapter_name)
|
16
|
-
case adapter_name
|
17
|
-
when Symbol, String
|
18
|
-
require "adapters/#{adapter_name}"
|
19
|
-
@adapter = Marky::Adapters.const_get("#{adapter_name.to_s.capitalize}")
|
20
|
-
else
|
21
|
-
raise "Missing adapter #{adapter_name}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Compiles the string into HTML.
|
26
|
-
# @param [String] the string which will be compiles
|
27
|
-
def to_html(string)
|
28
|
-
adapter.to_html(string)
|
29
|
-
end
|
30
|
-
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'adapters')
|
2
|
+
# Marky is simple wrapper for converting strings/text to html using different markdown processors.
|
3
|
+
module Marky
|
4
|
+
extend self
|
5
|
+
|
6
|
+
# Gets the default adapter. Sets it to RDiscount if adapter is not specified
|
7
|
+
def adapter
|
8
|
+
return @adapter if @adapter
|
9
|
+
self.adapter = :rdiscount
|
10
|
+
@adapter
|
11
|
+
end
|
12
|
+
|
13
|
+
# Sets the markdown processor and requires the adapter.
|
14
|
+
# @param [String, Symbol] name of the adapter
|
15
|
+
def adapter=(adapter_name)
|
16
|
+
case adapter_name
|
17
|
+
when Symbol, String
|
18
|
+
require "adapters/#{adapter_name}"
|
19
|
+
@adapter = Marky::Adapters.const_get("#{adapter_name.to_s.capitalize}")
|
20
|
+
else
|
21
|
+
raise "Missing adapter #{adapter_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Compiles the string into HTML.
|
26
|
+
# @param [String] the string which will be compiles
|
27
|
+
def to_html(string)
|
28
|
+
adapter.to_html(string)
|
29
|
+
end
|
30
|
+
|
31
31
|
end
|
data/marky.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "marky"
|
3
|
-
s.version = "0.0
|
4
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
|
5
|
-
s.authors = ["Mitko Kostov"]
|
6
|
-
s.description = %q{Marky is a simple wrapper for converting strings/text to html using different markdown processors.}
|
7
|
-
s.summary = %q{A gem to provide swappable markdown processors.}
|
8
|
-
s.email = ["mitko.kostov@gmail.com"]
|
9
|
-
s.homepage = "http://github.com/mytrile/marky"
|
10
|
-
s.files = `git ls-files`.split("\n")
|
11
|
-
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
end
|
14
|
-
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "marky"
|
3
|
+
s.version = "0.1.0"
|
4
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
|
5
|
+
s.authors = ["Mitko Kostov"]
|
6
|
+
s.description = %q{Marky is a simple wrapper for converting strings/text to html using different markdown processors.}
|
7
|
+
s.summary = %q{A gem to provide swappable markdown processors.}
|
8
|
+
s.email = ["mitko.kostov@gmail.com"]
|
9
|
+
s.homepage = "http://github.com/mytrile/marky"
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
end
|
14
|
+
|
data/test/marky_test.rb
CHANGED
@@ -1,37 +1,42 @@
|
|
1
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
-
|
3
|
-
require 'minitest/spec'
|
4
|
-
require 'marky'
|
5
|
-
|
6
|
-
MiniTest::Unit.autorun
|
7
|
-
|
8
|
-
describe Marky do
|
9
|
-
before do
|
10
|
-
Marky.adapter
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when I don't specify adapter" do
|
14
|
-
it "the default adapter should be rdiscount" do
|
15
|
-
Marky.adapter.must_equal Marky::Adapters::Rdiscount
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "when I use different when I don't specify adapter" do
|
20
|
-
|
21
|
-
it "returns proper html when using RDiscount" do
|
22
|
-
Marky.adapter = :rdiscount
|
23
|
-
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>\n"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns proper html when using Maruku" do
|
27
|
-
Marky.adapter = :maruku
|
28
|
-
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>"
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns proper html when using BlueCloth" do
|
32
|
-
Marky.adapter = :bluecloth
|
33
|
-
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>"
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
|
3
|
+
require 'minitest/spec'
|
4
|
+
require 'marky'
|
5
|
+
|
6
|
+
MiniTest::Unit.autorun
|
7
|
+
|
8
|
+
describe Marky do
|
9
|
+
before do
|
10
|
+
Marky.adapter
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "when I don't specify adapter" do
|
14
|
+
it "the default adapter should be rdiscount" do
|
15
|
+
Marky.adapter.must_equal Marky::Adapters::Rdiscount
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when I use different when I don't specify adapter" do
|
20
|
+
|
21
|
+
it "returns proper html when using RDiscount" do
|
22
|
+
Marky.adapter = :rdiscount
|
23
|
+
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns proper html when using Maruku" do
|
27
|
+
Marky.adapter = :maruku
|
28
|
+
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns proper html when using BlueCloth" do
|
32
|
+
Marky.adapter = :bluecloth
|
33
|
+
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns proper html when using Kramdown" do
|
37
|
+
Marky.adapter = :kramdown
|
38
|
+
Marky.to_html("Hello, Marky").must_equal "<p>Hello, Marky</p>\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 29
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
- 0
|
9
7
|
- 1
|
10
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Mitko Kostov
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-12-17 00:00:00 +02:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -33,6 +32,7 @@ files:
|
|
33
32
|
- README.md
|
34
33
|
- SUBMISSION_GUIDELINES
|
35
34
|
- lib/adapters/bluecloth.rb
|
35
|
+
- lib/adapters/kramdown.rb
|
36
36
|
- lib/adapters/maruku.rb
|
37
37
|
- lib/adapters/rdiscount.rb
|
38
38
|
- lib/marky.rb
|
@@ -52,7 +52,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
hash: 3
|
56
55
|
segments:
|
57
56
|
- 0
|
58
57
|
version: "0"
|
@@ -61,7 +60,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements:
|
62
61
|
- - ">="
|
63
62
|
- !ruby/object:Gem::Version
|
64
|
-
hash: 23
|
65
63
|
segments:
|
66
64
|
- 1
|
67
65
|
- 3
|