summary refs log tree commit diff stats
path: root/compiler/docgen.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-02-15 20:46:54 +0200
committerZahary Karadjov <zahary@gmail.com>2014-02-15 20:46:54 +0200
commitf701ee086aacf3ad9d4f58c20d5924fc0c5b3bb2 (patch)
treefa745d5a7078f4ff3f11ba368f47f1bc4e778e1e /compiler/docgen.nim
parentc1f1f841946dce9454e6971e9ce30115789cfb61 (diff)
parentd142824d65f1775c703075c75e128e7fcbf3d332 (diff)
downloadNim-f701ee086aacf3ad9d4f58c20d5924fc0c5b3bb2.tar.gz
Merge branch 'devel' of gh:/Araq/Nimrod into devel
Diffstat (limited to 'compiler/docgen.nim')
-rw-r--r--compiler/docgen.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index 343f415b3..c05b55184 100644
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -42,17 +42,23 @@ proc compilerMsgHandler(filename: string, line, col: int,
   of mwUnsupportedLanguage: k = warnLanguageXNotSupported
   globalError(newLineInfo(filename, line, col), k, arg)
 
+proc docgenFindFile(s: string): string {.procvar.} =
+  result = options.findFile(s)
+  if result.len == 0:
+    result = getCurrentDir() / s
+    if not existsFile(result): result = ""
+
 proc parseRst(text, filename: string,
               line, column: int, hasToc: var bool,
               rstOptions: TRstParseOptions): PRstNode =
   result = rstParse(text, filename, line, column, hasToc, rstOptions,
-                    options.findFile, compilerMsgHandler)
+                    docgenFindFile, compilerMsgHandler)
 
 proc newDocumentor*(filename: string, config: PStringTable): PDoc =
   new(result)
   initRstGenerator(result[], (if gCmd != cmdRst2tex: outHtml else: outLatex),
                    options.gConfigVars, filename, {roSupportRawDirective},
-                   options.findFile, compilerMsgHandler)
+                   docgenFindFile, compilerMsgHandler)
   result.id = 100
 
 proc dispA(dest: var PRope, xml, tex: string, args: openArray[PRope]) =