Is there a better way to support parenthesis in links like Wikipedia links? Requiring brackets around the link is confusing to many new users who don''t understand why their Wikipedia links won''t work. I wrote a patch on the latest version of RedCloth to support this a lot better. Instead of stopping on a end parenthesis, it instead looks at the URL itself. If the number of opening and closing parenthesis are equal, it allows the end parenthesis in the link. I''m sure there''s a better way, like checking if they are properly nested. Included is two patches, one for the C code, another to include more tests. I do not have Java, so I cannot test myself, however it should be trivial to port. -------------- next part -------------- A non-text attachment was scrubbed... Name: links_containing_parenthesis.patch Type: application/octet-stream Size: 1295 bytes Desc: not available URL: <http://rubyforge.org/pipermail/redcloth-upwards/attachments/20090105/6bc141ad/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: tests_for_links_containing_parenthesis.patch Type: application/octet-stream Size: 1909 bytes Desc: not available URL: <http://rubyforge.org/pipermail/redcloth-upwards/attachments/20090105/6bc141ad/attachment-0001.obj> -------------- next part -------------- Ryan Alyea ryan at fangamer.com
Fantastic! Thank you, Ryan. I''ve added it to an existing ticket and I can''t wait to apply your patch. The ticket''s URL is http://jgarber.lighthouseapp.com/projects/13054-redcloth/tickets/82-rendering-error-for-link-with-parenthesis Jason On Jan 5, 2009, at 1:05 AM, Ryan Alyea wrote:> Is there a better way to support parenthesis in links like Wikipedia > links? Requiring brackets around the link is confusing to many new > users who don''t understand why their Wikipedia links won''t work. I > wrote a patch on the latest version of RedCloth to support this a > lot better. Instead of stopping on a end parenthesis, it instead > looks at the URL itself. If the number of opening and closing > parenthesis are equal, it allows the end parenthesis in the link. > I''m sure there''s a better way, like checking if they are properly > nested. > > Included is two patches, one for the C code, another to include more > tests. I do not have Java, so I cannot test myself, however it > should be trivial to port. > > < > links_containing_parenthesis > .patch><tests_for_links_containing_parenthesis.patch> > > Ryan Alyea > ryan at fangamer.com > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards