!date
ish
Alright so on to the real, here is my evil plan.
Have a few projects on the way.
Me thinks making the website is going well.
It's not perfect but for me, it's "easy on the eyes".
So one of the miniature projects that I just started was figuring out how to automate the little paragraph of text that I use to update my blog. lemme git it down here. Below is what it looks like (normally, I'm changing up the order of a few things because of how they appear on mobile.
<tr>
<a href="/blog/blog_post_url_goes_here.html"><th scope="row">blog post title link goes here</th>
<td>small slug about post.</td>
<td>date output from !date goes here</td>
<td>#100daysofCode</td>
</a>
</tr>
above is what it renders to on the web page. below I've started a little funciton that will help me deliver the data needed but it's only just a start.
I'll explain my process here a little bit.
Right now I need a program that will put that above bit of html in my blog.html file at a specific point IN that html file (if you're interested further you can go look, I have it marked-be careful how deep you look though, never know what you might find). The html will include a blog title, a short description, date of post, and type of post - some classy-fication if you will.
It has to go with my workflow, which is - write blog post run jupyter nbconvert some_blogpost.ipynb
which transforms my .ipynb
file to an html file. Then I want to run a similar command that I use the new some_blogpost.html
file as an argument and it adds that block of html from above to my blog roll page.
This below is just a rough prototype of the finished version. All it does is confirm that I can return inputted data.
def makes_html_blog_post_bit(date, ipynb_title):
title = input('input blog post title: ')
date = date
description = input('write short description: ')
type = input('classify type of post (#100daysofcode, etc): ')
url = ipynb_title
print(title, date, description, type, url)
a = !date # I like the format of !date which is just 'date' at the command line
a # outputs as a list which is convenient.
test_post = 'file' # testing as just a string to see where it shows up.
makes_html_blog_post_bit(a, test_post)
reformatted version from sublime and running it on the command line:
def makes_html_blog_post_bit(date, ipynb_title):
title = input('input blog post title: ')
date = date
description = input('write short description: ')
type = input('classify type of post (#100daysofcode, etc): ')
url = ipynb_title
return title, date, description, type, url
print(makes_html_blog_post_bit('Sun Sep 1 01:29:31 CDT 2019', 'file'))
I realized that in jupyter notebook it reads the input and then leaves it there.
That's nice I get a list out of it.
Now I have to get the name of the file.
This is how far I got on day 3.
If you let it, this is the healthy development of a program. I've thought about this for weeks and it took me just a second or two to start. And I got a blog post out of the thing.
If you're reading this and you don't know how to code, and you're wondering "how to learn how to code" here's how you do it. It's never ending. I don't know what I'm building and what it's going to look like. I just know what I want it to do in the end and that I have some experience messing with some html and python so between here and there, there will be some googling but I'm sure I'll have something cool soon.
Back in the day when I should have started doing this it could have been a portfolio item but now maybe not so much. People don't seem to be too impressed with automation anymore.