Merge branch 'permalink-update'

master
endorphant 2018-03-11 20:28:27 -04:00
commit ed35625e74
4 changed files with 79 additions and 39 deletions

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import
import os
import sys
import time
from .. import util
@ -82,10 +83,44 @@ ___________________________________________________________
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| ver 0.11.2 (rainbows) |
| ver 0.11.3 (rainbows) |
|__________________________________________________________|
'''.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
UPDATES = {
@ -153,5 +188,14 @@ version 0.9.3 features:
non-public on posting; this option only really makes sense if you're
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!"""
}

View File

@ -28,6 +28,12 @@ body {
padding: 1em;
}
.entry p.permalink {
font-size: .6em;
font-color: #808080;
text-align: right;
}
.entry h5 {
text-align: right;
margin-top: .2em;

View File

@ -221,7 +221,7 @@ def write_entry(filename):
# entry.append("</p>\n\t\t\t<p>")
#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")
return entry

View File

@ -50,7 +50,7 @@ from . import chatter
from . import gopher
from . import util
__version__ = "0.11.2"
__version__ = "0.11.3"
__author__ = "endorphant <endorphant@tilde.town)"
p = inflect.engine()
@ -754,24 +754,7 @@ def show_credits():
prints author acknowledgements and commentary
'''
print("""
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.\
""")
print(config.credits)
input("\n\npress <enter> to go back home.\n\n")
redraw()
@ -784,19 +767,7 @@ def write_entry(entry=os.path.join(config.USER_DATA, "test.txt")):
main feels-recording handler
'''
entered = input("""
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")))
entered = input(config.recording)
if entered:
entryFile = open(entry, "a")
@ -806,6 +777,8 @@ editor.
left = ""
core.load_files()
if SETTINGS.get("post as nopub"):
core.toggle_nopub(os.path.basename(entry))
else:
@ -820,7 +793,7 @@ editor.
gopher.publish_gopher('feels', core.get_files())
left += " also posted to your ~/public_gopher!\n"
core.load_files()
#core.load_files()
redraw(left + " thanks for sharing your feels!")
return
@ -1107,14 +1080,14 @@ def select_publish_dir():
publishDir = os.path.join(config.PUBLIC, choice)
while os.path.exists(publishDir):
second = input("\n"+publishDir+"""\
already exists!
second = input("""
{pDir} already exists!
setting this as your publishing directory means this program may
delete or overwrite file there!
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 == "":
break
@ -1335,6 +1308,19 @@ def update_user_version():
SETTINGS.update({"post as nopub": False})
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("""
you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant if
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
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 = ""
while confirm not in ("x", "<x>", "X", "<X>"):