Filenames with spaces; output beside the input file; warning fixes (from dev c08eb1bbfa4c)

- Filenames may contain spaces: quote on the command line; filename
  lists use a standalone "/" separator; unseparated names that do not
  exist are rejoined into names that do (announced); leading ~ expands.
- Without -o, output is written to the input file's directory; -o fully
  specifies the output directory and basename.
- "Word not parsed" warnings now appear without -v, only for text that
  survives removal, with correct line numbers.
- New tst/filename_test.sh regression suite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 23:22:59 +02:00
parent d9c98ac86d
commit fd9a370af7
21 changed files with 430 additions and 34 deletions

View File

@@ -31,7 +31,7 @@ class Image(klammer_base.Klammer_base):
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: File "{self.K_input_filenames}" not found'
self.file_error_message = f'\nERROR: File "{self.K_input_filename}" not found'
self.as_string = as_string
if width:
self.width = width
@@ -42,7 +42,7 @@ class Image(klammer_base.Klammer_base):
self.rel_fraction = self.pwidth / self.rel_pwidth
if self.file_error:
self.file_error_message = f'\nERROR: File "{self.K_input_filenames}" not found'
self.file_error_message = f'\nERROR: File "{self.K_input_filename}" not found'
def html(self):
img_dir = f"{self.K_output_dir}/{self.K_output_basename}/{self.Image_output_dir}"

View File

@@ -22,7 +22,7 @@ class Kargs:
self.number = K.cell_number
self.hpos = "none"
self.K_target = target
self.K_input_filenames = K.K_input_filenames
self.K_input_dir = K.K_input_dir
self.K_output_dir = K.K_output_dir
self.K_output_basename = K.K_output_basename
self.Image_output_dir = K.Image_output_dir
@@ -57,7 +57,7 @@ class Image_grid(klammer_base.Klammer_base):
self.basenames.append([e[0] for e in self.images[-1]])
self.captions.append([e[1] for e in self.images[-1]])
self.cache = image_cache.Image_cache(
os.path.dirname(os.path.abspath(self.K_input_filenames)),
self.K_input_dir,
self.Image_search_path,
verbose=False)