Skip to content

Commit 8cd5310

Browse files
committed
simplify markdown by defining IOBuffer for SubString
1 parent f70f685 commit 8cd5310

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Diff for: base/markdown/GitHub/GitHub.jl

+1-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function github_table(stream::IO, md::MD, config::Config)
8989
end
9090

9191
elseif n == 1 || length(rows[1]) == length(row)
92-
push!(rows, Row(map(x -> parseinline(IOBuffer(_full(x)), config), row)))
92+
push!(rows, Row(map(x -> parseinline(IOBuffer(x), config), row)))
9393
elseif length(row) > 1
9494
seek(stream, pos)
9595
break
@@ -107,9 +107,6 @@ function github_table(stream::IO, md::MD, config::Config)
107107
end
108108
end
109109

110-
_full{T}(s::SubString{T}) = convert(T, s)
111-
_full(s::AbstractString) = s
112-
113110
@flavor github [list, indentcode, blockquote, fencedcode, hashheader,
114111
github_paragraph, github_table,
115112
en_dash, inline_code, asterisk_bold, asterisk_italic, image, link]

Diff for: base/string.jl

+2
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ write{T<:ByteString}(to::IOBuffer, s::SubString{T}) =
588588
s.endof==0 ? 0 : write_sub(to, s.string.data, s.offset+1, next(s,s.endof)[2]-1)
589589
print(io::IOBuffer, s::SubString) = write(io, s)
590590

591+
IOBuffer(s::SubString) = IOBuffer(s.string.data[s.offset:s.endof], true, false)
592+
591593
sizeof(s::SubString{ASCIIString}) = s.endof
592594
sizeof(s::SubString{UTF8String}) = s.endof == 0 ? 0 : next(s,s.endof)[2]-1
593595

0 commit comments

Comments
 (0)