2018-03-27 03:06:42 +02:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl -p unzip
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
root=$(pwd)
|
|
|
|
|
|
|
|
if [ ! -f "./update.sh" ]; then
|
|
|
|
echo "Please run this script from within pkgs/misc/documentation-highlighter/!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
|
|
|
|
function finish {
|
|
|
|
rm -rf "$scratch"
|
|
|
|
}
|
|
|
|
trap finish EXIT
|
|
|
|
|
|
|
|
|
|
|
|
mkdir $scratch/src
|
|
|
|
cd $scratch/src
|
|
|
|
|
2023-12-01 18:33:47 +01:00
|
|
|
curl \
|
|
|
|
-X POST \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
--data-raw '{
|
|
|
|
"api": 2,
|
|
|
|
"languages": ["bash", "nix", "shell"]
|
|
|
|
}' \
|
|
|
|
https://highlightjs.org/api/download > $scratch/out.zip
|
2018-03-27 03:06:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
unzip "$scratch/out.zip"
|
|
|
|
out="$root/"
|
|
|
|
mkdir -p "$out"
|
2023-12-01 18:33:47 +01:00
|
|
|
cp ./highlight.min.js "$out/highlight.pack.js"
|
|
|
|
cp ./{LICENSE,styles/mono-blue.css} "$out"
|
2018-03-27 03:06:42 +02:00
|
|
|
|
|
|
|
(
|
|
|
|
echo "This file was generated with pkgs/misc/documentation-highlighter/update.sh"
|
|
|
|
echo ""
|
|
|
|
cat README.md
|
|
|
|
) > "$out/README.md"
|