summary refs log tree commit diff stats
path: root/packages
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-06-01 00:25:02 +0200
committerAraq <rumpf_a@web.de>2012-06-01 00:25:02 +0200
commit232ab71f208e341da327e54afa8a6d287141836b (patch)
tree4107089f4ef9dc1fe5e03411eb620ac24d785800 /packages
parent073323af48f0d6a99e0c2bf8aacc1dcae32c59c6 (diff)
downloadNim-232ab71f208e341da327e54afa8a6d287141836b.tar.gz
bugfix: RST parser: URLs properly parsed
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/docutils/rst.nim9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/docutils/rst.nim b/packages/docutils/rst.nim
index 16572abb4..126b21bd6 100755
--- a/packages/docutils/rst.nim
+++ b/packages/docutils/rst.nim
@@ -608,9 +608,16 @@ proc parseSmiley(p: var TRstParser): PRstNode =
       result.text = val
       return
 
+when false:
+  const
+    urlChars = {'A'..'Z', 'a'..'z', '0'..'9', ':', '#', '@', '%', '/', ';',
+                 '$', '(', ')', '~', '_', '?', '+', '-', '=', '\\', '.', '&',
+                 '\128'..'\255'}
+
 proc isURL(p: TRstParser, i: int): bool =
   result = (p.tok[i+1].symbol == ":") and (p.tok[i+2].symbol == "//") and
-          (p.tok[i+3].kind == tkWord) and (p.tok[i+4].symbol == ".")
+          (p.tok[i+3].kind == tkWord) and 
+          (p.tok[i].symbol in ["http", "ftp", "gopher", "telnet", "file"])
 
 proc parseURL(p: var TRstParser, father: PRstNode) = 
   #if p.tok[p.idx].symbol[strStart] == '<':