Skip to content

Instantly share code, notes, and snippets.

View bacor's full-sized avatar

Bas bacor

View GitHub Profile
@bacor
bacor / pubfilter.js
Created August 20, 2021 10:09
Filter for BibBase publications
/**
* PubFilter
*
* Author: Bas Cornelissen, based on a script by Floris Roelofsen
* Copyright: Bas Cornelissen
* Date: 7 august 2021
* Version 0.1
*/
/**
@bacor
bacor / period.liquid
Created August 20, 2021 08:05
Jekyll/Liquid output a period/range
{%- assign start = include.start %}
{%- assign end = include.end %}
{%- assign startMonth = start | date: '%b' %}
{%- assign endMonth = end | date: '%b' %}
{%- assign sameMonthStartFmt = include.same_month_start_fmt | default: '%d' -%}
{%- assign sameMonthEndFmt = include.same_month_end_fmt | default: "%d %b '%y" -%}
{%- if startMonth == endMonth -%}
<time datetime="{{ start | date: '%Y-%m-%d' }}">
{{- start | date: sameMonthStartFmt -}}
@bacor
bacor / get.liquid
Last active August 20, 2021 08:08
Get default value from data file in Jekyll/Liquid
{%- comment -%}
_includes/get.liquid
{%- endcomment %}
{%- comment -%}
This file defines a Liquid function that outputs the value of a field
in an object if it exists, and otherwise tries to retrieve a default value
from a datafile. To put it differently, it retrieves a default value from
a datafile, but allows you to override the defaults.