Skip to content

Commit

Permalink
infra/gen-view: Fix questions links to media
Browse files Browse the repository at this point in the history
Questons are media files are placed in directories on their own, on the
same level.
This commit accounts for this when generating the .view files, and
prepends '../' to media links in question files.

Signed-off-by: Alex Apostolescu <[email protected]>
  • Loading branch information
Alex-deVis committed Nov 8, 2024
1 parent 9d147e3 commit d5907ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gen-view.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def solve_links(filename: str, fileToLab: dict) -> str:

# Remove relative links to reading, media, tasks, and guides
for section in ["reading", "media", "tasks", "guides"]:
# Questions are placed in a directory of their own, just like media, so we need to go up one level
if "questions" in filename and section == "media":
section = "../" + section
text = re.sub(
r"(\[.*\])\(.*" + section + r"/(.*)\)", rf"\1({section}/\2)", text
)
Expand Down

0 comments on commit d5907ce

Please sign in to comment.