Skip to content

Commit 20a4971

Browse files
committed
Fix failure with Windows newlines
Fixes #16
1 parent a9d6b6f commit 20a4971

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/docopt.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ proc extras(help: bool, version: string, options: seq[Pattern], doc: string) =
568568

569569
proc docopt_exc(doc: string, argv: seq[string], help: bool, version: string,
570570
options_first = false): Table[string, Value] =
571+
var doc = doc.replace("\r\l", "\l")
571572

572573
var argv = (if argv.is_nil: command_line_params() else: argv)
573574

test/test.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ for each_line in (tests & "\n\n").split_lines():
4646
doc = ""
4747
line = line.substr(4)
4848
if in_doc:
49-
doc &= line & "\n"
49+
doc &= line
5050
if line.ends_with("\"\"\""):
51-
doc = doc[0 .. doc.len-5]
51+
doc = doc[0 .. doc.len-4]
5252
in_doc = false
53+
doc &= "\n"
5354
elif line.starts_with("$ prog"):
5455
assert args == nil and expected == nil
5556
args = line.substr(7)

0 commit comments

Comments
 (0)