summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xpackages/docutils/rst.nim14
-rw-r--r--packages/docutils/rstgen.nim3
-rwxr-xr-xtodo.txt2
3 files changed, 10 insertions, 9 deletions
diff --git a/packages/docutils/rst.nim b/packages/docutils/rst.nim
index 351aa6d12..16572abb4 100755
--- a/packages/docutils/rst.nim
+++ b/packages/docutils/rst.nim
@@ -287,15 +287,15 @@ proc whichMsgClass*(k: TMsgKind): TMsgClass =
   of 'h', 'H': result = mcHint
   else: assert false, "msgkind does not fit naming scheme"
   
-proc defaultMsgHandler(filename: string, line, col: int, msgkind: TMsgKind,
-                       arg: string) =
+proc defaultMsgHandler*(filename: string, line, col: int, msgkind: TMsgKind,
+                        arg: string) {.procvar.} =
   let mc = msgKind.whichMsgClass
   let a = messages[msgKind] % arg
   let message = "$1($2, $3) $4: $5" % [filename, $line, $col, $mc, a]
   if mc == mcError: raise newException(EParseError, message)
   else: Writeln(stdout, message)
 
-proc defaultFindFile(filename: string): string = 
+proc defaultFindFile*(filename: string): string {.procvar.} = 
   if existsFile(filename): result = filename
   else: result = ""
 
@@ -386,7 +386,7 @@ proc findSub(p: var TRstParser, n: PRstNode): int =
   for i in countup(0, high(p.s.subs)): 
     if cmpIgnoreStyle(key, p.s.subs[i].key) == 0: 
       return i
-  result = - 1
+  result = -1
 
 proc setSub(p: var TRstParser, key: string, value: PRstNode) = 
   var length = len(p.s.subs)
@@ -550,7 +550,7 @@ proc parsePostfix(p: var TRstParser, n: PRstNode): PRstNode =
   result = n
   if isInlineMarkupEnd(p, "_"): 
     inc(p.idx)
-    if (p.tok[p.idx - 2].symbol == "`") and (p.tok[p.idx - 3].symbol == ">"): 
+    if p.tok[p.idx-2].symbol == "`" and p.tok[p.idx-3].symbol == ">":
       var a = newRstNode(rnInner)
       var b = newRstNode(rnInner)
       fixupEmbeddedRef(n, a, b)
@@ -711,7 +711,7 @@ proc parseMarkdownCodeblock(p: var TRstParser): PRstNode =
       rstMessage(p, meExpected, "```")
       break
     of tkPunct:
-      if isInlineMarkupEnd(p, "```"):
+      if p.tok[p.idx].symbol == "```":
         inc(p.idx)
         break
       else:
@@ -745,7 +745,7 @@ proc parseInline(p: var TRstParser, father: PRstNode) =
       var n = newRstNode(rnEmphasis)
       parseUntil(p, n, "*", true)
       add(father, n)
-    elif roSupportMarkdown in p.s.options and isInlineMarkupStart(p, "```"):
+    elif roSupportMarkdown in p.s.options and p.tok[p.idx].symbol == "```":
       inc(p.idx)
       add(father, parseMarkdownCodeblock(p))
     elif isInlineMarkupStart(p, "``"):
diff --git a/packages/docutils/rstgen.nim b/packages/docutils/rstgen.nim
index c2a267005..a9f9376f3 100644
--- a/packages/docutils/rstgen.nim
+++ b/packages/docutils/rstgen.nim
@@ -685,7 +685,8 @@ proc rstToHtml*(s: string, options: TRstParseOptions,
 
   const filen = "input"
   var d: TRstGenerator
-  initRstGenerator(d, outHtml, config, filen, options, myFindFile, nil)
+  initRstGenerator(d, outHtml, config, filen, options, myFindFile, 
+                   rst.defaultMsgHandler)
   var dummyHasToc = false
   var rst = rstParse(s, filen, 0, 1, dummyHasToc, options)
   result = ""
diff --git a/todo.txt b/todo.txt
index 7ab7a31cd..c5a7214e5 100755
--- a/todo.txt
+++ b/todo.txt
@@ -1,7 +1,6 @@
 version 0.9.0
 =============
 
-- docgen: markdown support
 - make templates hygienic by default
 - ``bind`` for overloaded symbols does not work apparently
 - ``=`` should be overloadable; requires specialization for ``=``
@@ -24,6 +23,7 @@ version 0.9.0
 - we need to support iteration of 2 different data structures in parallel
 - make exceptions compatible with C++ exceptions
 - change how comments are part of the AST
+- extract nimdoc properly and document it finally
 - rethink the syntax: distinction between expr and stmt is unfortunate; 
   indentation handling is quite complex too; problem with exception handling
   is that often the scope of ``try`` is wrong and apart from that ``try`` is