breakout_parser 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ [ 0.0.19 ]
2
+
3
+ * skip redundant '/' in making relative urls absolute
4
+ (https://www.assembla.com/spaces/breakout/tickets/6513)
5
+
1
6
  [ 0.0.18 ]
2
7
 
3
8
  * added README
@@ -2273,6 +2273,7 @@ process_url_link(const char*target,const char* proto){
2273
2273
  // relative link
2274
2274
  if( absolute_urls && site_url ){
2275
2275
  concat2(site_url);
2276
+ if(*(bufptr-1) == '/') bufptr--; // skip redundant '/'
2276
2277
  }
2277
2278
  }
2278
2279
  for(c=target; *c && *c != ']' && *c != '|'; c++) concat_raw_char(*c);
@@ -342,6 +342,7 @@ process_url_link(const char*target,const char* proto){
342
342
  // relative link
343
343
  if( absolute_urls && site_url ){
344
344
  concat2(site_url);
345
+ if(*(bufptr-1) == '/') bufptr--; // skip redundant '/'
345
346
  }
346
347
  }
347
348
  for(c=target; *c && *c != ']' && *c != '|'; c++) concat_raw_char(*c);
data/spec/parser_spec.rb CHANGED
@@ -939,6 +939,12 @@ describe 'BreakoutParser' do
939
939
  parse("[[url:/rel|text]]", :absolute_urls => v, :site_url => 'http://www.ru').should ==
940
940
  '<a rel="nofollow" href="http://www.ru/rel">text</a>'
941
941
  end
942
+ it "should strip redundant '/' when absolute_urls = #{v.inspect}" do
943
+ parse("[[url:/rel]]", :absolute_urls => v, :site_url => 'http://www.ru/').should ==
944
+ '<a rel="nofollow" href="http://www.ru/rel">/rel</a>'
945
+ parse("[[url:/rel|text]]", :absolute_urls => v, :site_url => 'http://www.ru/').should ==
946
+ '<a rel="nofollow" href="http://www.ru/rel">text</a>'
947
+ end
942
948
  end
943
949
  # 'false' values
944
950
  [false, nil].each do |v|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breakout_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 18
10
- version: 0.0.18
9
+ - 19
10
+ version: 0.0.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrey "Zed" Zaikin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-25 00:00:00 +04:00
18
+ date: 2010-08-29 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency