Refactor org web platform and remove legacy code
All checks were successful
Build Org Website / build (push) Successful in 39s

This commit is contained in:
gitea-actions
2026-07-30 11:29:20 +01:00
parent dc1ca5c00e
commit fe8acac707
74 changed files with 2776 additions and 3386 deletions

View File

@@ -80,7 +80,9 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
(defun z/org-html-add-body-classes (output backend info)
"Add layout-related classes to <body> based on file metadata."
(if (org-export-derived-backend-p backend 'html)
(if (and (org-export-derived-backend-p backend 'html)
(not (and (fboundp 'z/rpg-standalone-file-p)
(z/rpg-standalone-file-p info))))
(let* ((input-file (plist-get info :input-file))
(classes
(delq nil
@@ -101,6 +103,47 @@ 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 standalone fantasy RPG about 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-1.0.1\" />\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)
(org-export-define-derived-backend 'z-html 'html
:filters-alist '((:filter-final-output . z/insert-filetags-after-title)))