diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-09-17 16:48:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-09-17 16:48:04 +0000 |
commit | 14b4afeec90a9048d06e5d5dc1ea45927fcc49f8 (patch) | |
tree | 4ac20943be407d2f675eaad1cf84fdf2d32f9e10 /lib/redmine/wiki_formatting.rb | |
parent | 3520961eae873fcbb983414ad8e18500b377c5b7 (diff) | |
download | redmine-14b4afeec90a9048d06e5d5dc1ea45927fcc49f8.tar.gz redmine-14b4afeec90a9048d06e5d5dc1ea45927fcc49f8.zip |
Fixed: http links containing parentheses fail to reder correctly (#1591). Patch by Paul Rivier.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1871 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting.rb')
-rw-r--r-- | lib/redmine/wiki_formatting.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 649edfeff..7dffff492 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -144,7 +144,7 @@ module Redmine (\S+?) # url (\/)? # slash ) - ([^\w\=\/;]*?) # post + ([^\w\=\/;\(\)]*?) # post (?=<|\s|$) }x unless const_defined?(:AUTO_LINK_RE) @@ -156,7 +156,13 @@ module Redmine # don't replace URL's that are already linked # and URL's prefixed with ! !> !< != (textile images) all - else + else + # Idea below : an URL with unbalanced parethesis and + # ending by ')' is put into external parenthesis + if ( url[-1]==?) and ((url.count("(") - url.count(")")) < 0 ) ) + url=url[0..-2] # discard closing parenth from url + post = ")"+post # add closing parenth to post + end %(#{leading}<a class="external" href="#{proto=="www."?"http://www.":proto}#{url}">#{proto + url}</a>#{post}) end end |