Commit a1aa938d authored by Romain Casati's avatar Romain Casati
Browse files

Use of pathlib in pelicanconf.py instead of os.path.

parent 3cd92445
#!/usr/bin/env python3
import urllib
import os
from pathlib import Path
AUTHOR = 'Romain Casati'
SITENAME = 'Basthon'
......@@ -66,7 +66,7 @@ def galerie(*args):
</div>"""
def url(file, aux):
url = os.path.join("examples", file)
url = Path("examples") / file
domain = 'console' if file.endswith('.py') else 'notebook'
url = "https://{}.basthon.fr/?from={}".format(domain, urllib.parse.quote(url))
if aux is not None:
......@@ -74,7 +74,7 @@ def galerie(*args):
return url
return "".join(one_img.format(SITEURL=SITEURL,
img_name='{}.png'.format(os.path.splitext(file)[0]),
img_name='{}.png'.format(Path(file).with_suffix('')),
description=data['desc'],
url=url(file, data.get('aux')))
for file, data in examples.items())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment