About Download Docs Changes

Allow free link urls to end with a slash

Another minor bug. If a URL isn't in [[ ... ]] brackets (a free link) and it ends with a slash, the slash isn't part of the URL.

http://kitenet.net/~joey/code/etckeeper/

This makes it look a little odd, especially if you are using different font sizes for links. Can the regex be relaxed a bit so that the entire URL is linked?

Here is a simple patch:

# HG changeset patch
# User Julian Cowley <julian@lava.net>
# Date 1235516854 36000
# Node ID 9e5dbde897e1db8a9938fb2d1b36e84c3a6da54d
# Parent  ce0724f089c8f45615c17d3366d28c98ffa0c857
Relax free_link regex to allow urls to end with a slash.

diff --git a/hatta.py b/hatta.py
--- a/hatta.py
+++ b/hatta.py
@@ -577,7 +577,7 @@
         "bold": ur"[*][*]",
         "code": ur"[{][{][{](?P<code_text>([^}]|[^}][}]|[^}][}][}])"
                 ur"*[}]*)[}][}][}]",
-        "free_link": ur"""(http|https|ftp)://\S+[^\s.,:;!?()'"/=+<>-]""",
+        "free_link": ur"""(http|https|ftp)://\S+[^\s.,:;!?()'"=+<>-]""",
         "italic": ur"//",
         "link": ur"\[\[(?P<link_target>([^|\]]|\][^|\]])+)"
                 ur"(\|(?P<link_text>([^\]]|\][^\]])+))?\]\]",

Applied, thanks. I guess I just copied that list of punctuation characters from other patterns, didn't notice that slash makes more sense as part of the URL. – Radomir Dopieralski


Issues, Fixed Bugs