Initial commit
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Regenerates Sources/mdview/Assets.swift from the files in assets/, embedding
|
||||
# them as Swift raw string literals so the binary is fully self-contained.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
out=Sources/mdview/Assets.swift
|
||||
|
||||
emit() {
|
||||
name=$1
|
||||
file=$2
|
||||
if grep -q '"""##' "$file"; then
|
||||
echo "error: $file contains the raw string delimiter" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf ' static let %s = ##"""\n' "$name"
|
||||
cat "$file"
|
||||
printf '\n"""##\n\n'
|
||||
}
|
||||
|
||||
{
|
||||
echo '// Generated by scripts/gen-assets.sh -- do not edit by hand.'
|
||||
echo
|
||||
echo 'enum Assets {'
|
||||
emit markdownCSS assets/github-markdown.css
|
||||
emit highlightLightCSS assets/hljs-github.css
|
||||
emit highlightDarkCSS assets/hljs-github-dark.css
|
||||
emit highlightJS assets/highlight.min.js
|
||||
echo '}'
|
||||
} > "$out"
|
||||
|
||||
echo "wrote $out"
|
||||
Reference in New Issue
Block a user