diff options
| author | user <user@node5.net> | 2024-03-11 15:07:12 +0100 |
|---|---|---|
| committer | user <user@node5.net> | 2024-03-11 15:07:12 +0100 |
| commit | 8c956c553f36d9de7061ab27efb44d7e69ba52b7 (patch) | |
| tree | 2fcb5295b0f3ec96259b6f3f60b722e6d78c05e8 /src | |
| parent | 2ddb56bcdc52c2851ffab18a64480b88c8b5abcb (diff) | |
article - add modified date
Diffstat (limited to 'src')
| -rw-r--r-- | src/article_generator.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/article_generator.py b/src/article_generator.py index ba60eff..828f31a 100644 --- a/src/article_generator.py +++ b/src/article_generator.py @@ -54,6 +54,7 @@ class Article(WebPage): source_path: str source: str html: str + modified: datetime.datetime folder_path: typing.Union[None, str] = None @property @@ -65,6 +66,7 @@ Web dir: {self.web_dir} URL: {self.url} Source path: {self.source_path} Folder path: {self.folder_path} +Modified: {self.modified} HTML: {truncate(self.html)} Source: {truncate(self.source)}''' @@ -120,6 +122,9 @@ def get_article(path: str) -> Article: article_args[ 'url'] = f'{"/" if article_args["web_dir"] else ""}{"/".join(article_args["web_dir"])}/{article_args["name"]}' + article_args['modified'] = datetime.datetime.utcfromtimestamp(os.path.getmtime(path)).replace( + tzinfo=datetime.datetime.now().astimezone().tzinfo) + with open(path, 'r') as file: source = file.read() article_args['source'], article_args['metadata'] = parse_article_meta_data(source) |
