pages/syntax_wrapper.sh

9 lines
No EOL
223 B
Bash
Executable file

#! /usr/bin/env bash
if [[ $# -lt 1 ]] || ! { pygmentize -L lexers | grep -qw "$1"; }; then
printf "<code>"
cat
printf "</code>"
else
pygmentize -l $1 -f html | head -c -13 | awk -F '<pre>' '{print $NF}'
fi