|
17 | 17 | packages/docutils/rst, packages/docutils/rstgen, |
18 | 18 | json, xmltree, cgi, trees, types, |
19 | 19 | typesrenderer, astalgo, lineinfos, intsets, |
20 | | - pathutils, trees |
| 20 | + pathutils, trees, nimconf |
21 | 21 |
|
22 | 22 | const |
23 | 23 | exportSection = skField |
|
43 | 43 | destFile*: AbsoluteFile |
44 | 44 | thisDir*: AbsoluteDir |
45 | 45 | examples: string |
| 46 | + wroteCss*: bool |
46 | 47 |
|
47 | 48 | PDoc* = ref TDocumentor ## Alias to type less. |
48 | 49 |
|
@@ -1069,10 +1070,16 @@ proc writeOutput*(d: PDoc, useWarning = false) = |
1069 | 1070 | template outfile: untyped = d.destFile |
1070 | 1071 | #let outfile = getOutFile2(d.conf, shortenDir(d.conf, filename), outExt, "htmldocs") |
1071 | 1072 | createDir(outfile.splitFile.dir) |
| 1073 | + d.conf.outFile = outfile.extractFilename.RelativeFile |
1072 | 1074 | if not writeRope(content, outfile): |
1073 | 1075 | rawMessage(d.conf, if useWarning: warnCannotOpenFile else: errCannotOpenFile, |
1074 | 1076 | outfile.string) |
1075 | | - d.conf.outFile = outfile.extractFilename.RelativeFile |
| 1077 | + elif not d.wroteCss: |
| 1078 | + let cssSource = $d.conf.getPrefixDir() / "doc" / "nimdoc.css" |
| 1079 | + let cssDest = $d.conf.outDir / "nimdoc.out.css" |
| 1080 | + # renamed to make it easier to use with gitignore in user's repos |
| 1081 | + copyFile(cssSource, cssDest) |
| 1082 | + d.wroteCss = true |
1076 | 1083 |
|
1077 | 1084 | proc writeOutputJson*(d: PDoc, useWarning = false) = |
1078 | 1085 | runAllExamples(d) |
|
0 commit comments