|
|
|
|
|
|
|
|
HERE = Path(".") |
|
|
HERE = Path(".") |
|
|
DAVID = HERE / "david" |
|
|
DAVID = HERE / "david" |
|
|
DOMAIN = "https://larlet.fr" |
|
|
DOMAIN = "https://larlet.fr" |
|
|
|
|
|
LOCAL_DOMAIN = "http://larlet.test:3579" |
|
|
# Hardcoding publication at 12 in Paris timezone. |
|
|
# Hardcoding publication at 12 in Paris timezone. |
|
|
NORMALIZED_STRFTIME = "%Y-%m-%dT12:00:00+01:00" |
|
|
NORMALIZED_STRFTIME = "%Y-%m-%dT12:00:00+01:00" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
root_path = DAVID / "2020" |
|
|
root_path = DAVID / "2020" |
|
|
for previous, page, next_ in neighborhood( |
|
|
for previous, page, next_ in neighborhood( |
|
|
reversed(Page.all(source=root_path, only_published=False)), |
|
|
reversed(Page.all(source=root_path, only_published=False)), |
|
|
first={"url": "/david/stream/", "title": "Streams 2009-2019"}, |
|
|
|
|
|
|
|
|
first={ |
|
|
|
|
|
"url": "/david/stream/", |
|
|
|
|
|
"title": "Streams 2009-2019", |
|
|
|
|
|
"is_draft": False, |
|
|
|
|
|
}, |
|
|
): |
|
|
): |
|
|
template = environment.get_template("article_2020.html") |
|
|
template = environment.get_template("article_2020.html") |
|
|
content = template.render(page=page, prev=previous, next=next_,) |
|
|
content = template.render(page=page, prev=previous, next=next_,) |
|
|
target_path = Path(page.url[1:]) |
|
|
target_path = Path(page.url[1:]) |
|
|
target_path.mkdir(parents=True, exist_ok=True) |
|
|
target_path.mkdir(parents=True, exist_ok=True) |
|
|
open(target_path / "index.html", "w").write(content) |
|
|
open(target_path / "index.html", "w").write(content) |
|
|
|
|
|
if page.is_draft: |
|
|
|
|
|
print(f"Draft: {LOCAL_DOMAIN}{page.url} ({page.title})") |
|
|
template = environment.get_template("archives_2020.html") |
|
|
template = environment.get_template("archives_2020.html") |
|
|
content = template.render(page_list=Page.all(source=root_path)) |
|
|
content = template.render(page_list=Page.all(source=root_path)) |
|
|
open(root_path / "index.html", "w").write(content) |
|
|
open(root_path / "index.html", "w").write(content) |