Add stats page
This commit is contained in:
parent
219ab35571
commit
2e3d5858fd
3 changed files with 644 additions and 8 deletions
20
new.py
20
new.py
|
@ -545,7 +545,7 @@ for fic in ficlist:
|
|||
pass
|
||||
if fic["locked"]:
|
||||
ficpage.write(" 🔒")
|
||||
ficpage.write("</h1>\n<ul>\n<li>")
|
||||
ficpage.write("</h1>\n<div class=\"e-content\">\n<ul>\n<li>")
|
||||
thewords = fic["totalwords"]
|
||||
ficpage.write(str(f"{thewords:,}" + " words, "))
|
||||
try:
|
||||
|
@ -683,15 +683,17 @@ for fic in ficlist:
|
|||
pass
|
||||
ficpage.write("\n</section>\n")
|
||||
if fic["locked"]:
|
||||
ficpage.write("<section id=\"passwarn\" class=\"e-content\"><p>Fic is password-protected.</p></section>\n")
|
||||
ficpage.write("<section id=\"passwarn\"><p>Fic is password-protected.</p></section>\n")
|
||||
else:
|
||||
ficpage.write("<div class=\"e-content\">\n")
|
||||
with open("build/files/" + stringno(fic["id"]) + ".html") as fichtml:
|
||||
ficsoup = BeautifulSoup(fichtml,"html.parser")
|
||||
soupfic = ficsoup.find("div",{"id":"workskin"})
|
||||
if soupfic == None:
|
||||
soupfic = ficsoup.find("article")
|
||||
ficpage.write(str(soupfic) + "\n</div>\n")
|
||||
ficpage.write(str(soupfic) + "\n")
|
||||
ficpage.write("</div>\n")
|
||||
if fic["id"] > 261:
|
||||
ficpage.write("<section><p><i>You may be able to find this fic on the fediverse by searching for <code>https://fed.brid.gy/r/https://tre.praze.net/fic/" stringno(fic["id"]) + "/</code> in your fediverse client.</i></p></section>")
|
||||
if allowcomments or havecomments:
|
||||
ficpage.write("<section id=\"commentsection\">\n")
|
||||
if allowcomments:
|
||||
|
@ -760,7 +762,7 @@ for fic in ficlist:
|
|||
pass
|
||||
if fic["locked"]:
|
||||
transpage.write(" 🔒")
|
||||
transpage.write("</h1>\n<ul>\n<li>")
|
||||
transpage.write("</h1>\n<ul>\n<div class=\"e-content\">\n<li>")
|
||||
thewords = fic["transwords"]
|
||||
transpage.write(str(f"{thewords:,}" + " words, ") + "<code><time class=\"dt-published\" datetime=\"" + datetime.datetime.strftime(fic["transstartdate"],"%Y-%m-%d") + " 00:00:00\">" + datetime.datetime.strftime(fic["transstartdate"],"%Y-%m-%d") + "</time></code>")
|
||||
if fic["completion"] == "incomplete":
|
||||
|
@ -890,15 +892,17 @@ for fic in ficlist:
|
|||
pass
|
||||
transpage.write("\n</section>\n")
|
||||
if fic["locked"]:
|
||||
transpage.write("<section id=\"passwarn\" class=\"e-content\"><p>Fic is password-protected.</p></section>\n")
|
||||
transpage.write("<section id=\"passwarn\"><p>Fic is password-protected.</p></section>\n")
|
||||
else:
|
||||
transpage.write("<div class=\"e-content\">\n")
|
||||
with open("build/files/" + stringno(fic["transid"]) + ".html") as fichtml:
|
||||
ficsoup = BeautifulSoup(fichtml,"html.parser")
|
||||
soupfic = ficsoup.find("div",{"id":"workskin"})
|
||||
if soupfic == None:
|
||||
soupfic = ficsoup.find("article")
|
||||
transpage.write(str(soupfic) + "\n</div>\n")
|
||||
transpage.write(str(soupfic) + "\n")
|
||||
transpage.write("</div>\n")
|
||||
if fic["transid"] > 261:
|
||||
ficpage.write("<section><p><i>You may be able to find this fic on the fediverse by searching for <code>https://fed.brid.gy/r/https://tre.praze.net/fic/" stringno(fic["transid"]) + "/</code> in your fediverse client.</i></p></section>")
|
||||
if allowcomments or havecomments:
|
||||
transpage.write("<section id=\"commentsection\">\n")
|
||||
if allowcomments:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue