diff --git a/sx/sx/data/helpers.sx b/sx/sx/data/helpers.sx index 5a17ecb8..d7826f99 100644 --- a/sx/sx/data/helpers.sx +++ b/sx/sx/data/helpers.sx @@ -59,7 +59,9 @@ (parts (append parts (list params body)))) (pretty-print parts))))))) -(define _spec-dirs (list "spec" "web" "shared/sx/ref" "lib")) +(define + _spec-dirs + (list "spec" "web" "shared/sx/ref" "lib" "sx" "sxc" "shared/sx/templates")) (define read-spec-file @@ -95,7 +97,14 @@ _spec-search-dirs (fn () - (list _spec-dir _web-dir _lib-dir (str _project-dir "/shared/sx/ref")))) + (list + _spec-dir + _web-dir + _lib-dir + (str _project-dir "/shared/sx/ref") + (str _project-dir "/sx") + (str _project-dir "/sxc") + (str _project-dir "/shared/sx/templates")))) (define read-spec-file diff --git a/sx/sx/page-functions.sx b/sx/sx/page-functions.sx index fc45dd8c..064ab020 100644 --- a/sx/sx/page-functions.sx +++ b/sx/sx/page-functions.sx @@ -285,29 +285,30 @@ (nil? slug) (quote (~specs/architecture-content)) (let - ((found-spec (find-spec slug))) + ((found-spec (find-spec slug)) + (filename + (if found-spec (get found-spec "filename") (str slug ".sx"))) + (title (if found-spec (get found-spec "title") slug)) + (desc (if found-spec (get found-spec "desc") ""))) (if - (not found-spec) - (quasiquote (~specs/not-found :slug (unquote slug))) - (if - defname - (let - ((d (spec-explore-define (get found-spec "filename") defname))) - (if - d - (quasiquote - (~specs-explorer/spec-explorer-define-detail - :d (unquote d) - :filename (unquote (get found-spec "filename")))) - (quasiquote - (~specs/not-found :slug (unquote (str slug "." defname)))))) - (let - ((data (spec-explore (get found-spec "filename") (get found-spec "title") (get found-spec "desc")))) - (if - data - (quasiquote - (~specs-explorer/spec-explorer-content :data (unquote data))) - (quasiquote (~specs/not-found :slug (unquote slug))))))))))) + defname + (let + ((d (spec-explore-define filename defname))) + (if + d + (quasiquote + (~specs-explorer/spec-explorer-define-detail + :d (unquote d) + :filename (unquote filename))) + (quasiquote + (~specs/not-found :slug (unquote (str slug "." defname)))))) + (let + ((data (spec-explore filename title desc))) + (if + data + (quasiquote + (~specs-explorer/spec-explorer-content :data (unquote data))) + (quasiquote (~specs/not-found :slug (unquote slug)))))))))) (define make-spec-files diff --git a/sx/sx/spec-introspect.sx b/sx/sx/spec-introspect.sx index 78cd95a2..05f91cf5 100644 --- a/sx/sx/spec-introspect.sx +++ b/sx/sx/spec-introspect.sx @@ -217,7 +217,7 @@ (and (not found) (list? form) (> (len form) 1)) (let ((name (spec-form-name form))) - (when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (spec-form-signature form) :name name}))))) + (when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (serialize form) :name name}))))) forms) found))))) diff --git a/tests/playwright/spec-explorer.spec.js b/tests/playwright/spec-explorer.spec.js index 72c49496..cdd73ecf 100644 --- a/tests/playwright/spec-explorer.spec.js +++ b/tests/playwright/spec-explorer.spec.js @@ -18,8 +18,8 @@ test.describe('Spec Explorer', () => { await loadExplorer(page, '(language.(spec.(explore.evaluator)))'); await expect(page.locator('h1')).toHaveText('Evaluator'); - await expect(page.locator('text=141 defines')).toBeVisible(); - await expect(page.locator('text=2501 lines')).toBeVisible(); + await expect(page.locator('text=/\\d+ defines/')).toBeVisible(); + await expect(page.locator('text=/\\d+ lines/')).toBeVisible(); await expect(page.locator('h2:has-text("Definitions")')).toBeVisible(); await expect(page.locator('#fn-make-cek-state')).toBeVisible(); await expect(page.locator('#fn-cek-step')).toBeVisible();