Fix handling of \r #72

pull/74/head
Matti Pastell 2016-12-22 21:40:07 +02:00
parent 57629c1547
commit a2b63b8f07
2 changed files with 5 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text eol=lf

View File

@ -47,6 +47,7 @@ end
function read_doc(source::AbstractString, format=:auto)
format == :auto && (format = detect_informat(source))
document = readstring(source)
document = replace(document, "\r\n", "\n")
parsed = parse_doc(document, format)
header = parse_header(parsed[1])
doc = WeaveDoc(source, parsed, header)
@ -73,6 +74,7 @@ end
"""Parse documents with Weave.jl markup"""
function parse_doc(document::AbstractString, format::MarkupInput)
document = replace(document, "\r\n", "\n")
lines = split(document, "\n")
codestart = format.codestart
@ -151,6 +153,7 @@ end
"""Parse .jl scripts with Weave.jl markup"""
function parse_doc(document::AbstractString, format::ScriptInput)
document = replace(document, "\r\n", "\n")
lines = split(document, "\n")
doc_line = format.doc_line
@ -250,6 +253,7 @@ end
"""Parse IJUlia notebook"""
function parse_doc(document::String, format::NotebookInput)
document = replace(document, "\r\n", "\n")
nb = JSON.parse(document)
parsed = Any[]
options = Dict{Symbol,Any}()