On Mon, Aug 10, 2009 at 10:34 PM, Luis Villa<[email protected]> wrote: > On Fri, Aug 7, 2009 at 3:39 AM, Reinier Balt<[email protected]> wrote: >> I think the problem is in rails. The auto_link uses a regular expression: >> >> AUTO_LINK_RE = %r{ >> ( # leading text >> <\w+.*?>| # leading HTML tag, or >> [^=!:'"/]| # leading punctuation, or >> ^ # beginning of line >> ) >> ( >> (?:https?://)| # protocol spec, or >> (?:www\.) # www.* >> ) >> ( >> [-\w]+ # subdomain or domain >> (?:\.[-\w]+)* # remaining subdomains or >> domain >> (?::\d+)? # port >> (?:/(?:[~\...@%=\(\)-]|(?:[,.;:'][^\s$]))*)* # >> path >> (?:\?[\...@%&=.;:-]+)? # query string >> (?:\#[\w\-]*)? # trailing anchor >> ) >> ([[:punct:]]|<|$|) # trailing text >> }x unless const_defined?(:AUTO_LINK_RE) >> >> (from vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb) >> >> Although I'm not very good at regular expressions, > > regexp are one of the things that remind me that I am a pathetic, > pathetic excuse for a hacker ;) > >> I cannot spot { or } in >> the query string part or the path part of the expression. I think that is >> why auto_link does not take the complete url. > > I think the problem is actually that after the #, only \w and \- are > counted as valid parts of the URL. So adding another punctuation (here > another \ ) after the # anchor (rare, but becoming more common) breaks > the regexp. I will file a rails bug and modify my plugin to use > markdown in the meantime (which is probably more user-friendly anyway, > now that I think about it...)
Filed as https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3035 for those who care. Thanks for pointing me at the right file, Reinier! Luis _______________________________________________ Tracks-discuss mailing list [email protected] http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
