simple_markdown 0.1.0 → 0.2.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 +73 -49
- data/lib/simple_markdown/version.rb +1 -1
- data/test/dummy/log/test.log +8355 -0
- data/test/simple_markdown_test.rb +21 -5
- metadata +2 -2
@@ -9,7 +9,7 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
9
9
|
assert_kind_of Module, SimpleMarkdown
|
10
10
|
end
|
11
11
|
|
12
|
-
test "
|
12
|
+
test "titles" do
|
13
13
|
1.upto(6) do |i|
|
14
14
|
assert_equal "<h#{i}>Title</h#{i}>", simple_markdown("#{'#'*i} Title")
|
15
15
|
end
|
@@ -28,11 +28,11 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
test "no <br> with one return without spaces at the end and add space" do
|
31
|
-
assert_equal "<p>\nText and more\n</p>", simple_markdown("Text\nand more")
|
31
|
+
assert_equal "<p>\nText and more\n</p>", simple_markdown("Text \nand more")
|
32
32
|
end
|
33
33
|
|
34
34
|
test "add <br> if return with 2 or more spaces at the end" do
|
35
|
-
assert_equal "<p>\nText
|
35
|
+
assert_equal "<p>\nText <br>\nand more\n</p>", simple_markdown("Text \nand more")
|
36
36
|
end
|
37
37
|
|
38
38
|
test "emphasis" do
|
@@ -48,12 +48,28 @@ class SimpleMarkdownTest < ActiveSupport::TestCase # ActionView::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
test "multiple lists" do
|
51
|
-
assert_equal "<p>\n• Text<br
|
51
|
+
assert_equal "<p>\n• Text<br>• Text<br>• Text<br>\n</p>", simple_markdown("* Text\n* Text\n* Text")
|
52
52
|
end
|
53
53
|
|
54
54
|
test "inline code" do
|
55
|
-
|
55
|
+
# I had to use CGI::escapeHTML in my code to make it work
|
56
56
|
assert_equal "<p>\nThis is <code>#{CGI::escapeHTML('<b>code</b>')}</code>\n</p>", simple_markdown("This is `<b>code</b>`")
|
57
57
|
end
|
58
58
|
|
59
|
+
test "code block" do
|
60
|
+
assert_equal "<pre><code>#{CGI::escapeHTML('<b>code</b>')}</code></pre>", simple_markdown("```\n<b>code</b>\n```")
|
61
|
+
end
|
62
|
+
|
63
|
+
test "flex block" do
|
64
|
+
# skip("flex block is in WIP")
|
65
|
+
assert_equal "<div style=\"display:flex; justify-content:space-between; align-items: flex-start;\">\n<div>\n<p>\nThis is text\n</p>\n</div><div>\n<p>\nThis is text\n</p>\n</div>\n</div>",
|
66
|
+
simple_markdown("[2flex]\nThis is text\n\n[flex]\nThis is text\n\n[flex]")
|
67
|
+
end
|
68
|
+
|
69
|
+
test "flex block with space specified" do
|
70
|
+
# skip("flex block is in WIP")
|
71
|
+
assert_equal "<div style=\"display:flex; justify-content:space-between; align-items: flex-start;\">\n<div style=\"flex:1;\">\n<p>\nThis is text\n</p>\n</div><div style=\"flex:3;\">\n<p>\nThis is text\n</p>\n</div>\n</div>",
|
72
|
+
simple_markdown("[2flex1]\nThis is text\n\n[flex3]\nThis is text\n\n[flex]")
|
73
|
+
end
|
74
|
+
|
59
75
|
end
|
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.2.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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|