From 11ce33e617ff4e25497aa7b44b6188e60dbfdd22 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Tue, 2 Apr 2024 17:41:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=9Alabel=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 15 +++++++++------ templates/plist.html | 8 +++++--- templates/tag.html | 31 ++++++++++++++++++------------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Gmeek.py b/Gmeek.py index bfca9f5..cecfdb9 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -77,6 +77,7 @@ class GMEEK(): self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') self.blogBase["singeListJson"]=json.loads('{}') + self.blogBase["labelColorDict"]=self.labelColorDict if "displayTitle" not in self.blogBase: self.blogBase["displayTitle"]=self.blogBase["title"] @@ -148,7 +149,7 @@ class GMEEK(): else: postBase["highlight"]=0 - if issue["label"] in self.blogBase["singlePage"]: + if issue["labels"][0] in self.blogBase["singlePage"]: postBase["bottomText"]='' keys=['sun','moon','sync','home','github'] @@ -223,10 +224,10 @@ class GMEEK(): for num in self.blogBase["singeListJson"]: item=feed.add_item() - item.guid(self.blogBase["homeUrl"]+"/"+self.blogBase["singeListJson"][num]["label"]+".html",permalink=True) + item.guid(self.blogBase["homeUrl"]+"/"+self.blogBase["singeListJson"][num]["postUrl"],permalink=True) item.title(self.blogBase["singeListJson"][num]["postTitle"]) item.description(self.blogBase["singeListJson"][num]["description"]) - item.link(href=self.blogBase["homeUrl"]+"/"+self.blogBase["singeListJson"][num]["label"]+".html") + item.link(href=self.blogBase["homeUrl"]+"/"+self.blogBase["singeListJson"][num]["postUrl"]) item.pubDate(time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(self.blogBase["singeListJson"][num]["createdAt"]))) for num in self.blogBase["postListJson"]: @@ -258,7 +259,7 @@ class GMEEK(): feed.rss_file(self.root_dir+'rss.xml') def addOnePostJson(self,issue): - if len(issue.labels)==1: + if len(issue.labels)>=1: if issue.labels[0].name in self.blogBase["singlePage"]: listJsonName='singeListJson' htmlFile='{}.html'.format(self.createFileName(issue,useLabel=True)) @@ -271,8 +272,8 @@ class GMEEK(): postNum="P"+str(issue.number) self.blogBase[listJsonName][postNum]=json.loads('{}') self.blogBase[listJsonName][postNum]["htmlDir"]=gen_Html - self.blogBase[listJsonName][postNum]["label"]=issue.labels[0].name - self.blogBase[listJsonName][postNum]["labelColor"]=self.labelColorDict[issue.labels[0].name] + self.blogBase[listJsonName][postNum]["labels"]=[label.name for label in issue.labels] + # self.blogBase[listJsonName][postNum]["labelColor"]=self.labelColorDict[issue.labels[0].name] self.blogBase[listJsonName][postNum]["postTitle"]=issue.title self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(gen_Html[len(self.root_dir):]) @@ -431,6 +432,8 @@ for i in blog.blogBase["postListJson"]: wordCount=wordCount+blog.blogBase["postListJson"][i]["wordCount"] del blog.blogBase["postListJson"][i]["wordCount"] +blog.blogBase["postListJson"]["labelColorDict"]=blog.labelColorDict + docListFile=open(blog.root_dir+"postList.json","w") docListFile.write(json.dumps(blog.blogBase["postListJson"])) docListFile.close() diff --git a/templates/plist.html b/templates/plist.html index 9e8477c..1ba241a 100644 --- a/templates/plist.html +++ b/templates/plist.html @@ -47,7 +47,7 @@ {% for num in blogBase['singeListJson'] -%} -