creole 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/creole.rb +2 -2
  2. data/test/creole_test.rb +20 -6
  3. metadata +2 -2
@@ -37,7 +37,7 @@ require 'uri'
37
37
  # methods are: make_local_link
38
38
  class Creole
39
39
 
40
- VERSION = '0.3.7'
40
+ VERSION = '0.3.8'
41
41
 
42
42
  # Convert the argument in Creole format to HTML and return the
43
43
  # result. Example:
@@ -231,7 +231,7 @@ class Creole
231
231
  def parse_inline(str)
232
232
  until str.empty?
233
233
  case str
234
- when /\A(\~)?((https?|ftps?):\/\/\S+?)(?=([,.?!:;"'\)])?(\s|$))/
234
+ when /\A(\~)?((https?|ftps?):\/\/\S+?)(?=([\,.?!:;"'\)]+)?(\s|$))/
235
235
  if $1
236
236
  @out << escape_html($2)
237
237
  else
@@ -144,9 +144,6 @@ describe Creole do
144
144
  # Creole1.0: URLs
145
145
  tc "<p><a href=\"http://www.wikicreole.org/\">http://www.wikicreole.org/</a></p>", "[[http://www.wikicreole.org/]]"
146
146
 
147
- # Creole1.0: Free-standing URL's should be turned into links
148
- tc "<p><a href=\"http://www.wikicreole.org/\">http://www.wikicreole.org/</a></p>", "http://www.wikicreole.org/"
149
-
150
147
  # Creole1.0: Single punctuation characters at the end of URLs
151
148
  # should not be considered a part of the URL.
152
149
  [',','.','?','!',':',';','\'','"'].each do |punct|
@@ -170,6 +167,26 @@ describe Creole do
170
167
  tc("<p><a href=\"http://dot.com/\">dot.com</a></p>", "[[ http://dot.com/ | dot.com ]]")
171
168
  end
172
169
 
170
+ it 'should parse freestanding urls' do
171
+ # Creole1.0: Free-standing URL's should be turned into links
172
+ tc "<p><a href=\"http://www.wikicreole.org/\">http://www.wikicreole.org/</a></p>", "http://www.wikicreole.org/"
173
+
174
+ # URL ending in .
175
+ tc "<p>Text <a href=\"http://wikicreole.org\">http://wikicreole.org</a>. other text</p>", "Text http://wikicreole.org. other text"
176
+
177
+ # URL ending in ),
178
+ tc "<p>Text (<a href=\"http://wikicreole.org\">http://wikicreole.org</a>), other text</p>", "Text (http://wikicreole.org), other text"
179
+
180
+ # URL ending in ).
181
+ tc "<p>Text (<a href=\"http://wikicreole.org\">http://wikicreole.org</a>). other text</p>", "Text (http://wikicreole.org). other text"
182
+
183
+ # URL ending in ).
184
+ tc "<p>Text (<a href=\"http://wikicreole.org\">http://wikicreole.org</a>).</p>", "Text (http://wikicreole.org)."
185
+
186
+ # URL ending in )
187
+ tc "<p>Text (<a href=\"http://wikicreole.org\">http://wikicreole.org</a>)</p>", "Text (http://wikicreole.org)"
188
+ end
189
+
173
190
  it 'should parse paragraphs' do
174
191
  # Creole1.0: One or more blank lines end paragraphs.
175
192
  tc "<p>This is my text.</p><p>This is more text.</p>", "This is\nmy text.\n\nThis is\nmore text."
@@ -336,9 +353,6 @@ describe Creole do
336
353
  # Another test from Creole Wiki
337
354
  tc("<p>Formatted fruits, for example:<em>apples</em>, oranges, <strong>pears</strong> ...</p>",
338
355
  "Formatted fruits, for example://apples//, oranges, **pears** ...")
339
-
340
- tc("<p>Blablabala (<a href=\"http://blub.de\">http://blub.de</a>)</p>",
341
- "Blablabala (http://blub.de)")
342
356
  end
343
357
 
344
358
  it 'should parse ambiguious bold and lists' do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 7
9
- version: 0.3.7
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Lars Christensen