Merge branch 'permalink-update'
commit
ed35625e74
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
from .. import util
|
from .. import util
|
||||||
|
|
||||||
|
@ -82,10 +83,44 @@ ___________________________________________________________
|
||||||
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
|
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
|
||||||
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
|
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
|
||||||
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
|
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
|
||||||
| ver 0.11.2 (rainbows) |
|
| ver 0.11.3 (rainbows) |
|
||||||
|__________________________________________________________|
|
|__________________________________________________________|
|
||||||
'''.lstrip()
|
'''.lstrip()
|
||||||
|
|
||||||
|
## page texts
|
||||||
|
|
||||||
|
credits = """
|
||||||
|
ttbp was written for tilde.town by ~endorphant in python. the codebase is
|
||||||
|
publicly available on github at https://github.com/modgethanc/ttbp
|
||||||
|
|
||||||
|
other contributors:
|
||||||
|
~vilmibm, packaging help and gopher support
|
||||||
|
~sanqui, the bug swatter
|
||||||
|
~sinacutie, for css updates
|
||||||
|
|
||||||
|
if you have ideas for ttbp, you are welcome to contact me to discuss them;
|
||||||
|
please send me tildemail or open a github issue. i am not a very experienced
|
||||||
|
developer, and ttbp is one of my first public-facing projects, so i appreciate
|
||||||
|
your patience while i learn how to be a better developer!
|
||||||
|
|
||||||
|
i'd love to hear about your ideas and brainstorm about new features!
|
||||||
|
|
||||||
|
thanks to everyone who reads, listens, writes, and feels."""
|
||||||
|
|
||||||
|
recording = """
|
||||||
|
feels will be recorded for today, {today}.
|
||||||
|
|
||||||
|
if you've already started recording feels for this day, you
|
||||||
|
can pick up where you left off.
|
||||||
|
|
||||||
|
you can write your feels in plaintext, markdown, html, or a mixture of
|
||||||
|
these.
|
||||||
|
|
||||||
|
press <enter> to begin recording your feels in your chosen text
|
||||||
|
editor.
|
||||||
|
|
||||||
|
""".format(today=time.strftime("%d %B %Y"))
|
||||||
|
|
||||||
## update announcements
|
## update announcements
|
||||||
|
|
||||||
UPDATES = {
|
UPDATES = {
|
||||||
|
@ -153,5 +188,14 @@ version 0.9.3 features:
|
||||||
non-public on posting; this option only really makes sense if you're
|
non-public on posting; this option only really makes sense if you're
|
||||||
already publishing to html/gopher, but is available either way!
|
already publishing to html/gopher, but is available either way!
|
||||||
|
|
||||||
you can find this option under 'settings' as 'post as nopub'."""
|
you can find this option under 'settings' as 'post as nopub'.""",
|
||||||
|
"0.11.3": """
|
||||||
|
~[version 0.11.3 update]~
|
||||||
|
|
||||||
|
* thanks to ~sinacutie, you can now set custom css for the permalink text
|
||||||
|
styling on your html page. the default permalink style has been added to
|
||||||
|
your current css file, and shouldn't change the appearance of your page.
|
||||||
|
|
||||||
|
if you're not using custom css, don't worry about this!"""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,12 @@ body {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.entry p.permalink {
|
||||||
|
font-size: .6em;
|
||||||
|
font-color: #808080;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.entry h5 {
|
.entry h5 {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-top: .2em;
|
margin-top: .2em;
|
||||||
|
|
|
@ -221,7 +221,7 @@ def write_entry(filename):
|
||||||
# entry.append("</p>\n\t\t\t<p>")
|
# entry.append("</p>\n\t\t\t<p>")
|
||||||
|
|
||||||
#entry.append("</p>\n")
|
#entry.append("</p>\n")
|
||||||
entry.append("\t\t\t<p style=\"font-size:.6em; font-color:#808080; text-align: right;\"><a href=\""+"".join(date)+".html\">permalink</a></p>\n")
|
entry.append("\t\t\t<p class=\"permalink\"><a href=\""+"".join(date)+".html\">permalink</a></p>\n")
|
||||||
entry.append("\n\t\t</div>\n")
|
entry.append("\n\t\t</div>\n")
|
||||||
|
|
||||||
return entry
|
return entry
|
||||||
|
|
62
ttbp/ttbp.py
62
ttbp/ttbp.py
|
@ -50,7 +50,7 @@ from . import chatter
|
||||||
from . import gopher
|
from . import gopher
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
__version__ = "0.11.2"
|
__version__ = "0.11.3"
|
||||||
__author__ = "endorphant <endorphant@tilde.town)"
|
__author__ = "endorphant <endorphant@tilde.town)"
|
||||||
|
|
||||||
p = inflect.engine()
|
p = inflect.engine()
|
||||||
|
@ -754,24 +754,7 @@ def show_credits():
|
||||||
prints author acknowledgements and commentary
|
prints author acknowledgements and commentary
|
||||||
'''
|
'''
|
||||||
|
|
||||||
print("""
|
print(config.credits)
|
||||||
ttbp was written for tilde.town by ~endorphant in python. the codebase is
|
|
||||||
publicly available on github at https://github.com/modgethanc/ttbp
|
|
||||||
|
|
||||||
other contributors:
|
|
||||||
~vilmibm, packaging help and gopher support
|
|
||||||
~sanqui, the bug swatter
|
|
||||||
|
|
||||||
if you have ideas for ttbp, you are welcome to contact me to discuss them;
|
|
||||||
please send me tildemail or open a github issue. i am not a very experienced
|
|
||||||
developer, and ttbp is one of my first public-facing projects, so i appreciate
|
|
||||||
your patience while i learn how to be a better developer!
|
|
||||||
|
|
||||||
i'd love to hear about your ideas and brainstorm about new features!
|
|
||||||
|
|
||||||
thanks to everyone who reads, listens, writes, and feels.\
|
|
||||||
""")
|
|
||||||
|
|
||||||
input("\n\npress <enter> to go back home.\n\n")
|
input("\n\npress <enter> to go back home.\n\n")
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
|
@ -784,19 +767,7 @@ def write_entry(entry=os.path.join(config.USER_DATA, "test.txt")):
|
||||||
main feels-recording handler
|
main feels-recording handler
|
||||||
'''
|
'''
|
||||||
|
|
||||||
entered = input("""
|
entered = input(config.recording)
|
||||||
feels will be recorded for today, {today}.
|
|
||||||
|
|
||||||
if you've already started recording feels for this day, you
|
|
||||||
can pick up where you left off.
|
|
||||||
|
|
||||||
you can write your feels in plaintext, markdown, html, or a mixture of
|
|
||||||
these.
|
|
||||||
|
|
||||||
press <enter> to begin recording your feels in your chosen text
|
|
||||||
editor.
|
|
||||||
|
|
||||||
""".format(today=time.strftime("%d %B %Y")))
|
|
||||||
|
|
||||||
if entered:
|
if entered:
|
||||||
entryFile = open(entry, "a")
|
entryFile = open(entry, "a")
|
||||||
|
@ -806,6 +777,8 @@ editor.
|
||||||
|
|
||||||
left = ""
|
left = ""
|
||||||
|
|
||||||
|
core.load_files()
|
||||||
|
|
||||||
if SETTINGS.get("post as nopub"):
|
if SETTINGS.get("post as nopub"):
|
||||||
core.toggle_nopub(os.path.basename(entry))
|
core.toggle_nopub(os.path.basename(entry))
|
||||||
else:
|
else:
|
||||||
|
@ -820,7 +793,7 @@ editor.
|
||||||
gopher.publish_gopher('feels', core.get_files())
|
gopher.publish_gopher('feels', core.get_files())
|
||||||
left += " also posted to your ~/public_gopher!\n"
|
left += " also posted to your ~/public_gopher!\n"
|
||||||
|
|
||||||
core.load_files()
|
#core.load_files()
|
||||||
redraw(left + " thanks for sharing your feels!")
|
redraw(left + " thanks for sharing your feels!")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -1107,14 +1080,14 @@ def select_publish_dir():
|
||||||
|
|
||||||
publishDir = os.path.join(config.PUBLIC, choice)
|
publishDir = os.path.join(config.PUBLIC, choice)
|
||||||
while os.path.exists(publishDir):
|
while os.path.exists(publishDir):
|
||||||
second = input("\n"+publishDir+"""\
|
second = input("""
|
||||||
already exists!
|
{pDir} already exists!
|
||||||
|
|
||||||
setting this as your publishing directory means this program may
|
setting this as your publishing directory means this program may
|
||||||
delete or overwrite file there!
|
delete or overwrite file there!
|
||||||
|
|
||||||
if you're sure you want to use it, hit <enter> to confirm.
|
if you're sure you want to use it, hit <enter> to confirm.
|
||||||
otherwise, pick another location: """)
|
otherwise, pick another location: """.format(pDir=publishDir))
|
||||||
|
|
||||||
if second == "":
|
if second == "":
|
||||||
break
|
break
|
||||||
|
@ -1335,6 +1308,19 @@ def update_user_version():
|
||||||
SETTINGS.update({"post as nopub": False})
|
SETTINGS.update({"post as nopub": False})
|
||||||
save_settings()
|
save_settings()
|
||||||
|
|
||||||
|
if z < 3:
|
||||||
|
# update permalink css
|
||||||
|
style = open(os.path.join(config.USER_CONFIG, 'style.css'), 'r').read()
|
||||||
|
if "permalink" not in style:
|
||||||
|
print("adding new css...")
|
||||||
|
with open(os.path.join(config.USER_CONFIG, 'style.css'), 'a') as f:
|
||||||
|
f.write("""
|
||||||
|
.entry p.permalink {
|
||||||
|
font-size: .6em;
|
||||||
|
font-color: #808080;
|
||||||
|
text-align: right;
|
||||||
|
}""")
|
||||||
|
|
||||||
print("""
|
print("""
|
||||||
you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant if
|
you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant if
|
||||||
something strange happened to you during this update.
|
something strange happened to you during this update.
|
||||||
|
@ -1356,6 +1342,10 @@ something strange happened to you during this update.
|
||||||
# version 0.11.2 patch notes
|
# version 0.11.2 patch notes
|
||||||
print(config.UPDATES["0.11.2"])
|
print(config.UPDATES["0.11.2"])
|
||||||
|
|
||||||
|
if y < 11 or z < 3:
|
||||||
|
# version 0.11.3 patch notes
|
||||||
|
print(config.UPDATES["0.11.3"])
|
||||||
|
|
||||||
confirm = ""
|
confirm = ""
|
||||||
|
|
||||||
while confirm not in ("x", "<x>", "X", "<X>"):
|
while confirm not in ("x", "<x>", "X", "<X>"):
|
||||||
|
|
Loading…
Reference in New Issue