cache supported lexers for pygments

This commit is contained in:
Alexander 2025-06-24 11:58:30 -04:00
parent af97adacbe
commit b5bd624634
3 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ all_chars.txt
**/fonts/**/*-Subset.* **/fonts/**/*-Subset.*
woff2/ woff2/
**/serve_* **/serve_*
**/lexers.*

View file

@ -18,6 +18,11 @@ function soup_config {
source ./pgvv/bin/activate source ./pgvv/bin/activate
if ! [[ -f lexers.out ]] || [[ "$(head -1 lexers.out)" != "$(pygmentize -V)" ]]; then
pygmentize -L lexer > lexers.out
echo "created pygments lexer cache at lexers.out"
fi
find acl.cool/site/ ytheleus.org/site/ -type f \( -name '*.dj' -o -name '*.html' \) -exec cat {} + >all_chars.txt find acl.cool/site/ ytheleus.org/site/ -type f \( -name '*.dj' -o -name '*.html' \) -exec cat {} + >all_chars.txt
cat common_chars.txt >>all_chars.txt cat common_chars.txt >>all_chars.txt

View file

@ -1,7 +1,7 @@
#! /usr/bin/env sh #! /usr/bin/env sh
if [ $# -lt 1 ] || ! pygmentize -L lexers | grep -qw "$1"; then if [ $# -lt 1 ] || ! grep -qw "$1" lexers.out; then
recode utf8..html recode utf8..html
else else
pygmentize -l $1 -f html | head -c -13 | awk -F '<pre>' '{print $NF}' pygmentize -l $1 -f html | awk -F '<pre>' '{print substr($NF, 14)}'
fi fi