From d141df42f3ba533d4f7c8ee15134efd8055b880f Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 18 Sep 2019 10:35:17 +0200 Subject: [PATCH] Fix invalid string that should have been s_str. (#76) --- src/Literate.jl | 2 +- test/runtests.jl | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Literate.jl b/src/Literate.jl index 6f9adcb..a634fd2 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -65,7 +65,7 @@ function parse(content; allow_continued = true) push!(chunks, CodeChunk()) end # remove "## " and "##\n" - line = replace(replace(line, r"^(\h*)#(# .*)$" => s"\1\2"), r"^(\h*#)#$" => "\1") + line = replace(replace(line, r"^(\h*)#(# .*)$" => s"\1\2"), r"^(\h*#)#$" => s"\1") push!(chunks[end].lines, line) end end diff --git a/test/runtests.jl b/test/runtests.jl index 8e4ea38..357a343 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -100,6 +100,14 @@ end # #- # + #- + ## Line 73 + ## + ## Line 75 + #- + ## Line 77 + ## + ## Line 79 """ expected_chunks = Chunk[ MDChunk(["" => "Line 1"]), @@ -134,7 +142,9 @@ end MDChunk(["" => "Line 53"]), CodeChunk(["# Line 57", "Line 58", "# Line 59", "##Line 60"], false), MDChunk([" " => "Line 62", " " => "# Line 63"]), - CodeChunk(["Line 64", " # Line 65", " Line 66", "Line 67"], false) + CodeChunk(["Line 64", " # Line 65", " Line 66", "Line 67"], false), + CodeChunk(["# Line 73", "#", "# Line 75"], false), + CodeChunk([" # Line 77", " #", " # Line 79"], false), ] parsed_chunks = Literate.parse(content) compare_chunks(parsed_chunks, expected_chunks)