From bc95a3fa1a8c67f0a3811467f5264beb543adf80 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 3 Jul 2022 23:27:34 +0100 Subject: [PATCH] Break down the docs path into vars --- core/fg42/build/core.el | 10 ++++++++++ core/fg42/build/docs.el | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/core/fg42/build/core.el b/core/fg42/build/core.el index aa24504..8057556 100644 --- a/core/fg42/build/core.el +++ b/core/fg42/build/core.el @@ -40,6 +40,11 @@ (defvar fg42/build-author-name "Sameer Rahmani") (defvar fg42/build-author-email "lxsameer@gnu.org") +(defvar fg42/build-docs-root "/docs/site" + "Where to find the docs. It sould be relative to the +project root.") + + (defvar fg42/build-docs-actions nil "Set of actions to run before building the main docs.") @@ -68,6 +73,11 @@ The build system will consum these details for various purposes." (concat fg42/build-project-root path)) +(defun from-docs (path) + "Return the full path of the given PATH in the docs root." + (concat (from-root fg42/build-docs-root) path)) + + (defun prod-p () "Return non-nil if debug mode is turned off" (not fg42/build-debug-mode)) diff --git a/core/fg42/build/docs.el b/core/fg42/build/docs.el index 758d91a..4a85d05 100644 --- a/core/fg42/build/docs.el +++ b/core/fg42/build/docs.el @@ -51,7 +51,7 @@ (defun fg42/build-docs-copy-base (build-dir) "Copy the base structure of the website to the BUILD-DIR." - (copy-directory (from-root "/docs/site/pages") + (copy-directory (from-docs "/pages") (expand-file-name "site/pages" build-dir) nil t)) @@ -212,7 +212,7 @@ Not pages." (let ((out (format "%s/site/tags/%s.org" build-dir (or tag "Uncategorized"))) (files (cdr (assoc tag (cdr tags))))) (copy-template - (from-root "/docs/site/templates/links_template.org") + (from-docs "/templates/links_template.org") out (list (cons :links @@ -251,7 +251,7 @@ Not pages." (error "The above list of files are missing a category")) (copy-template - (from-root "/docs/site/templates/links_template.org") + (from-docs "/templates/links_template.org") out (list (cons :links @@ -282,7 +282,7 @@ Not pages." fg42/build-docs-actions) ;; Copy the assets - (copy-directory (from-root "/docs/site/assets") + (copy-directory (from-docs "/assets") (expand-file-name "assets" stage1-dir) nil t) ;; We will use the org-agenda to extract all the tags @@ -301,25 +301,25 @@ Not pages." (setf org-html-link-home "") (setf org-html-scripts "") - (copy-template (from-root "/docs/site/config.org") + (copy-template (from-docs "/config.org") (expand-file-name "config.org" build-dir) '()) (message "Creating the main index file") - (copy-template (from-root "/docs/site/templates/index.org") + (copy-template (from-docs "/templates/index.org") (expand-file-name "site/index.org" build-dir) `((:links . ,(latest-org-list base-url)) (:base-url . ,base-url))) (message "Creating categories") - (copy-template (from-root "/docs/site/templates/categories.org") + (copy-template (from-docs "/templates/categories.org") (expand-file-name "site/categories/index.org" build-dir) `((:links . ,(category-org-list)))) (create-category-pages build-dir) (message "Creating tags") - (copy-template (from-root "/docs/site/templates/tags.org") + (copy-template (from-docs "/templates/tags.org") (expand-file-name "site/tags/index.org" build-dir) `((:links . ,(tags-org-list)))) @@ -349,10 +349,10 @@ Not pages." :with-toc nil :base-url ,base-url :html-link-home "/" - :html-template ,(from-root "/docs/site/templates/blog.html") - :html-page-preamble-template ,(from-root "/docs/site/templates/page-preamble.html") - :html-post-preabmle-template ,(from-root "/docs/site/templates/post-preamble.html") - :html-tags-template ,(from-root "/docs/site/templates/tags.html") + :html-template ,(from-docs "/templates/blog.html") + :html-page-preamble-template ,(from-docs "/templates/page-preamble.html") + :html-post-preabmle-template ,(from-docs "/templates/post-preamble.html") + :html-tags-template ,(from-docs "/templates/tags.html") :publishing-function org-html-publish-to-templated-html :auto-sitemap t :htmlized-source nil