Skip to content

Commit 76a2357

Browse files
committed
Fixes path in quarto output
1 parent 2e7ce30 commit 76a2357

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

_extensions/imagify/imagify.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,14 @@ local function latexToImage(source, renderOptions)
904904
or filterOptions.extensionForOutput.default
905905
local lazy = filterOptions.lazy
906906
local embed = renderOptions.embed
907-
and ext == 'svg' and (FORMAT:match('html') or FORMAT:match('revealjs')) and true
907+
and ext == 'svg' and FORMAT:match('html') and true
908908
or false
909909
local pdf_engine = renderOptions.pdf_engine or 'latex'
910910
local latex_out_format = ext == 'svg' and 'dvi' or 'pdf'
911911
local debug = renderOptions.debug or false
912912
local folder = filterOptions.output_folder or ''
913913
local jobOutFolder = makeAbsolute(PANDOC_STATE.output_file
914+
and path.directory(PANDOC_STATE.output_file) ~= '.'
914915
and path.directory(PANDOC_STATE.output_file) or '')
915916
local texinputs = renderOptions.texinputs or nil
916917
-- to be created

example-pandoc/expected.html

+9-12
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,24 @@
169169
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
170170
</style>
171171

172-
<!--[if lt IE 9]>
173-
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
174-
<![endif]-->
175172
</head>
176173
<body>
177174
<header id="title-block-header">
178175
<h1 class="title">Imagify Example</h1>
179176
<p class="author">Julien Dutant</p>
180177
</header>
181178
<p>Imagify the following span: <span class="imagify">the formula <img
182-
src="/Users/julien/GitHub/imagify/_imagify_files/91e2dfd01db343f1441a474edd794ba084f1eeff.svg"
179+
src="/Users/julien/GitHub/imagify/_imagify_files/a7943bb7b37c0609cb3f2dc3ea1df7a8eb18c0da.svg"
183180
title="E = mc^2" style="vertical-align: baseline; " /></span>.</p>
184181
<div class="imagify">
185182
<p>For some inline formulas, such as <img
186-
src="/Users/julien/GitHub/imagify/_imagify_files/efdef70511006e9c768b4e426005a4e4e44fc11a.svg"
183+
src="/Users/julien/GitHub/imagify/_imagify_files/10a167e5c8ab6fafe4ffb2f317e609ef0e7edf4a.svg"
187184
title="x=\frac{-b\pm\sqrt[]{b^2-4ac}}{2a}"
188185
style="vertical-align: baseline; " />, the default <code>baseline</code>
189186
vertical alignment is not ideal. You can adjust it manually, using a
190187
negative value to lower the image below the baseline: <span
191188
class="imagify" data-vertical-align="-.5em"><img
192-
src="/Users/julien/GitHub/imagify/_imagify_files/efdef70511006e9c768b4e426005a4e4e44fc11a.svg"
189+
src="/Users/julien/GitHub/imagify/_imagify_files/10a167e5c8ab6fafe4ffb2f317e609ef0e7edf4a.svg"
193190
title="x=\frac{-b\pm\sqrt[]{b^2-4ac}}{2a}"
194191
style="vertical-align: -.5em; " /></span>. In this case, I’ve specified
195192
a <code>-0.5em</code> value, which is about half a baseline down.</p>
@@ -200,12 +197,12 @@ <h1 class="title">Imagify Example</h1>
200197
<p>The display formula below is not explicitly marked to be imagified.
201198
However, it will be imagified in the filter’s <code>scope</code> option
202199
is set to <code>all</code>: <img
203-
src="/Users/julien/GitHub/imagify/_imagify_files/256555451568c56245dcd5561d969b842210d9fc.svg"
200+
src="/Users/julien/GitHub/imagify/_imagify_files/7ec773f044030097c522e097ba5e42ba72207263.svg"
204201
title="P = \frac{T}{V}" style="display:block; margin: .5em auto;" /></p>
205202
<div class="highlightme" data-zoom="1">
206203
<p>This next formula is imagified with options provided for elements of
207204
a custom class, <code>highlightme</code>: <img
208-
src="/Users/julien/GitHub/imagify/_imagify_files/3a5f3af70938265c12aa0a87ca10cc63019e502f.svg"
205+
src="/Users/julien/GitHub/imagify/_imagify_files/65f6707fedb9f7257958fa6cb875cb33675528e0.svg"
209206
title="P = \frac{T}{V}" style="border: 1px solid red;" />. They display
210207
the formula as an inline instead of a block and add a red border. They
211208
also specify a large zoom (4) but we’ve overridden it and locally
@@ -217,7 +214,7 @@ <h1 class="title">Imagify Example</h1>
217214
conversion to SVG, the required <code>dvisvgm</code> option is set
218215
too:</p>
219216
<p><img
220-
src="/Users/julien/GitHub/imagify/_imagify_files/d0b91856bbbb7c4544b19c3b48e2331109cabbbc.svg"
217+
src="/Users/julien/GitHub/imagify/_imagify_files/6c097721def3a2ce7b0ba051416d8a517eced4b6.svg"
221218
title="\usetikzlibrary{intersections}
222219
\begin{tikzpicture}[scale=3,line cap=round,
223220
% Styles
@@ -259,14 +256,14 @@ <h1 class="title">Imagify Example</h1>
259256
cross-referencable figures with Pandoc-Crossref and Quarto.</p>
260257
<figure>
261258
<img
262-
src="/Users/julien/GitHub/imagify/_imagify_files/b7638b60066851770d9e93c88f828891631fe9de.svg"
259+
src="/Users/julien/GitHub/imagify/_imagify_files/7134307ba006a4062cb95b026c323dcbfb1b1e25.svg"
263260
alt="Figure 1 is a separate TikZ file" />
264261
<figcaption aria-hidden="true">Figure 1 is a separate TikZ
265262
file</figcaption>
266263
</figure>
267264
<figure>
268265
<img
269-
src="/Users/julien/GitHub/imagify/_imagify_files/b7daf3268abf7336be583ef90bd6f512a0568068.svg"
266+
src="/Users/julien/GitHub/imagify/_imagify_files/873fc6284857dadbaf5aa8087db63a8da66c898a.svg"
270267
alt="Figure 2 is a separate LaTeX file" />
271268
<figcaption aria-hidden="true">Figure 2 is a separate LaTeX
272269
file</figcaption>
@@ -281,7 +278,7 @@ <h1 class="title">Imagify Example</h1>
281278
folder, here <code>fitch.sty</code> (a package not available on
282279
CTAN):</p>
283280
<p><img
284-
src="/Users/julien/GitHub/imagify/_imagify_files/4af68d35a503970cd2da8198ef155adca25a60e8.svg"
281+
src="/Users/julien/GitHub/imagify/_imagify_files/47806da0a2bc9008bd5e627be550a2878b685a31.svg"
285282
title="\begin{nd}
286283
\hypo[~] {1} {A \lor B}
287284
\open

src/main.lua

+1
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ local function latexToImage(source, renderOptions)
696696
local debug = renderOptions.debug or false
697697
local folder = filterOptions.output_folder or ''
698698
local jobOutFolder = makeAbsolute(PANDOC_STATE.output_file
699+
and path.directory(PANDOC_STATE.output_file) ~= '.'
699700
and path.directory(PANDOC_STATE.output_file) or '')
700701
local texinputs = renderOptions.texinputs or nil
701702
-- to be created

0 commit comments

Comments
 (0)