Skip to content

Commit

Permalink
infra/gen-view: Solve links for tasks and guides
Browse files Browse the repository at this point in the history
Relative links were checked only for questions, reading, and media
files. Handle tasks and guides in a similar way.

Signed-off-by: Alex Apostolescu <[email protected]>
  • Loading branch information
Alex-deVis authored and teodutu committed Oct 27, 2024
1 parent 6616c8b commit 5c44dfa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gen-view.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def solve_links(text: str, fileToLab: dict) -> str:
# Questions from the same chapter are at Questions/<question>, without the .md extension
text = re.sub(r"(\[.*\])\(.*questions/(.*)\.md\)", r"\1(Questions/\2)", text)

# Tasks links should be routed to [text](./tasks/<file>)
text = re.sub(r"(\[.*\])\(.*tasks/(.*)\)", r"\1(./tasks/\2)", text)

# Guides links should be routed to [text](./guides/<file>)
text = re.sub(r"(\[.*\])\(.*guides/(.*)\)", r"\1(./guides/\2)", text)

# Reading links [text](.*/reading/<file>.md) should be replaced with [text](.view/labQ#<chapter>)
# Where Q is the lab number and chapter is the heading of the file
matches = re.findall(r"\[.*\]\(.*reading/(.*\.md)\)", text)
Expand Down

0 comments on commit 5c44dfa

Please sign in to comment.