Browse Source

Fix invalid string that should have been s_str. (#76)

pull/77/head
Fredrik Ekre 6 years ago committed by GitHub
parent
commit
d141df42f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Literate.jl
  2. 12
      test/runtests.jl

2
src/Literate.jl

@ -65,7 +65,7 @@ function parse(content; allow_continued = true) @@ -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

12
test/runtests.jl

@ -100,6 +100,14 @@ end @@ -100,6 +100,14 @@ end
#
#-
#
#-
## Line 73
##
## Line 75
#-
## Line 77
##
## Line 79
"""
expected_chunks = Chunk[
MDChunk(["" => "Line 1"]),
@ -134,7 +142,9 @@ end @@ -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)

Loading…
Cancel
Save