mollusk 019f8e3064 Add: julia-0.6.2
Former-commit-id: ccc667cf67d569f3fb3df39aa57c2134755a7551
2018-02-10 10:27:19 -07:00

36 lines
896 B
Julia

# This file is a part of Julia. License is MIT: https://julialang.org/license
mutable struct LaTeX
formula::String
end
@trigger '$' ->
function tex(stream::IO, md::MD)
result = parse_inline_wrapper(stream, "\$", rep = true)
return result === nothing ? nothing : LaTeX(result)
end
function blocktex(stream::IO, md::MD)
withstream(stream) do
ex = tex(stream, md)
if ex nothing
return false
else
push!(md, ex)
return true
end
end
end
show(io::IO, tex::LaTeX) =
print(io, '$', tex.formula, '$')
latex(io::IO, tex::LaTeX) =
println(io, "\$\$", tex.formula, "\$\$")
latexinline(io::IO, tex::LaTeX) =
print(io, '$', tex.formula, '$')
term(io::IO, tex::LaTeX, cols) = println_with_format(:magenta, io, tex.formula)
terminline(io::IO, tex::LaTeX) = print_with_format(:magenta, io, tex.formula)