simple_markdown 0.2.0 → 0.3.0
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/lib/simple_markdown/action_view/helpers.rb +112 -99
- data/lib/simple_markdown/version.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +4 -3
- data/test/dummy/log/test.log +3218 -0
- data/test/simple_markdown_test.rb +29 -0
- data/test/test_helper.rb +3 -0
- metadata +16 -2
@@ -19,10 +19,18 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
19
19
|
assert_equal "", simple_markdown("")
|
20
20
|
end
|
21
21
|
|
22
|
+
test "empty even with many returns" do
|
23
|
+
assert_equal "", simple_markdown("\n\n\n")
|
24
|
+
end
|
25
|
+
|
22
26
|
test "paragraph" do
|
23
27
|
assert_equal "<p>\nText\n</p>", simple_markdown("Text")
|
24
28
|
end
|
25
29
|
|
30
|
+
test "don't add empty <p></p> even with multiple returns" do
|
31
|
+
assert_equal "<p>\nText\n</p><p>\nText\n</p>", simple_markdown("Text\n\n\n\n\nText")
|
32
|
+
end
|
33
|
+
|
26
34
|
test "multiple paragraphs" do
|
27
35
|
assert_equal "<p>\nText\n</p><p>\nText2\n</p>", simple_markdown("Text\n\nText2")
|
28
36
|
end
|
@@ -35,12 +43,24 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
35
43
|
assert_equal "<p>\nText <br>\nand more\n</p>", simple_markdown("Text \nand more")
|
36
44
|
end
|
37
45
|
|
46
|
+
test "link" do
|
47
|
+
assert_equal "<p>\n<a href=\"http://example.ch\">link</a>\n</p>", simple_markdown("[link](http://example.ch)")
|
48
|
+
assert_equal "<p>\nText <a href=\"http://example.ch\">link</a> text\n</p>", simple_markdown("Text [link](http://example.ch) text")
|
49
|
+
end
|
50
|
+
|
51
|
+
test "image" do
|
52
|
+
assert_equal "<p>\n<img src=\"http://example.ch\" alt=\"desc\">\n</p>", simple_markdown("")
|
53
|
+
assert_equal "<p>\nText <img src=\"http://example.ch\" alt=\"desc\"> text\n</p>", simple_markdown("Text  text")
|
54
|
+
end
|
55
|
+
|
38
56
|
test "emphasis" do
|
39
57
|
assert_equal "<p>\n<em>Text</em>\n</p>", simple_markdown("*Text*")
|
58
|
+
assert_equal "<p>\nText <em>Text</em> text\n</p>", simple_markdown("Text *Text* text")
|
40
59
|
end
|
41
60
|
|
42
61
|
test "strong" do
|
43
62
|
assert_equal "<p>\n<strong>Text</strong>\n</p>", simple_markdown("**Text**")
|
63
|
+
assert_equal "<p>\nText <strong>Text</strong> text\n</p>", simple_markdown("Text **Text** text")
|
44
64
|
end
|
45
65
|
|
46
66
|
test "list" do
|
@@ -72,4 +92,13 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
72
92
|
simple_markdown("[2flex1]\nThis is text\n\n[flex3]\nThis is text\n\n[flex]")
|
73
93
|
end
|
74
94
|
|
95
|
+
test "center a line" do
|
96
|
+
assert_equal "<p>\n<center>Centered text</center>\n</p>", simple_markdown("->Centered text<-")
|
97
|
+
end
|
98
|
+
|
99
|
+
test "center a block" do
|
100
|
+
assert_equal "<center>\n<p>\nText\n</p>\n</center>", simple_markdown("->\nText\n\n<-")
|
101
|
+
assert_equal "<center>\n<p>\nText\n</p><p>\nText\n</p>\n</center>", simple_markdown("->\n\nText\n\nText\n\n<-")
|
102
|
+
end
|
103
|
+
|
75
104
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Configure Rails Environment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
6
|
+
|
4
7
|
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
8
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
9
|
require "rails/test_help"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noémien Kocher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.3.10
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
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
|
description: Given a markdown formated text, transforms it to html via a simple method
|
42
56
|
`simple_markdown`
|
43
57
|
email:
|