aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-11 23:52:49 -0500
committerCraig Jennings <c@cjennings.net>2026-07-11 23:52:49 -0500
commitb0ca38bc98f240e208edd08009856ab6de62c227 (patch)
tree0412890e4480ade5e954104d428178bba3f4e64c /docs
parentb137223e76c75217b594bc5e46e7625b10e31b0f (diff)
downloadarchsetup-b0ca38bc98f240e208edd08009856ab6de62c227.tar.gz
archsetup-b0ca38bc98f240e208edd08009856ab6de62c227.zip
refactor(gallery): rename generated tokens.el to gallery-tokens.el
The generated file declares (provide 'gallery-tokens), but `require` resolves a feature by filename, so as tokens.el it could never load from a load-path. The name now matches the feature. gen_tokens.py, the renderer's load, and the README follow.
Diffstat (limited to 'docs')
-rw-r--r--docs/prototypes/README.org4
-rw-r--r--docs/prototypes/gallery-tokens.el (renamed from docs/prototypes/tokens.el)0
-rw-r--r--docs/prototypes/gallery-widget.el6
-rw-r--r--docs/prototypes/gen_tokens.py8
4 files changed, 11 insertions, 7 deletions
diff --git a/docs/prototypes/README.org b/docs/prototypes/README.org
index 3f2e3be..674a45d 100644
--- a/docs/prototypes/README.org
+++ b/docs/prototypes/README.org
@@ -28,10 +28,10 @@ family, glows, pulse rate). [[file:gen_tokens.py][gen_tokens.py]] regenerates al
- the =:root= block inside the gallery HTML (web CSS custom properties)
- [[file:tokens-waybar.css][tokens-waybar.css]] — GTK =@define-color= declarations for the waybar panels
-- [[file:tokens.el][tokens.el]] — an elisp alist for svg.el renderers
+- [[file:gallery-tokens.el][gallery-tokens.el]] — an elisp alist for svg.el renderers
[[file:gallery-widget.el][gallery-widget.el]] is the Emacs renderer (proof widget: the needle gauge,
-gallery card 10) — it reads tokens.el and emits the widget as SVG via
+gallery card 10) — it reads gallery-tokens.el and emits the widget as SVG via
svg.el, so the same look renders inside Emacs. Tests:
=tests/gallery-tokens/= (generator, unittest) and =tests/gallery-widgets/=
(renderer, ERT), both in =make test-unit=.
diff --git a/docs/prototypes/tokens.el b/docs/prototypes/gallery-tokens.el
index 1fb6e52..1fb6e52 100644
--- a/docs/prototypes/tokens.el
+++ b/docs/prototypes/gallery-tokens.el
diff --git a/docs/prototypes/gallery-widget.el b/docs/prototypes/gallery-widget.el
index 61cd78a..1c96f45 100644
--- a/docs/prototypes/gallery-widget.el
+++ b/docs/prototypes/gallery-widget.el
@@ -3,8 +3,8 @@
;;; Commentary:
;; Proof-of-concept Emacs target for the panel widget gallery. The web
;; gallery (panel-widget-gallery.html) is the visual spec; tokens.json is
-;; the shared source of truth, and gen_tokens.py emits tokens.el (the
-;; `gallery-tokens' alist this file reads). Same tokens, same geometry,
+;; the shared source of truth, and gen_tokens.py emits gallery-tokens.el
+;; (the `gallery-tokens' alist this file reads). Same tokens, same geometry,
;; different renderer — that's the reuse model: shared values and shared
;; SVG shapes, per-target code.
;;
@@ -25,7 +25,7 @@
(require 'svg)
(require 'dom)
-(load (expand-file-name "tokens.el"
+(load (expand-file-name "gallery-tokens.el"
(file-name-directory (or load-file-name buffer-file-name)))
nil t)
diff --git a/docs/prototypes/gen_tokens.py b/docs/prototypes/gen_tokens.py
index f966451..9f011e9 100644
--- a/docs/prototypes/gen_tokens.py
+++ b/docs/prototypes/gen_tokens.py
@@ -29,7 +29,7 @@ Usage:
The web CSS is written into panel-widget-gallery.html between the
`/* @tokens:start */` and `/* @tokens:end */` markers; the waybar and elisp
-targets are written to tokens-waybar.css and tokens.el beside it.
+targets are written to tokens-waybar.css and gallery-tokens.el beside it.
"""
import json
@@ -39,6 +39,10 @@ HERE = os.path.dirname(os.path.abspath(__file__))
TOKENS_START = "/* @tokens:start */"
TOKENS_END = "/* @tokens:end */"
+# The elisp target's filename must match its (provide 'gallery-tokens) so
+# `require` resolves it from a load-path.
+DEFAULT_ELISP_NAME = "gallery-tokens.el"
+
# sections whose values are plain colors (searched by resolve_color, and the
# ones that become @define-color / alist color entries)
COLOR_SECTIONS = ("palette", "amber")
@@ -152,7 +156,7 @@ def main(tokens_path=None, html_path=None, waybar_path=None, elisp_path=None):
tokens_path = tokens_path or os.path.join(HERE, "tokens.json")
html_path = html_path or os.path.join(HERE, "panel-widget-gallery.html")
waybar_path = waybar_path or os.path.join(HERE, "tokens-waybar.css")
- elisp_path = elisp_path or os.path.join(HERE, "tokens.el")
+ elisp_path = elisp_path or os.path.join(HERE, DEFAULT_ELISP_NAME)
with open(tokens_path) as f:
tokens = json.load(f)