Skip to content

Instantly share code, notes, and snippets.

View navilan's full-sized avatar

Navilan navilan

View GitHub Profile
@navilan
navilan / _body.html
Created November 23, 2010 13:50
Exclude directories
{% extends "skeleton/_base.html" %}
{# Note that context variables here are meaningless since they are not evaluated in base templates #}
{# So we create the variable in the CONTEXT #}
{% block content %}
{% block content_header %}
<div id="content-header"><h1>{{ page.title }}</h1></div>
{% endblock %}
{% block content_body %}
@navilan
navilan / collect_links.py
Created January 25, 2011 20:33
Textmate Command to extract the link references from a markdown file and insert it as a snippet at cursor.
---
title: An Angry Post
description: >
Temper. Temper. Temper.
created: !!timestamp '2011-01-01 10:00:00'
tags:
- angry
- thoughts
---
@navilan
navilan / gist:948017
Created April 29, 2011 08:05
Iterating over events - where integer key is an issue.
---
extends: base.j2
title: About BASIC
description: The default hyde template
events:
y2011:
-
title: "one event"
location: "a city"
-
@navilan
navilan / ffs_emacs24_lion.patch
Created July 17, 2011 15:59
Emacs 24 Fullscreen for lion patch
--- nsterm.m.patched 2011-07-17 21:25:41.000000000 +0530
+++ nsterm.m 2011-07-17 21:25:44.000000000 +0530
@@ -5881,6 +5881,13 @@
-(NSWindow *)toggleFullscreen {
+
+ if ([super respondsToSelector: @selector(toggleFullScreen:)]) {
+ [super toggleFullScreen:self];
+ return self;
@navilan
navilan / test_grouper.py
Created October 3, 2011 03:10
Grouper with sorted group names (https://groups.google.com/forum/#!topic/hyde-dev/RhBhl9ZQZoI). This test can be executed by adding to the end of test_grouper.py
def test_nav_with_grouper(self):
text ="""
{% for group, resources in site.content.walk_section_groups() %}
<ul>
<li>
<h2>{{ group.name|title }}</h2>
<h3>{{ group.description }}</h3>
<ul class="links">
{% for resource in resources %}
@navilan
navilan / fuctions.py
Created February 6, 2012 15:59
A hyde plugin to add a context function to jinja and related
#<site_root>/functions.py
from hyde.plugin import Plugin
def quoted(var):
return '"%s"' % var
class MyJinjaLoader(Plugin):
def template_loaded(self, template):
@navilan
navilan / site_defaults.py
Created September 7, 2012 03:48
Localized dates for hyde
# -*- coding: utf-8 -*-
from hyde.plugin import Plugin
from jinja2 import contextfunction, Markup
@contextfunction
def localtime(context, val, lc):
import locale, datetime
current = locale.getlocale()
locale.setlocale(locale.LC_ALL, lc)
result = val.strftime(locale.nl_langinfo(locale.D_T_FMT))
@navilan
navilan / meta.yaml
Created September 7, 2012 04:11
Locale plugin for multilanguage hyde site
# This file should be placed in the root directory for french language files
# ...
language: fr
lc: fr_CA
# ...
@navilan
navilan / how_to.md
Last active December 10, 2015 02:58
A simple plugin to rename file extensions. See: https://groups.google.com/forum/#!topic/hyde-dev/EtJ7bRUQEBA.

How to test:

  1. Create a new hyde site hyde -s test create
  2. Overwrite the generated site.yaml with the one in the gist
  3. Add site_plugins.py to the root folder
  4. Rename *.html under content to *.md
  5. Run hyde hyde gen -r