From 4e9f0e73433984bf860942ba80fd49c9e997c728 Mon Sep 17 00:00:00 2001 From: Pang Date: Wed, 10 Apr 2024 15:51:05 +0000 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81medium-zoom=E5=BA=93=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E7=9A=84=E5=9B=BE=E5=83=8F=E6=94=BE=E7=BC=A9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 6 +++++- templates/post.html | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Gmeek.py b/Gmeek.py index 957f94e..363b5d8 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -72,7 +72,7 @@ class GMEEK(): os.mkdir(self.post_dir) def defaultConfig(self): - dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{}} + dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"useMediumZoom":1,} config=json.loads(open('config.json', 'r', encoding='utf-8').read()) self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') @@ -138,6 +138,10 @@ class GMEEK(): post_body=re.sub(r'','',post_body) issue["script"]=issue["script"]+'' + if postBase["useMediumZoom"] == 1: + # match tags containing only tags regardless of newlines and remove them + post_body = re.sub(r"]*>\s*(]*>)\s*", r"\1", post_body, flags=re.DOTALL) + postBase["postTitle"]=issue["postTitle"] postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"] postBase["description"]=issue["description"] diff --git a/templates/post.html b/templates/post.html index 6bd90d2..f6efd9f 100644 --- a/templates/post.html +++ b/templates/post.html @@ -65,6 +65,14 @@