Reformate le code
This commit is contained in:
18
blog/blog.py
18
blog/blog.py
@@ -7,6 +7,7 @@ from blog.page import Page
|
|||||||
from blog.config import Config
|
from blog.config import Config
|
||||||
from jinja2 import Environment, FileSystemLoader, Template
|
from jinja2 import Environment, FileSystemLoader, Template
|
||||||
|
|
||||||
|
|
||||||
class Blog:
|
class Blog:
|
||||||
|
|
||||||
def __init__(self, conf: Config):
|
def __init__(self, conf: Config):
|
||||||
@@ -69,7 +70,8 @@ class Blog:
|
|||||||
if updated < date:
|
if updated < date:
|
||||||
updated = date
|
updated = date
|
||||||
articles += textwrap.indent(
|
articles += textwrap.indent(
|
||||||
textwrap.dedent(f"""\
|
textwrap.dedent(
|
||||||
|
f"""\
|
||||||
<entry>
|
<entry>
|
||||||
<title>{self.pages[filename].title}</title>
|
<title>{self.pages[filename].title}</title>
|
||||||
<link href="{self.conf.url}/pages/{filename}.html"/>
|
<link href="{self.conf.url}/pages/{filename}.html"/>
|
||||||
@@ -81,10 +83,13 @@ class Blog:
|
|||||||
</div>
|
</div>
|
||||||
</content>
|
</content>
|
||||||
</entry>
|
</entry>
|
||||||
"""),
|
"""
|
||||||
" ")
|
),
|
||||||
|
" ",
|
||||||
|
)
|
||||||
|
|
||||||
header = textwrap.dedent(f""" <?xml version="1.0" encoding="utf-8"?>
|
header = textwrap.dedent(
|
||||||
|
f""" <?xml version="1.0" encoding="utf-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<title>{self.conf.title}</title>
|
<title>{self.conf.title}</title>
|
||||||
<subtitle>{self.conf.presentation}</subtitle>
|
<subtitle>{self.conf.presentation}</subtitle>
|
||||||
@@ -96,11 +101,12 @@ class Blog:
|
|||||||
<email>{self.conf.author_mail}</email>
|
<email>{self.conf.author_mail}</email>
|
||||||
</author>
|
</author>
|
||||||
<id>urn:uuid:{self.conf.id}</id>
|
<id>urn:uuid:{self.conf.id}</id>
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
footer = "</feed>"
|
footer = "</feed>"
|
||||||
|
|
||||||
with open(Path(self.conf.outbox) / "atom.xml", 'w+') as rss_file:
|
with open(Path(self.conf.outbox) / "atom.xml", "w+") as rss_file:
|
||||||
rss_file.write(header + articles + footer)
|
rss_file.write(header + articles + footer)
|
||||||
|
|
||||||
def _copy_css(self):
|
def _copy_css(self):
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Config:
|
|||||||
"draft",
|
"draft",
|
||||||
"author_name",
|
"author_name",
|
||||||
"author_mail",
|
"author_mail",
|
||||||
"id"
|
"id",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config_file: Path):
|
def __init__(self, config_file: Path):
|
||||||
|
|||||||
Reference in New Issue
Block a user