|
|
|
|
|
|
|
|
NORMALIZED_STRFTIME = "%Y-%m-%dT12:00:00+01:00" |
|
|
NORMALIZED_STRFTIME = "%Y-%m-%dT12:00:00+01:00" |
|
|
TODAY = datetime.today() + timedelta(hours=6) |
|
|
TODAY = datetime.today() + timedelta(hours=6) |
|
|
PUBLICATION_BUFFER = TODAY - timedelta(days=7) |
|
|
PUBLICATION_BUFFER = TODAY - timedelta(days=7) |
|
|
|
|
|
NB_ITEMS_IN_FEED = 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MarkParser(mistune.InlineParser): |
|
|
class MarkParser(mistune.InlineParser): |
|
|
|
|
|
|
|
|
def feed(): |
|
|
def feed(): |
|
|
"""Generate a feed from last published items.""" |
|
|
"""Generate a feed from last published items.""" |
|
|
template = environment.get_template("feed.xml") |
|
|
template = environment.get_template("feed.xml") |
|
|
|
|
|
page_list = Page.all(source=DAVID / "2021" / "sources", with_h2_anchors=False) |
|
|
content = template.render( |
|
|
content = template.render( |
|
|
page_list=Page.all(source=DAVID / "2021" / "sources", with_h2_anchors=False), |
|
|
|
|
|
|
|
|
page_list=page_list[:NB_ITEMS_IN_FEED], |
|
|
current_dt=TODAY.strftime(NORMALIZED_STRFTIME), |
|
|
current_dt=TODAY.strftime(NORMALIZED_STRFTIME), |
|
|
BASE_URL=f"{DOMAIN}/david/", |
|
|
BASE_URL=f"{DOMAIN}/david/", |
|
|
) |
|
|
) |