Skip to content

Commit

Permalink
Quote resource folder captions + fix ":resources:./"
Browse files Browse the repository at this point in the history
  • Loading branch information
pushfoo committed Oct 16, 2024
1 parent 6a65c12 commit 920f1ed
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions util/create_resources_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,20 @@ def process_resource_directory(out, dir: Path):
if num_files > 0:

# header_title = f":resources:{path.relative_to(RESOURCE_DIR).as_posix()}/"
header_title = create_resource_path(path, suffix="/")
if header_title == ":resources:images/":
raw_header = create_resource_path(path, suffix="/")
header_title = raw_header[:-2] if raw_header.endswith("./") else raw_header

if raw_header == ":resources:images/":
for f in file_list:
print(f.name)
# out.write(f"\n{header_title}\n")
# out.write("-" * (len(header_title)) + "\n\n")
n_cols = get_header_num_cols(header_title, num_files)

n_cols = get_header_num_cols(raw_header, num_files)
widths = get_column_widths_for_n(n_cols)

out.write(f"\n")
out.write(f".. list-table:: {header_title}\n")
out.write(f".. list-table:: \"{header_title}\"\n")
out.write(f" :widths: {widths}\n")
out.write(f" :header-rows: 0\n")
out.write(f" :class: resource-table\n\n")
Expand All @@ -156,6 +160,7 @@ def process_resource_files(out, file_list: List[Path]):
cell_count = 0

prefix = create_resource_path(file_list[0].parent, suffix="/")

COLUMNS = get_header_num_cols(prefix, len(file_list))

log.info(f"Processing {prefix=!r} with {COLUMNS=!r}")
Expand Down

0 comments on commit 920f1ed

Please sign in to comment.