slavaaaaaaaaaa / whattimeisitrightmeow

Would you look at the time!
http://smaslennikov.com/whattimeisitrightmeow
MIT License
48 stars 5 forks source link

Make time.txt pretty #13

Open ehuggett opened 7 years ago

ehuggett commented 7 years ago

The time can currently be parsed the time from time.txt, this should fix that.

Untested, please commit to production immediately in true devops style.

slavaaaaaaaaaa commented 7 years ago

I love this but I also plan on using this project to replace my NTP servers, so... maybe yes, I need more hell in my life.

How would you feel about having a separate, pretty, plaintext version?

ehuggett commented 7 years ago

I wouldn't want to get in the way of anything more creative, I'm happy to either close the PR or change it to use a different file if you want the feature anyway.

An alternative to a separate file could be to only use banner, as I suspect the prettified time could be read by looking at the column positions of a single row (but watch alignment, just to make it fun, symbol "1" uses less columns than the others).

slavaaaaaaaaaa commented 7 years ago

@ehuggett Awesome! I would prefer it in a separate file (e.g. prettytime.txt); we can link to it from the index.

I actually like the toilet idea, I wonder if there's a way we can make use of its --gay attribute. Can it output html-friendly stuff? Some research is required here maybe.

ehuggett commented 7 years ago

Can it output html-friendly stuff?

yes it can, --html ! But this includes a html head/body, perhaps --export html3 would work better (uses a table format instead of spans, but no head tags etc).

I copied and pasted this off of stackoverflow, it uses some options i've not come across before but instead of consulting the manual i just changed the filenames and it works! (but the opening marker and closing markers now have to be on separate lines)

sed -i -ne '/<p can i put a marker here?>/ {p; r time.html' -e ':a; n; /<\/p>/ {p; b}; ba}; p' index.html