Images: a PDF figure finds poppler, the lookup admits image files only, a missing image is an error

Assembled from development commit 8ed24ef03b36. Since ee8bcf5: a PDF file used
as an image finds poppler's pdfinfo and pdftoppm on the PATH instead of
/usr/bin, and says which package to install when they are missing (the
Linux, macOS and Windows pages name it); the image lookup considers
image files only, so a source or log file beside a figure is never taken
for it; and an @image whose file cannot be found is an error naming the
basename and the search path, instead of a silent red placeholder. Two
test suites that had relied on that placeholder now supply a real image;
a new suite covers the PDF figure.
This commit is contained in:
ack committed 2026-09-25 21:11:33 +02:00
1 parent ee8bcf5300
commit 1b00738654
7 files changed
+79 -43

No files matched your search

+2 -12
View File
@@ -29,21 +29,16 @@ class Image(klammer_base.Klammer_base):
self.cache = image_cache.Image_cache(cache_dir, self.Image_search_path, verbose=False,
quality=self.Image_quality)
self.basename = klammer_base.unescape_ktesc(self.basename)
self.source, self.pwidth, self.pheight, self.file_error = self.cache.get(self.K_target, self.basename)
if self.file_error:
self.file_error_message = f'\nERROR: Image "{self.basename}" not found'
self.source, self.pwidth, self.pheight = self.cache.get(self.K_target, self.basename)
self.as_string = as_string
if width:
self.width = width
self.rel_image = None
self.rel_fraction = 1.0
if self.rel:
self.rel_image, self.rel_pwidth, self.rel_pheight, self.file_error = self.cache.get(self.K_target, self.rel)
self.rel_image, self.rel_pwidth, self.rel_pheight = self.cache.get(self.K_target, self.rel)
self.rel_fraction = self.pwidth / self.rel_pwidth
if self.file_error:
self.file_error_message = f'\nERROR: Image "{self.rel}" (the :rel image) not found'
def html(self):
img_dir = f"{self.K_output_dir}/{self.K_output_basename}/{self.Image_output_dir}"
@@ -76,9 +71,6 @@ class Image(klammer_base.Klammer_base):
if self.border:
result.cls("image_border")
if self.file_error:
self.caption += self.file_error_message
result = html_util.add_caption(
result, "Figure", self.number, self.caption, self.caption_style,
self.hpos, self.caption_side, False, self.caption_size,
@@ -101,8 +93,6 @@ class Image(klammer_base.Klammer_base):
#result = f'\\includegraphics[width={width}]{{{source}}}'
if self.number or self.caption:
result = f'\\includegraphics[width=\\textwidth]{{{source}}}'
if self.file_error:
self.caption += self.file_error_message
result = latex_util.add_caption(
result, "Figure", self.number, self.caption, width,
self.hpos, self.caption_side, offset=self.offset)