Skip to content

Commit

Permalink
check warnings and errors in RST test (fix nim-lang#17280)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mr committed Mar 11, 2021
1 parent 6e11cb8 commit f9c427a
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 74 deletions.
4 changes: 2 additions & 2 deletions lib/packages/docutils/rst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
## .. _Sphinx directives: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html

import
os, strutils, rstast, algorithm, lists, sequtils
os, strutils, rstast, std/enumutils, algorithm, lists, sequtils

type
RstParseOption* = enum ## options for the RST parser
Expand Down Expand Up @@ -487,7 +487,7 @@ template nextTok(p: RstParser): Token = p.tok[p.idx + 1]

proc whichMsgClass*(k: MsgKind): MsgClass =
## returns which message class `k` belongs to.
case ($k)[1]
case k.symbolName[1]
of 'e', 'E': result = mcError
of 'w', 'W': result = mcWarning
of 'h', 'H': result = mcHint
Expand Down
8 changes: 4 additions & 4 deletions lib/packages/docutils/rstgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,8 @@ $content
# ---------- forum ---------------------------------------------------------

proc rstToHtml*(s: string, options: RstParseOptions,
config: StringTableRef): string =
config: StringTableRef,
msgHandler: MsgHandler = rst.defaultMsgHandler): string =
## Converts an input rst string into embeddable HTML.
##
## This convenience proc parses any input string using rst markup (it doesn't
Expand All @@ -1503,11 +1504,10 @@ proc rstToHtml*(s: string, options: RstParseOptions,

const filen = "input"
var d: RstGenerator
initRstGenerator(d, outHtml, config, filen, options, myFindFile,
rst.defaultMsgHandler)
initRstGenerator(d, outHtml, config, filen, options, myFindFile, msgHandler)
var dummyHasToc = false
var rst = rstParse(s, filen, line=LineRstInit, column=ColRstInit,
dummyHasToc, options)
dummyHasToc, options, myFindFile, msgHandler)
result = ""
renderRstToOut(d, rst, result)

Expand Down
Loading

0 comments on commit f9c427a

Please sign in to comment.