From 469e6fe7294ac99c46e7761b475f2f4384ec9923 Mon Sep 17 00:00:00 2001 From: Thibaut Lienart Date: Wed, 11 May 2022 16:46:33 +0200 Subject: [PATCH] changes in line with #956 --- Project.toml | 2 +- src/converter/latex/io.jl | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 49153a4b1..af56394e8 100644 --- a/Project.toml +++ b/Project.toml @@ -27,7 +27,7 @@ ExprTools = "0.1" FranklinTemplates = "0.8.16" HTTP = "0.8, 0.9" Literate = "2.9" -LiveServer = "0.4, 0.5, 0.6, 0.7" +LiveServer = "0.4, 0.5, 0.6, 0.7, 0.8" NodeJS = "0.6, 1" OrderedCollections = "1" TOML = "1.0" diff --git a/src/converter/latex/io.jl b/src/converter/latex/io.jl index ecda96ee2..122164575 100644 --- a/src/converter/latex/io.jl +++ b/src/converter/latex/io.jl @@ -148,6 +148,7 @@ Resolve a `\\figalt{alt}{rpath}` (find a fig and include it with alt). function lx_figalt(lxc::LxCom, _) rpath = stent(lxc.braces[2]) alt = stent(lxc.braces[1]) + # unix path relative to the root folder path = parse_rpath(rpath; canonical=false, code=true) fdir, fext = splitext(path) # there are several cases @@ -160,16 +161,19 @@ function lx_figalt(lxc::LxCom, _) (".png", ".jpeg", ".jpg", ".svg", ".gif", ".json"), (fext,)) for ext ∈ candext candpath = fdir * ext - syspath = joinpath(PATHS[:site], split(candpath, PATH_SEP)...) + syspath = joinpath(PATHS[:site], split(candpath, "/")...) isfile(syspath) && return ext == ".json" ? html_plotly(candpath) : html_img(candpath, alt) end # now try in the output dir just in case (provided we weren't already - # looking there) - p1, p2 = splitdir(fdir) - if splitdir(p1)[2] != "output" + # looking there) the dir split is "/" + ps = split(fdir, "/", keepempty=false) + if ps[end-1] != "output" for ext ∈ candext - candpath = joinpath(p1, "output", p2 * ext) - syspath = joinpath(PATHS[:site], split(candpath, PATH_SEP)...) + candpath = "/" * join([ps[1:end-1]..., "output", ps[end] * ext], "/") + syspath = joinpath( + PATHS[:site], + split(candpath, "/")... + ) isfile(syspath) && return ext == ".json" ? html_plotly(candpath) : html_img(candpath, alt) end end