navigate_results: centered when only 1 result

This commit is contained in:
Salvador E. Tropea 2022-05-29 15:05:49 -03:00
parent 1b318f0da4
commit 6611925c17
1 changed files with 17 additions and 11 deletions

View File

@ -209,17 +209,23 @@ class Navigate_ResultsOptions(BaseOptions):
config_output(out) config_output(out)
out_dir = get_output_dir(out.dir, out, dry=True) out_dir = get_output_dir(out.dir, out, dry=True)
f.write('<tbody><tr>\n') f.write('<tbody><tr>\n')
c = 0 targets = out.get_targets(out_dir)
for tg in out.get_targets(out_dir): if len(targets) == 1:
if c == OUT_COLS: tg = os.path.relpath(os.path.abspath(targets[0]), start=self.out_dir)
f.write('</tr>\n<tr>\n') f.write('<td class="out-cell" colspan="{}"><a href="{}">{}</a></td>\n'.
c = 0 format(OUT_COLS, tg, self.get_image_for_file(os.path.basename(tg))))
tg = os.path.relpath(os.path.abspath(tg), start=self.out_dir) else:
f.write('<td class="out-cell"><a href="{}">{}</a></td>\n'. c = 0
format(tg, self.get_image_for_file(os.path.basename(tg)))) for tg in targets:
c = c+1 if c == OUT_COLS:
for _ in range(c, OUT_COLS): f.write('</tr>\n<tr>\n')
f.write('<td class="out-cell"></td>\n') c = 0
tg = os.path.relpath(os.path.abspath(tg), start=self.out_dir)
f.write('<td class="out-cell"><a href="{}">{}</a></td>\n'.
format(tg, self.get_image_for_file(os.path.basename(tg))))
c = c+1
for _ in range(c, OUT_COLS):
f.write('<td class="out-cell"></td>\n')
f.write('</tr></tbody>\n') f.write('</tr></tbody>\n')
f.write('</table>\n') f.write('</table>\n')
self.add_back_home(f, prev) self.add_back_home(f, prev)