Skip to content

Commit

Permalink
修改 生成器 隐藏特定文章
Browse files Browse the repository at this point in the history
  • Loading branch information
WoodAsh2501 committed Apr 18, 2024
1 parent d4ccba7 commit 8851c8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion builder/globalVar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"records": "琐记",
"notes": "笔记",
}
ignoreList = ["半燃其零・钻木求火码后记"]

directory = Path("../")
10 changes: 7 additions & 3 deletions builder/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

from globalVar import *

dontEditBodyList = [
"半燃其零・钻木求火码后记",
]


def getTagText(_tag):
if not _tag:
Expand Down Expand Up @@ -158,10 +162,10 @@ def updateHead(self, _head):
updateHead(self, head)
addWelcome(self, head)

def editBody(self, _body, _ignoreList):
def editBody(self, _body):
if self.category == "index":
return
if self.title in _ignoreList:
if self.title in dontEditBodyList:
return

def setDate(self, _body):
Expand Down Expand Up @@ -230,7 +234,7 @@ def turnIntoListItem(_titleTag):
body = content.body

editHead(self, head)
editBody(self, body, ignoreList)
editBody(self, body)

HTML.seek(0)
HTML.truncate(0)
Expand Down
9 changes: 7 additions & 2 deletions builder/updateIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from globalVar import *

hiddenList = [
"尚未启程之旅",
]


def updateCategoryIndex(_pages, _category):
articles = [
f"""
Expand All @@ -24,7 +29,7 @@ def updateCategoryIndex(_pages, _category):
</article>
"""
for page in _pages
if page.category != "index"
if page.category != "index" and page.title not in hiddenList
]

articleString = "".join(articles)
Expand Down Expand Up @@ -62,7 +67,7 @@ def updateMainIndex(_pages):
</article>
"""
for page in _pages
if page.category != "index"
if page.category != "index" and page.title not in hiddenList
]
articleString = "".join(articles)
with open(mainIndex, "r+", encoding="utf-8") as HTML:
Expand Down
12 changes: 0 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -712,18 +712,6 @@ <h1 class="article-title">
躺平只是不被认可的生活。
</p>
</article>
<article>
<h1 class="article-title">
<a href="..\essays\尚未启程之旅.html">
尚未启程之旅
</a>
</h1>
<p class="article-date">
.
</p>
<p class="article-summary">
</p>
</article>
</div>
</main>
<footer>
Expand Down

0 comments on commit 8851c8b

Please sign in to comment.