Skip to content

Instantly share code, notes, and snippets.

View bpj's full-sized avatar

Benct Philip Jonsson bpj

View GitHub Profile
@bpj
bpj / merge-abbrevs-pandoc.pl
Last active June 11, 2023 14:22
Create/update a Pandoc abbreviations file from YAML/text files
#!/usr/bin/env perl
use 5.014;
# use utf8;
use utf8::all;
use strict;
use warnings;
use warnings FATAL => 'utf8';
use autodie;
@tarleb
tarleb / highlight.lua
Created July 15, 2022 12:54
Custom syntax extension
--[[
Add support for a custom inline syntax.
This pandoc Lua filter allows to add a custom markup syntax
extension. It is designed to be adjustable; it should not be
necessary to modify the code below the separator line.
The example here allows to add highlighted text by enclosing the
text with `==` on each side. Pandoc supports this for HTML output
out of the box. Other outputs will need additional filters.
@tarleb
tarleb / custom-markdown.lua
Last active November 3, 2024 06:18
Custom Lua writer, using the `layout` module to produce nicely layed-out Markdown.
-- This is a sample custom writer for pandoc, using Layout to
-- produce nicely wrapped output.
local layout = pandoc.layout
local text = pandoc.text
local type = pandoc.utils.type
local l = layout.literal
-- Table to store footnotes, so they can be included at the end.
@bpj
bpj / attr-color.lua
Last active February 12, 2024 08:11
A Pandoc filter which sets LaTeX text/background/frame color(s) on Span and Div elements based on Pandoc attributes.
--[==============================[
# attr-color.lua
A Pandoc filter which sets LaTeX text/background/frame color(s) on
Span and Div elements based on Pandoc attributes.
## Usage
See https://git.io/JI4yA
@K4zuki
K4zuki / pandoc-new-table.md
Last active June 1, 2022 12:01
Personal note of Pandoc's **NEW** Table structure in Lua (WIP!)

Applies to Pandoc ≥ 2.10

From my notes during preparation of my filter compatibility for 2.10

See here for primary reference

-t native always gives great hints

Try:

$ pandoc -t native
| table |
|-------|
@hmenke
hmenke / matheval.lua
Last active February 29, 2020 21:10
Simple mathematical expression parser and evaluator in Lua with LPEG
local lpeg = require"lpeg"
local C, P, R, S, V = lpeg.C, lpeg.P, lpeg.R, lpeg.S, lpeg.V
local white = S(" \t") ^ 0
local digit = R("09")
local dot = P(".")
local eE = S("eE")
local sign = S("+-")^-1
local mantissa = digit^1 * dot * digit^0 + dot * digit^1 + digit^1
@bpj
bpj / pandoc-quote-styles.pl
Last active November 14, 2017 12:56
pandoc-quote-styles.pl - Use custom smart quotes in Pandoc
#!/usr/bin/env perl
# version 0.4
use utf8;
use autodie 2.29;
use 5.010001;
use strict;
use warnings;
use warnings qw(FATAL utf8);
@rueycheng
rueycheng / GNU-Make.md
Last active October 21, 2024 20:47
GNU Make cheatsheet
@chase
chase / .ctags
Last active December 4, 2020 11:52 — forked from jesstelford/.ctags
--langdef=moonscript
--langmap=moonscript:.moon
--regex-moonscript=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-moonscript=/^[ \t]*@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\1/m,method/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\1/f,function/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/p,property/
--regex-moonscript=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/s,static property/
--regex-moonscript=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/p,property/
--regex-moonscript=/(new:[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/p,property/
Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.