Added sorting and basic refactoring
This commit is contained in:
parent
83a025e6b1
commit
4bba02ea2c
|
@ -39,7 +39,9 @@ def article_to_xml(article_path: pathlib.Path):
|
||||||
return base_item.format(tags="\n".join(tags))
|
return base_item.format(tags="\n".join(tags))
|
||||||
|
|
||||||
def make_rss_feed(path, channel_name, channel_link, description):
|
def make_rss_feed(path, channel_name, channel_link, description):
|
||||||
articles = "".join([article_to_xml(path) for path in (pathlib.Path.cwd() / path).glob("*")])
|
article_paths = (pathlib.Path.cwd() / path).glob("[0-9]*")
|
||||||
|
article_paths_sorted = sorted(article_paths, key=lambda x: x.name, reverse=True)
|
||||||
|
articles = "".join([article_to_xml(path) for path in article_paths_sorted])
|
||||||
return base_feed \
|
return base_feed \
|
||||||
.replace("{title}", channel_name) \
|
.replace("{title}", channel_name) \
|
||||||
.replace("{link}", channel_link) \
|
.replace("{link}", channel_link) \
|
||||||
|
|
Loading…
Reference in a new issue