Remove obsolete generated assets and dead code
All checks were successful
Build Org Website / build (push) Successful in 43s
All checks were successful
Build Org Website / build (push) Successful in 43s
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
"wird-tracker.css"
|
||||
"zhd.css"
|
||||
"play.css"
|
||||
"pages/house.css"
|
||||
"hidden-details.css")
|
||||
"\n")
|
||||
"\n"
|
||||
@@ -60,7 +59,6 @@
|
||||
"pages/wird-tracker.js"
|
||||
"pages/home-dashboard.js"
|
||||
"pages/play.js"
|
||||
"pages/house.js"
|
||||
"features/hidden-details.js")
|
||||
"\n")
|
||||
(format "<script src=\"%s\"></script>"
|
||||
|
||||
@@ -103,85 +103,6 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
|
||||
(add-to-list 'org-export-filter-body-functions
|
||||
#'z/org-html-insert-comments-into-body)
|
||||
|
||||
(defconst z/rpg-standalone-start "<!-- RPG-STANDALONE-START -->")
|
||||
(defconst z/rpg-standalone-end "<!-- RPG-STANDALONE-END -->")
|
||||
|
||||
(defun z/rpg-standalone-file-p (info)
|
||||
"Return non-nil when INFO describes the dedicated RPG page."
|
||||
(let ((input-file (plist-get info :input-file)))
|
||||
(and input-file
|
||||
(string= (file-truename input-file)
|
||||
(file-truename (site-path "play/rpg.org"))))))
|
||||
|
||||
(defun z/render-rpg-standalone (output backend info)
|
||||
"Replace normal site chrome with a dedicated game document for the RPG."
|
||||
(if (and (org-export-derived-backend-p backend 'html)
|
||||
(z/rpg-standalone-file-p info))
|
||||
(let* ((start (string-match (regexp-quote z/rpg-standalone-start) output))
|
||||
(end (and start (string-match (regexp-quote z/rpg-standalone-end) output start))))
|
||||
(if (and start end)
|
||||
(let* ((body-start (+ start (length z/rpg-standalone-start)))
|
||||
(body (substring output body-start end))
|
||||
(body (replace-regexp-in-string
|
||||
"<link rel=\"stylesheet\" href=\"/assets/styles/pages/princess-lima-rpg.css[^\"]*\" />"
|
||||
""
|
||||
body)))
|
||||
(concat
|
||||
"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n"
|
||||
"<meta charset=\"utf-8\" />\n"
|
||||
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\" />\n"
|
||||
"<meta name=\"theme-color\" content=\"#080a12\" />\n"
|
||||
"<meta name=\"description\" content=\"A storybook pixel fantasy RPG about helping a wounded kingdom and rescuing Princess Lima.\" />\n"
|
||||
"<title>Rescue Princess Lima</title>\n"
|
||||
"<link rel=\"icon\" href=\"/assets/icons/icons8-film-tape-100.png\" />\n"
|
||||
"<link rel=\"stylesheet\" href=\"/assets/styles/pages/princess-lima-rpg.css?v=princess-lima-2.0.0\" />\n"
|
||||
"</head>\n<body class=\"princess-lima-page\">\n"
|
||||
body
|
||||
"\n</body>\n</html>\n"))
|
||||
output))
|
||||
output))
|
||||
|
||||
(add-to-list 'org-export-filter-final-output-functions
|
||||
#'z/render-rpg-standalone)
|
||||
|
||||
(defconst z/two-rivers-standalone-start "<!-- TWO-RIVERS-STANDALONE-START -->")
|
||||
(defconst z/two-rivers-standalone-end "<!-- TWO-RIVERS-STANDALONE-END -->")
|
||||
|
||||
(defun z/two-rivers-standalone-file-p (info)
|
||||
"Return non-nil when INFO describes the Two Rivers game page."
|
||||
(let ((input-file (plist-get info :input-file)))
|
||||
(and input-file
|
||||
(string= (file-truename input-file)
|
||||
(file-truename (site-path "play/two-rivers.org"))))))
|
||||
|
||||
(defun z/render-two-rivers-standalone (output backend info)
|
||||
"Replace normal site chrome with a dedicated Two Rivers game document."
|
||||
(if (and (org-export-derived-backend-p backend 'html)
|
||||
(z/two-rivers-standalone-file-p info))
|
||||
(let* ((start (string-match (regexp-quote z/two-rivers-standalone-start) output))
|
||||
(end (and start (string-match (regexp-quote z/two-rivers-standalone-end) output start))))
|
||||
(if (and start end)
|
||||
(let ((body (substring
|
||||
output
|
||||
(+ start (length z/two-rivers-standalone-start))
|
||||
end)))
|
||||
(concat
|
||||
"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n"
|
||||
"<meta charset=\"utf-8\" />\n"
|
||||
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\" />\n"
|
||||
"<meta name=\"theme-color\" content=\"#07131b\" />\n"
|
||||
"<meta name=\"description\" content=\"Two Rivers at Moonrise, a painterly browser romance adventure starring Z and Princess Lima.\" />\n"
|
||||
"<title>Two Rivers at Moonrise</title>\n"
|
||||
"<link rel=\"icon\" href=\"/assets/icons/icons8-film-tape-100.png\" />\n"
|
||||
"</head>\n<body class=\"two-rivers-page\">\n"
|
||||
body
|
||||
"\n</body>\n</html>\n"))
|
||||
output))
|
||||
output))
|
||||
|
||||
(add-to-list 'org-export-filter-final-output-functions
|
||||
#'z/render-two-rivers-standalone)
|
||||
|
||||
(org-export-define-derived-backend 'z-html 'html
|
||||
:filters-alist '((:filter-final-output . z/insert-filetags-after-title)))
|
||||
|
||||
|
||||
@@ -261,58 +261,4 @@
|
||||
(result (z/org-html-add-body-classes output 'latex info)))
|
||||
(should (string= output result))))))
|
||||
|
||||
;; ── standalone RPG export ────────────────────────────────────────────────────
|
||||
|
||||
(ert-deftest test/rpg-standalone-export-removes-normal-site-chrome ()
|
||||
"The RPG final-output filter should return a dedicated viewport document."
|
||||
(let* ((info (list :input-file (site-path "play/rpg.org")))
|
||||
(output (concat
|
||||
"<html><head><script src=\"search.js\"></script></head><body>"
|
||||
"<div class=\"banner-header\">Normal site</div>"
|
||||
z/rpg-standalone-start
|
||||
"<main data-princess-lima-rpg>Game</main>"
|
||||
"<script src=\"/assets/scripts/pages/princess-lima-game.js\"></script>"
|
||||
z/rpg-standalone-end
|
||||
"<footer>Normal footer</footer></body></html>"))
|
||||
(result (z/render-rpg-standalone output 'html info)))
|
||||
(should (string-match-p "class=\"princess-lima-page\"" result))
|
||||
(should (string-match-p "data-princess-lima-rpg" result))
|
||||
(should (string-match-p "princess-lima-game.js" result))
|
||||
(should-not (string-match-p "banner-header" result))
|
||||
(should-not (string-match-p "Normal footer" result))
|
||||
(should-not (string-match-p "search.js" result))))
|
||||
|
||||
(ert-deftest test/rpg-standalone-export-ignores-other-pages ()
|
||||
"Normal pages must retain their existing exported document."
|
||||
(let* ((info (list :input-file (site-path "index.org")))
|
||||
(output "<html><body><div class=\"banner-header\">Site</div></body></html>"))
|
||||
(should (string= output (z/render-rpg-standalone output 'html info)))))
|
||||
|
||||
;; ── standalone Two Rivers export ─────────────────────────────────────────────
|
||||
|
||||
(ert-deftest test/two-rivers-standalone-export-removes-normal-site-chrome ()
|
||||
"The Two Rivers final-output filter should return a dedicated game document."
|
||||
(let* ((info (list :input-file (site-path "play/two-rivers.org")))
|
||||
(output (concat
|
||||
"<html><head><script src=\"search.js\"></script></head><body>"
|
||||
"<div class=\"banner-header\">Normal site</div>"
|
||||
z/two-rivers-standalone-start
|
||||
"<main data-two-rivers>Game</main>"
|
||||
"<script type=\"module\" src=\"/assets/scripts/games/two-rivers/main.js\"></script>"
|
||||
z/two-rivers-standalone-end
|
||||
"<footer>Normal footer</footer></body></html>"))
|
||||
(result (z/render-two-rivers-standalone output 'html info)))
|
||||
(should (string-match-p "class=\"two-rivers-page\"" result))
|
||||
(should (string-match-p "data-two-rivers" result))
|
||||
(should (string-match-p "two-rivers/main.js" result))
|
||||
(should-not (string-match-p "banner-header" result))
|
||||
(should-not (string-match-p "Normal footer" result))
|
||||
(should-not (string-match-p "search.js" result))))
|
||||
|
||||
(ert-deftest test/two-rivers-standalone-export-ignores-other-pages ()
|
||||
"The Two Rivers filter must leave every other page unchanged."
|
||||
(let* ((info (list :input-file (site-path "play/rpg.org")))
|
||||
(output "<html><body><main>Existing RPG</main></body></html>"))
|
||||
(should (string= output (z/render-two-rivers-standalone output 'html info)))))
|
||||
|
||||
;;; build-site-tests.el ends here
|
||||
|
||||
Reference in New Issue
Block a user