cache supported lexers for pygments

This commit is contained in:
Alexander 2025-06-24 14:29:38 -04:00
parent af97adacbe
commit fba9f88956
6 changed files with 10 additions and 5 deletions

1
.gitignore vendored
View file

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

1
acl.cool/lexers.out Symbolic link
View file

@ -0,0 +1 @@
../lexers.out

View file

@ -18,6 +18,11 @@ function soup_config {
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
cat common_chars.txt >>all_chars.txt

View file

@ -6,9 +6,6 @@
# Trying to process this config with an older version will result in an error message
soupault_version = "4.11.0"
# Stop on page processing errors?
strict = true
# Display progress?
verbose = true
@ -29,7 +26,7 @@ build_dir = "serve"
#
# Note that for formats other than HTML, you need to specify an external program
# for converting them to HTML (see below).
page_file_extensions = ["htm", "html", "md", "rst", "adoc", "dj"]
page_file_extensions = ["html", "dj"]
# By default, soupault uses "clean URLs",
# that is, $site_dir/page.html is converted to $build_dir/page/index.html

View file

@ -1,6 +1,6 @@
#! /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
else
pygmentize -l $1 -f html | head -c -13 | awk -F '<pre>' '{print $NF}'

1
ytheleus.org/lexers.out Symbolic link
View file

@ -0,0 +1 @@
../lexers.out