Add standalone export for Two Rivers at Moonrise
All checks were successful
Build Org Website / build (push) Successful in 44s
All checks were successful
Build Org Website / build (push) Successful in 44s
This commit is contained in:
@@ -144,6 +144,44 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
|
||||
(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)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user