diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim index 418458e3c3d4b..135524e5ba643 100644 --- a/lib/packages/docutils/rst.nim +++ b/lib/packages/docutils/rst.nim @@ -1444,11 +1444,8 @@ proc countTitles(p: var RstParser, n: PRstNode) = if p.s.hTitleCnt >= 2: break -proc tokenAfterNewline(p: RstParser, start = -1): int = - if start == -1: - result = p.idx - else: - result = start +proc tokenAfterNewline(p: RstParser, start: int): int = + result = start while true: case p.tok[result].kind of tkEof: @@ -1458,6 +1455,9 @@ proc tokenAfterNewline(p: RstParser, start = -1): int = break else: inc result +proc tokenAfterNewline(p: RstParser): int {.inline.} = + result = tokenAfterNewline(p, p.idx) + proc isAdornmentHeadline(p: RstParser, adornmentIdx: int): bool = ## check that underline/overline length is enough for the heading. ## No support for Unicode. diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 42d39e4edd4e3..6ec6234555b2f 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -1455,7 +1455,7 @@ since (1, 3): func dedent*(s: string, count: Natural): string {.rtl, extern: "nsuDedent".} = unindent(s, count, " ") - proc dedent*(a: string): string = + proc dedent*(a: string): string {.inline.} = ## Unindents each line in `s` by `count` amount of `padding`. ## The only difference between this and the ## `unindent func<#unindent,string,Natural,string>`_ is that this by default @@ -1478,9 +1478,7 @@ since (1, 3): """.dedent() doAssert x == "Hello\n There\n" - let b = a - let i = indentation(b) - dedent(a, i) + dedent(a, indentation(a)) func delete*(s: var string, first, last: int) {.rtl, extern: "nsuDelete".} = ## Deletes in `s` (must be declared as `var`) the characters at positions