Felix Felicis Workflow

Beside setting up webhook, which allowing this blog to regenerate itself whenever I push new changes to GitHub, I’ve made some further customization to make my life easier.

Template Customization

Added support for sources, which can be used in following way:

- source: http://url.one ||
        http://url.two ||

To achieve this functionality, in your template folder modify file filters.py and add:

def split_soruces(sources):
    sources = sources.split('||')
    return [source.strip() for source in sources]

…and then in templatespost.html add:

{%if post.source%}
    {% set post_source = post.source|split_soruces %}
    <br><span class="entry-meta">Sources:</span>
    {% for source in post_source -%}
        <br><a href="{{source}}">{{source}}</a>
    {%- endfor %}

Sublime Text Snippet and Date Plugin

In Sublime Text editor, I’ve added plug-in which allows me to add current date (saved it as date.py) by entering: YYYY-MM-DD:

import sublime_plugin
import datetime

class DateCompleter(sublime_plugin.EventListener):
    def on_query_completions(self, view, prefix, locations):
        return [
            ("YYYY-MM-DD", str(datetime.date.today())),
            ("YYYY", str(datetime.date.today().year)),
            ("MM", "%2d" % datetime.date.today().month),
            ("DD", "%2d" % datetime.date.today().day)

And finally, I’ve added a snippet to be able to create a new post quickly. The slug will be auto generated from post’s title, as you type.

# ${1:Post Title}

- slug: ${1/(\w+)(?:(\s+?)|\b)/?1:\L$1(?2:-)\E/g}
- date: ${2:YYYY-MM-DD}${3}
- tags: ${4}
${5:- source: ${6}}



    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->

This is archived version of blog, preventing broken links. This version will stay online indefinitely.