Move the docs deps to docs.el

This commit is contained in:
Sameer Rahmani 2022-07-04 17:34:09 +01:00
parent 5780b87886
commit 46932dcacd
2 changed files with 50 additions and 10 deletions

View File

@ -71,13 +71,6 @@ PARAMS:
(command-> command args (command-> command args
((string= command "docs") ((string= command "docs")
(do-command (do-command
(require 'fpkg)
(fpkg/use dash)
(fpkg/use mustache)
(fpkg/use ht)
(fpkg/use htmlize)
(require 'fg42/build/docs) (require 'fg42/build/docs)
(fg42/build-docs build-dir))) (fg42/build-docs build-dir)))

View File

@ -25,7 +25,15 @@
;; way. Cubes are composable and a composition of cubes creates an editor. ;; way. Cubes are composable and a composition of cubes creates an editor.
;; ;;
;;; Code: ;;; Code:
(require 'fpkg)
(fpkg/use dash)
(fpkg/use mustache)
(fpkg/use ht)
(fpkg/use htmlize)
(fpkg/use ox-rss)
(require 'ox-html) (require 'ox-html)
(require 'ox-rss)
(require 'cubes/all) (require 'cubes/all)
(require 'fg42/build/core) (require 'fg42/build/core)
@ -166,6 +174,26 @@ Not pages."
"\n"))) "\n")))
(defun latest-org-list-rss (base-url)
"Return a list of headlines (using BASE-URL) for the RSS."
(let ((posts (get-all-sorted-posts)))
(mapconcat
(lambda (post)
(format "* %s\n:PROPERTIES:\n:RSS_PERMALINK:%s%s/%s?%s\n:END:"
;; Title
(nth 1 post)
base-url
fg42/build-docs-pages-dir
;; Path
(nth 2 post)
;; Hash
(car post)
;; Title
(nth 1 post)))
posts
"\n")))
(defun get-all-categories () (defun get-all-categories ()
"Return all the categories of the org files." "Return all the categories of the org files."
(seq-reduce (seq-reduce
@ -338,6 +366,12 @@ Not pages."
(expand-file-name "site/tags/index.org" build-dir) (expand-file-name "site/tags/index.org" build-dir)
`((:links . ,(tags-org-list)))) `((:links . ,(tags-org-list))))
(message "Creating the rss feed")
(copy-template (from-docs "/templates/rss.org")
(expand-file-name "site/rss.org" build-dir)
`((:base-url . ,base-url)
(:posts . ,(latest-org-list-rss base-url))))
(create-tag-pages build-dir) (create-tag-pages build-dir)
(setq org-html-preamble #'preamble-fn) (setq org-html-preamble #'preamble-fn)
@ -377,19 +411,32 @@ Not pages."
:sitemap-filename "sitemap.inc" :sitemap-filename "sitemap.inc"
:sitemap-sort-files anti-chronologically :sitemap-sort-files anti-chronologically
:html-format-headline-function headline-format :html-format-headline-function headline-format
:exclude "rss.org"
:makeindex nil) :makeindex nil)
("rss"
:base-directory ,stage1-dir
:base-extension "org"
:html-link-home ,base-url
:html-link-use-abs-url t
:rss-extension "xml"
:publishing-directory ,final-dir
:publishing-function (org-rss-publish-to-rss)
:section-numbers nil
:exclude ".*" ;; To exclude all files...
:include ("rss.org") ;; ... except index.org.
:table-of-contents nil)
("statics" ("statics"
:base-directory ,stage1-dir :base-directory ,stage1-dir
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|svg" :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|svg"
:publishing-directory ,final-dir :publishing-directory ,final-dir
:recursive t :recursive t
:publishing-function org-publish-attachment) :publishing-function org-publish-attachment)
("build" :components ("website" "statics")))) ("build" :components ("website" "statics" "rss"))))
(org-publish-project "build" t nil) (org-publish-project "build" t nil)
(message "Build complete.") (message "Build complete.")))
))
(provide 'fg42/build/docs) (provide 'fg42/build/docs)
;;; docs.el ends here ;;; docs.el ends here