diff options
Diffstat (limited to 'lib/packages/docutils/rstgen.nim')
-rw-r--r-- | lib/packages/docutils/rstgen.nim | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim index ec9926863..008dff60a 100644 --- a/lib/packages/docutils/rstgen.nim +++ b/lib/packages/docutils/rstgen.nim @@ -591,16 +591,11 @@ proc readIndexDir*(dir: string): if path.endsWith(IndexExt): var (fileEntries, title) = parseIdxFile(path) # Depending on type add this to the list of symbols or table of APIs. - if title.kind in {ieNimTitle, ieIdxRole}: + + if title.kind == ieNimTitle: for i in 0 ..< fileEntries.len: - if title.kind == ieIdxRole: - # Don't add to symbols TOC entries (they start with a whitespace). - let toc = fileEntries[i].linkTitle - if toc.len > 0 and toc[0] == ' ': - continue - else: - if fileEntries[i].kind != ieNim: - continue + if fileEntries[i].kind != ieNim: + continue # Ok, non TOC entry, add it. setLen(result.symbols, L + 1) result.symbols[L] = fileEntries[i] @@ -618,6 +613,14 @@ proc readIndexDir*(dir: string): title.aux = "doc_toc_" & $result.docs.len result.docs[title] = fileEntries + for i in 0 ..< fileEntries.len: + if fileEntries[i].kind != ieIdxRole: + continue + + setLen(result.symbols, L + 1) + result.symbols[L] = fileEntries[i] + inc L + proc mergeIndexes*(dir: string): string = ## Merges all index files in `dir` and returns the generated index as HTML. ## |