Open external links in new tabs, set correct dates for RSS feed

This commit is contained in:
mez 2025-02-01 14:29:09 +00:00
parent 6502979225
commit 1830a5f64d
7 changed files with 47 additions and 39 deletions

View file

@ -46,7 +46,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write("\">\n")
# write html link if there is one
if fileread.html:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -61,7 +61,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write(ficnostring + ".html\">HTML</a></li>\n")
# write pdf link if there is one
if fileread.pdf:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -76,7 +76,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write(ficnostring + ".pdf\">PDF</a></li>\n")
# write epub link if there is one
if fileread.epub:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -92,7 +92,7 @@ def linkgen(ficno,output="output.html",local=False):
# write ao3 link if there is one
try:
if fileread.ao3slug:
filewrite.write("<li class=\"ao3link\"><a class=\"u-syndication")
filewrite.write("<li class=\"ao3link\"><a target=\"_blank\" class=\"u-syndication")
try:
if fileread.ao3locked:
filewrite.write(" locked")
@ -166,7 +166,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write("\">\n")
# write html link if there is one
if fileread.html:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -181,7 +181,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write(translationstring + ".html\">HTML</a></li>\n")
# write pdf link if there is one
if fileread.pdf:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -196,7 +196,7 @@ def linkgen(ficno,output="output.html",local=False):
filewrite.write(translationstring + ".pdf\">PDF</a></li>\n")
# write epub link if there is one
if fileread.epub:
filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("<li class=\"prazelink\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
@ -212,7 +212,7 @@ def linkgen(ficno,output="output.html",local=False):
# write ao3 link if there is one
try:
if fileread.ao3slug:
filewrite.write("<li class=\"ao3link\"><a ")
filewrite.write("<li class=\"ao3link\"><a target=\"_blank\" ")
if fileread.locked:
filewrite.write("class=\"locked\" ")
filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n")
@ -325,6 +325,8 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
pass
if fileread.status == "abandoned":
filewrite.write(" <span class=\"abandoned\"> (abandoned)</span>")
elif fileread.status == "incomplete":
filewrite.write(" <span class=\"incomplete\"> (in progress)</span>")
filewrite.write("</h1>\n<div class=\"e-content\">\n<ul class=\"ficmeta\">\n<li class=\"ficdate\"><i>Date:</i> ")
# write date, date range if ranged or translation
if fileread.status == "incomplete":
@ -501,16 +503,16 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
# write event details if there are any
try:
if fileread.eventname == "fail-fandomanon":
filewrite.write("In response to prompt at <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://fail-fandomanon.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://fail-fandomanon.dreamwidth.org/\"><b>fail_fandomanon</b></a></span>: <i>" + fileread.prompt + "</i>.")
filewrite.write("In response to prompt at <span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://fail-fandomanon.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://fail-fandomanon.dreamwidth.org/\"><b>fail_fandomanon</b></a></span>: <i>" + fileread.prompt + "</i>.")
try:
if fileread.notes:
filewrite.write(" ")
except:
pass
elif fileread.eventname == "robotsoup":
filewrite.write("Written for <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://kalloway.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://kalloway.dreamwidth.org/\"><b>kalloway</b></a></span>s " + fileread.eventdeets + " fest.")
filewrite.write("Written for <span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://kalloway.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://kalloway.dreamwidth.org/\"><b>kalloway</b></a></span>s " + fileread.eventdeets + " fest.")
elif fileread.eventname == "#ficwip":
filewrite.write("Written for the <a href=\"https://ficwip.carrd.co\">#ficwip</a> event <i>" + fileread.eventdeets + "</i>")
filewrite.write("Written for the <a target=\"_blank\" href=\"https://ficwip.carrd.co\">#ficwip</a> event <i>" + fileread.eventdeets + "</i>")
if fileread.event == "prompt":
filewrite.write(", in response to prompt, <i>" + fileread.prompt + "</i>")
filewrite.write(".")
@ -523,11 +525,11 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
filewrite.write("Written for ")
try:
if fileread.eventlocation == "dwcomm":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_") + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_") + "</b></a></span>")
elif fileread.eventlocation == "dwjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://"+ fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
elif fileread.eventlocation == "ljjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".livejournal.com/profile\"><img src=\"https://www.dreamwidth.org/img/external/lj-userinfo.gif\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".livejournal.com/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://" + fileread.eventname.replace("_","-") + ".livejournal.com/profile\"><img src=\"https://www.dreamwidth.org/img/external/lj-userinfo.gif\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://"+ fileread.eventname.replace("_","-") + ".livejournal.com/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
except:
if fileread.eventname == "Semaine de la fic française":
filewrite.write("<i>Semaine de la fic française</i>")
@ -546,15 +548,15 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
if fileread.recip:
try:
if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://archiveofourown.org/users/"+ fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\"><a target=\"_blank\" href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a target=\"_blank\" href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write("s ")
@ -570,15 +572,15 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
filewrite.write(", a gift for ")
try:
if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/" + fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a target=\"_blank\" href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a target=\"_blank\" href=\"https://archiveofourown.org/users/" + fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
filewrite.write("<span style=\"white-space: nowrap;\"><a target=\"_blank\" href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a target=\"_blank\" href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write(".")