mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes bootstrapping for any machine that has a Nim already installed [backport:1.4] (#15660)
(cherry picked from commit 9a059657ca)
This commit is contained in:
@@ -27,8 +27,7 @@
|
||||
|
||||
import strutils, os, hashes, strtabs, rstast, rst, highlite, tables, sequtils,
|
||||
algorithm, parseutils
|
||||
import "$lib/../compiler/nimpaths"
|
||||
import "$lib/../compiler/pathutils"
|
||||
|
||||
import ../../std/private/since
|
||||
|
||||
const
|
||||
@@ -58,8 +57,8 @@ type
|
||||
options*: RstParseOptions
|
||||
findFile*: FindFileHandler
|
||||
msgHandler*: MsgHandler
|
||||
outDir*: AbsoluteDir ## output directory, initialized by docgen.nim
|
||||
destFile*: AbsoluteFile ## output (HTML) file, initialized by docgen.nim
|
||||
outDir*: string ## output directory, initialized by docgen.nim
|
||||
destFile*: string ## output (HTML) file, initialized by docgen.nim
|
||||
filename*: string ## source Nim or Rst file
|
||||
meta*: array[MetaEnum, string]
|
||||
currentSection: string ## \
|
||||
@@ -84,7 +83,7 @@ type
|
||||
status: int
|
||||
|
||||
proc prettyLink*(file: string): string =
|
||||
changeFileExt(file, "").replace(dotdotMangle, "..")
|
||||
changeFileExt(file, "").replace("_._", "..")
|
||||
|
||||
proc init(p: var CodeBlockParams) =
|
||||
## Default initialisation of CodeBlockParams to sane values.
|
||||
@@ -759,13 +758,13 @@ proc renderHeadline(d: PDoc, n: PRstNode, result: var string) =
|
||||
# Generate index entry using spaces to indicate TOC level for the output HTML.
|
||||
assert n.level >= 0
|
||||
let
|
||||
htmlFileRelPath = if d.outDir.isEmpty():
|
||||
htmlFileRelPath = if d.outDir.len == 0:
|
||||
# /foo/bar/zoo.nim -> zoo.html
|
||||
changeFileExt(extractFilename(d.filename), HtmlExt)
|
||||
else: # d is initialized in docgen.nim
|
||||
# outDir = /foo -\
|
||||
# destFile = /foo/bar/zoo.html -|-> bar/zoo.html
|
||||
d.destFile.relativeTo(d.outDir, '/').string
|
||||
d.destFile.relativePath(d.outDir, '/')
|
||||
setIndexTerm(d, htmlFileRelPath, refname, tmp.stripTocHtml,
|
||||
spaces(max(0, n.level)) & tmp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user