From 232ab71f208e341da327e54afa8a6d287141836b Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 1 Jun 2012 00:25:02 +0200 Subject: bugfix: RST parser: URLs properly parsed --- packages/docutils/rst.nim | 9 ++++++++- todo.txt | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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] == '<': diff --git a/todo.txt b/todo.txt index ee761219c..6bdfefc0d 100755 --- a/todo.txt +++ b/todo.txt @@ -2,6 +2,7 @@ version 0.9.0 ============= - implement 'gorge' +- implement a warning message for shadowed 'result' variable - make templates hygienic by default: try to gensym() everything in the 'block' of a template - ``bind`` for overloaded symbols does not work apparently -- cgit 1.4.1-2-gfad0