packages/docutils/rstidx

Source   Edit  

Nim idx file format related definitions.

Types

IndexEntry = object
  kind*: IndexEntryKind      ## 0.
  keyword*: string           ## 1.
  link*: string              ## 2.
  linkTitle*: string         ## 3. contains a prettier text for the href
  linkDesc*: string          ## 4. the title attribute of the final href
  line*: int                 ## 5.
  module*: string            ## origin file, NOT a field in ``.idx`` file
  aux*: string               ## auxuliary field, NOT a field in ``.idx`` file
  
Source   Edit  
IndexEntryKind = enum
  ieMarkupTitle = "markupTitle", ## RST/Markdown title, text in `keyword` +
                                  ## HTML text in `linkTitle`
  ieNimTitle = "nimTitle",  ## Nim title
  ieHeading = "heading",    ## RST/Markdown markup heading, escaped
  ieIdxRole = "idx",        ## RST :idx: definition, escaped
  ieNim = "nim",            ## Nim symbol, unescaped
  ieNimGroup = "nimgrp"      ## Nim overload group, unescaped
discriminator tag Source   Edit  

Procs

proc `$`(e: IndexEntry): string {....raises: [ValueError], tags: [], forbids: [].}
Source   Edit  
proc cmp(a, b: IndexEntry): int {....raises: [], tags: [], forbids: [].}
Sorts two IndexEntry first by keyword field, then by link. Source   Edit  
proc formatIndexEntry(kind: IndexEntryKind;
                      htmlFile, id, term, linkTitle, linkDesc: string; line: int): tuple[
    entry: string, isTitle: bool] {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc hash(x: IndexEntry): Hash {....raises: [], tags: [], forbids: [].}

Returns the hash for the combined fields of the type.

The hash is computed as the chained hash of the individual string hashes.

Source   Edit  
proc isDocumentationTitle(hyperlink: string): bool {....raises: [], tags: [],
    forbids: [].}

Returns true if the hyperlink is actually a documentation title.

Documentation titles lack the hash. See mergeIndexes() for a more detailed explanation.

Source   Edit  
proc parseIdxFile(path: string): tuple[fileEntries: seq[IndexEntry],
                                       title: IndexEntry] {.
    ...raises: [IOError, ValueError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc unquoteIndexColumn(text: string): string {....raises: [], tags: [],
    forbids: [].}
Returns the unquoted version generated by quoteIndexColumn. Source   Edit