marker 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/marker/language.treetop +6 -4
- data/lib/marker/links.rb +1 -1
- data/test/encodings_test.rb +24 -0
- data/test/formatting_test.rb +1 -1
- data/test/headings_test.rb +1 -1
- data/test/links_test.rb +4 -4
- data/test/lists_test.rb +1 -1
- data/test/templates_test.rb +5 -2
- data/test/verbatim_test.rb +1 -1
- metadata +4 -3
data/lib/marker/language.treetop
CHANGED
@@ -671,17 +671,19 @@ module Marker
|
|
671
671
|
[A-Fa-f0-9]
|
672
672
|
end
|
673
673
|
|
674
|
-
#-- TODO: Handle windows newlines (\r\n) ++
|
675
|
-
|
676
674
|
# required new lines
|
677
675
|
# just one!
|
678
676
|
rule rnl
|
679
|
-
"\n"
|
677
|
+
"\r\n" # windows
|
678
|
+
/
|
679
|
+
"\n" # linux/unix
|
680
|
+
/
|
681
|
+
"\r" # mac
|
680
682
|
end
|
681
683
|
|
682
684
|
# new lines
|
683
685
|
rule nl
|
684
|
-
|
686
|
+
[\r\n]*
|
685
687
|
end
|
686
688
|
|
687
689
|
# all white space
|
data/lib/marker/links.rb
CHANGED
@@ -139,7 +139,7 @@ module Marker #:nodoc:
|
|
139
139
|
def to_html( options = {} )
|
140
140
|
url = bare_url
|
141
141
|
if url =~ /[.,!?:]$/
|
142
|
-
"<a href='#{url[0...-1]}'>#{url[0...-1]}</a>#{url[-1]}"
|
142
|
+
"<a href='#{url[0...-1]}'>#{url[0...-1]}</a>#{url[-1,1]}"
|
143
143
|
else
|
144
144
|
"<a href='#{url}'>#{url}</a>"
|
145
145
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path( File.dirname( __FILE__ ) + '/test_helper' )
|
2
|
+
require 'marker'
|
3
|
+
|
4
|
+
class EncodingsTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_linux_newlines
|
7
|
+
text = "one\ntwo\n\nthree"
|
8
|
+
markup = Marker.parse text
|
9
|
+
assert_match("<p>one two</p>\n\n<p>three</p>", markup.to_html)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_windows_newlines
|
13
|
+
text = "one\r\ntwo\r\n\r\nthree"
|
14
|
+
markup = Marker.parse text
|
15
|
+
assert_match("<p>one two</p>\n\n<p>three</p>", markup.to_html)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_mac_newlines
|
19
|
+
text = "one\rtwo\r\rthree"
|
20
|
+
markup = Marker.parse text
|
21
|
+
assert_match("<p>one two</p>\n\n<p>three</p>", markup.to_html)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/test/formatting_test.rb
CHANGED
data/test/headings_test.rb
CHANGED
data/test/links_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
1
|
+
require File.expand_path( File.dirname( __FILE__ ) + '/test_helper' )
|
2
2
|
require 'marker'
|
3
3
|
|
4
4
|
class LinkTest < Test::Unit::TestCase
|
@@ -37,7 +37,7 @@ class LinkTest < Test::Unit::TestCase
|
|
37
37
|
def test_internal_with_url
|
38
38
|
text = "[[http://www.example.com]]"
|
39
39
|
markup = Marker.parse text
|
40
|
-
assert_match("<p><a href='http://www.example.com'>[1]</a></p>\n<ol><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
40
|
+
assert_match("<p><a href='http://www.example.com'>[1]</a></p>\n<ol class='footnotes'><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
41
41
|
|
42
42
|
text = "[[http://www.example.com|Example page]]"
|
43
43
|
markup = Marker.parse text
|
@@ -66,7 +66,7 @@ class LinkTest < Test::Unit::TestCase
|
|
66
66
|
text = "[http://www.example.com]"
|
67
67
|
markup = Marker.parse text
|
68
68
|
|
69
|
-
assert_match("<p><a href='http://www.example.com'>[1]</a></p>\n<ol><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
69
|
+
assert_match("<p><a href='http://www.example.com'>[1]</a></p>\n<ol class='footnotes'><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_nested_links
|
@@ -134,7 +134,7 @@ class LinkTest < Test::Unit::TestCase
|
|
134
134
|
|
135
135
|
# TODO: should this collect identical links into one footnote?
|
136
136
|
assert_match("<p><a href='http://www.example.com'>[1]</a> <a href='http://www.example.com'>[2]</a></p>\n" +
|
137
|
-
"<ol><li><a href='http://www.example.com'>http://www.example.com</a></li><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
137
|
+
"<ol class='footnotes'><li><a href='http://www.example.com'>http://www.example.com</a></li><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
|
138
138
|
end
|
139
139
|
|
140
140
|
end
|
data/test/lists_test.rb
CHANGED
data/test/templates_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
1
|
+
require File.expand_path( File.dirname( __FILE__ ) + '/test_helper' )
|
2
2
|
require 'marker'
|
3
3
|
|
4
4
|
class TemplatesTest < Test::Unit::TestCase
|
@@ -22,7 +22,10 @@ class TemplatesTest < Test::Unit::TestCase
|
|
22
22
|
markup = Marker.parse text
|
23
23
|
|
24
24
|
# might want to fix this assertion, the hash could come out in any order
|
25
|
-
assert_match("<p>render:template( :html, [], {
|
25
|
+
assert_match("<p>render:template( :html, [], {", markup.to_html)
|
26
|
+
assert_match("\"two\"=>\"2\"", markup.to_html)
|
27
|
+
assert_match("\"one\"=>\"1\"", markup.to_html)
|
28
|
+
assert_match("} )</p>", markup.to_html)
|
26
29
|
end
|
27
30
|
|
28
31
|
def test_mixed_args
|
data/test/verbatim_test.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ryan Blue
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -90,5 +90,6 @@ test_files:
|
|
90
90
|
- test/links_test.rb
|
91
91
|
- test/test_helper.rb
|
92
92
|
- test/formatting_test.rb
|
93
|
+
- test/encodings_test.rb
|
93
94
|
- test/lists_test.rb
|
94
95
|
- test/templates_test.rb
|