Keep Indentation in Jinja
Chased this one for a minute – make a custom filter that at some point does: value.replace(‘ ‘,’ ’)
Chased this one for a minute – make a custom filter that at some point does: value.replace(‘ ‘,’ ’)
In the last post, Jinja stripped an HTML tag (I didn’t properly escape)… Here’s a properly formatted version: def BlogPostFilter(value): return value.replace(‘\n’,'<br>\n’)
You may have noticed, prior to this, my blog posts have looked like a wall of text. That’s because Jinja (Templating engine) was stipping newlines. To resolve this issue, use a custom filter: def BlogPostFilter(value): return value.replace(‘\n’,’\n’) app.jinja_env.filters[‘BlogPostFilter’] = BlogPostFilter {{ blogPost.body | BlogPostFilter }} … I still need to work on whitespace to get[…]
You can manage headless Hyper-V 2012 R2 servers in multiple ways. You can use Powershell. You can manage from the local console, or join an existing domain and use existing infrastructure. You can use PSHVM30 and corefig (use a hacked openRDP for local VM access)(internets) I’ve cobbled together this post, using some process and notes[…]
So I have this great system to automatically update the blog from a list of files when I click a button. Of course it broke while bringing in the latest post about Hyper-V – UNICODE!!! Solution was to decode when reading in from file: with open(blogpost, ‘r’) as bp: body = bp.read().decode(‘utf-8’)
So i had all the raw text from my blog posts backed up in a flat text file (just a bunch of text). I wanted to be clever and not manually enter each blog post again, so I made a new button and tied it to this grabPosts function: class BlogPostGrabber(): def grabPosts(self): os.chdir(‘/home/colin/blogposts’) for[…]