From 1e37fcebd2d3f3f25c116e01c9dccb1bf2476aff Mon Sep 17 00:00:00 2001 From: veclav talica Date: Thu, 25 May 2023 22:35:39 +0500 Subject: [PATCH] front image used for embed preview --- tools/article_wrapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/article_wrapper.py b/tools/article_wrapper.py index 3b7050f..962ca34 100755 --- a/tools/article_wrapper.py +++ b/tools/article_wrapper.py @@ -3,7 +3,7 @@ # todo: Show related git history of a file? from sys import argv, exit -import time, urllib.parse +import time, urllib.parse, re from article_utils import the_line_after_metadata, parse_metadata from page_shares import wrap_page, MONTHS @@ -54,4 +54,8 @@ header = f"""HTML header: \n""" +front_image = re.compile(r"!\[.*\]\((.+?)\)", re.DOTALL).search(''.join(content[i:])) +if not front_image is None: + header += f"""\n""" + print(header + ''.join(content[:i]) + wrap_page(article_head + ''.join(content[i:])))