Skip to content

Commit 367775a

Browse files
authored
Merge pull request #71 from pyscript/pe-build-code
Missing build for author pages and bad relative links.
2 parents e31ee51 + 94b3571 commit 367775a

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/psc/__main__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def build() -> None: # pragma: no cover
9595
response = test_client.get("/gallery/index.html")
9696
assert response.status_code == 200
9797
html = response.text
98-
# output = public / "gallery/index.html"
9998
with open(public / "gallery/index.html", "w") as f:
10099
f.write(html)
101100

@@ -106,6 +105,22 @@ def build() -> None: # pragma: no cover
106105
output = public / f"pages/{page.name}.html"
107106
output.write_text(response.text)
108107

108+
# Now for authors and each author
109+
response = test_client.get("/authors/index.html")
110+
assert response.status_code == 200
111+
html = response.text
112+
with open(public / "gallery/authors/index.html", "w") as f:
113+
f.write(html)
114+
for author in resources.authors.values():
115+
response = test_client.get(f"/authors/{author.name}.html")
116+
output = public / f"gallery/authors/{author.name}.html"
117+
output.write_text(response.text)
118+
119+
for page in resources.pages.values():
120+
response = test_client.get(f"/pages/{page.name}.html")
121+
output = public / f"pages/{page.name}.html"
122+
output.write_text(response.text)
123+
109124
# And for each example
110125
for example in resources.examples.values():
111126
url = f"/gallery/examples/{example.name}/index.html"

src/psc/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async def gallery(request: Request) -> _TemplateResponse:
6666
async def authors(request: Request) -> _TemplateResponse:
6767
"""Handle the author listing page."""
6868
these_authors: Iterator[Example] = request.app.state.resources.authors.values()
69-
root_path = ".."
69+
root_path = "../.."
7070

7171
return templates.TemplateResponse(
7272
"authors.jinja2",

src/psc/templates/authors.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="tile is-parent is-4">
1717
<article class="tile is-child box">
1818
<p class="title"><a
19-
href="{{ root_path }}/authors/{{ author.name }}.html/">{{ author.title }}</a>
19+
href="{{ root_path }}/gallery/authors/{{ author.name }}.html">{{ author.title }}</a>
2020
</p>
2121
<div class="content">
2222
{{ author.body | safe }}

src/psc/templates/layout.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<a id="navbarGallery" class="navbar-item" href="{{ root_path }}/gallery">
2727
Gallery
2828
</a>
29-
<a id="navbarAuthors" class="navbar-item" href="{{ root_path }}/authors">
29+
<a id="navbarAuthors" class="navbar-item" href="{{ root_path }}/gallery/authors">
3030
Authors
3131
</a>
3232
<a id="navbarJoin" class="navbar-item" href="{{ root_path }}/pages/contributing.html">

0 commit comments

Comments
 (0)