Skip to content

Commit

Permalink
Auto-determine type in render_texample from file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Jun 9, 2024
1 parent 134d7ae commit 5d52347
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ function render_texample(CachedType, DocType, url)

end

function render_texample(url; assume = ".tex")
ext = splitext(url)
isempty(ext) && (ext = assume)
if ext == ".tex"
render_texample(CachedTeX, TeXDocument, url)
elseif ext == ".typst"
render_texample(CachedTypst, TypstDocument, url)
elseif ext == ".svg"
render_texample(CachedSVG, SVGDocument, url)
elseif ext == ".pdf"
render_texample(CachedPDF, PDFDocument, url)
else
error("Unknown file type: $ext")
end
end


include("tex.jl")
include("typst.jl")
Expand Down

0 comments on commit 5d52347

Please sign in to comment.