marker 0.2.1 → 0.2.2

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.
@@ -612,8 +612,9 @@ module Marker
612
612
  # additions:
613
613
  # * @, :, / are added because they are valid in some cases (not checked)
614
614
  # * %XX is allowed as a character, these are escaped characters
615
+ # * '#' is added for HTML anchors
615
616
  rule url_safe_char
616
- !"]" [A-Za-z0-9$-_.+!*'(),@:/]
617
+ !"]" [A-Za-z0-9$-_.+!*'(),@:/#]
617
618
  /
618
619
  "%" xdigit xdigit
619
620
  end
@@ -679,7 +680,6 @@ module Marker
679
680
  end
680
681
 
681
682
  # new lines
682
- #-- TODO: should this be broken into exactly one and any number rules? ++
683
683
  rule nl
684
684
  "\n"*
685
685
  end
@@ -55,6 +55,13 @@ class LinkTest < Test::Unit::TestCase
55
55
  assert_match("<a href='http://www.example.com'>Example link</a>", markup.to_html)
56
56
  end
57
57
 
58
+ def test_external_link_with_anchor
59
+ text = "[http://www.example.com/page#anchor Example link]"
60
+ markup = Marker.parse text
61
+
62
+ assert_match("<a href='http://www.example.com/page#anchor'>Example link</a>", markup.to_html)
63
+ end
64
+
58
65
  def test_bare_external_link
59
66
  text = "[http://www.example.com]"
60
67
  markup = Marker.parse text
@@ -91,10 +98,24 @@ class LinkTest < Test::Unit::TestCase
91
98
  end
92
99
 
93
100
  def test_bare_url
94
- text = "http://www.example.com"
101
+ text = "http://www.example.com following text"
95
102
  markup = Marker.parse text
96
103
 
97
- 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)
104
+ assert_match("<p><a href='http://www.example.com'>[1]</a> following text</p>\n<ol><li><a href='http://www.example.com'>http://www.example.com</a></li></ol>", markup.to_html)
105
+ end
106
+
107
+ def test_bare_url_with_encodings
108
+ text = "http://www.example.com/page?input=%28%29 following text"
109
+ markup = Marker.parse text
110
+
111
+ assert_match("<p><a href='http://www.example.com/page?input=%28%29'>[1]</a> following text</p>\n<ol><li><a href='http://www.example.com/page?input=%28%29'>http://www.example.com/page?input=%28%29</a></li></ol>", markup.to_html)
112
+ end
113
+
114
+ def test_bare_url_with_anchor
115
+ text = "http://www.example.com/page#anchor following text"
116
+ markup = Marker.parse text
117
+
118
+ assert_match("<p><a href='http://www.example.com/page#anchor'>[1]</a> following text</p>\n<ol><li><a href='http://www.example.com/page#anchor'>http://www.example.com/page#anchor</a></li></ol>", markup.to_html)
98
119
  end
99
120
 
100
121
  def test_multiple_footnotes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Blue
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-30 00:00:00 +01:00
12
+ date: 2010-02-01 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency