aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/theme-studio/generate.py2
-rwxr-xr-xscripts/theme-studio/run-tests.sh4
-rw-r--r--scripts/theme-studio/samples.py3
3 files changed, 7 insertions, 2 deletions
diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py
index 667e7b263..cc6a26f89 100644
--- a/scripts/theme-studio/generate.py
+++ b/scripts/theme-studio/generate.py
@@ -57,7 +57,7 @@ BROWSER_GATES_BODY=strip_exports(read_text('browser-gates.js'))
COLOR_NAMES=read_json('color-names.json')
ns={}
src=read_text('samples.py')
-exec(src[:src.index('cols=')], ns)
+exec(src[:src.index('# THEME_STUDIO_DATA_END')], ns)
SAMPLES={"Elisp":ns['ELS'],"Go":ns['GOS'],"Python":ns['PYS'],"TypeScript":ns['TSS'],"Java":ns['JAS'],"C":ns['CS'],"C++":ns['CPS'],"Rust":ns['RUSTS'],"Zig":ns['ZIGS'],"Shell":ns['SHS']}
COLS=ns['COLS']
DEFAULT_FACES_PATH=os.path.join(HERE,'emacs-default-faces.json')
diff --git a/scripts/theme-studio/run-tests.sh b/scripts/theme-studio/run-tests.sh
index 2733b28df..6666fb0b9 100755
--- a/scripts/theme-studio/run-tests.sh
+++ b/scripts/theme-studio/run-tests.sh
@@ -55,7 +55,9 @@ CHROME=""
for c in google-chrome-stable google-chrome chromium chromium-browser; do
if command -v "$c" >/dev/null 2>&1; then CHROME="$c"; break; fi
done
-HASHES="selftest cursortest readouttest deltatest oklchtest planetest locktest sorttest mocktest contrasttest safetest healtest columntest counttest baseedittest roundtriptest beveltest previewlinktest generatortest autodimtest"
+# Derive the gate list from the gate blocks themselves so it can't drift: a gate
+# added to browser-gates.js runs automatically, and one removed stops being run.
+HASHES="$(grep -oE "location\.hash==='#[a-z]+test'" browser-gates.js | sed -E "s/.*#([a-z]+test)'/\1/" | sort -u | tr '\n' ' ')"
if [ "$NO_BROWSER" = 1 ]; then
skip_msg "browser hash gates (--no-browser)"
elif [ -z "$CHROME" ]; then
diff --git a/scripts/theme-studio/samples.py b/scripts/theme-studio/samples.py
index c80b0d405..02605e75b 100644
--- a/scripts/theme-studio/samples.py
+++ b/scripts/theme-studio/samples.py
@@ -288,6 +288,9 @@ ZIGS=[
[('punc','}')],
]
+# THEME_STUDIO_DATA_END: generate.py execs only the lines above this marker (the
+# code samples and COLS). Everything below is the standalone /tmp/dupre-canon.html
+# preview generator, run only when samples.py is executed directly.
cols="".join(f'<div class="col"><h2>{n}</h2><pre>{render(s)}</pre></div>' for n,s in [("Elisp",ELS),("Go",GOS),("Python",PYS),("TypeScript",TSS),("Java",JAS),("C",CS),("C++",CPS),("Rust",RUSTS),("Zig",ZIGS),("Shell",SHS)])
legend_rows=[
("keyword (bold)","kw","class def if return import"),("builtin","bi","len range print"),