forked from FG42/FG42
Fix the issue with changing the working directory on rss generator
This commit is contained in:
parent
640ed5b8e4
commit
fa32c4d416
|
@ -92,6 +92,7 @@ The build system will consum these details for various purposes."
|
||||||
|
|
||||||
|
|
||||||
(defmacro command-> (command-var args-var &rest body)
|
(defmacro command-> (command-var args-var &rest body)
|
||||||
|
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
`(defun main ()
|
`(defun main ()
|
||||||
"The entry point to the build script."
|
"The entry point to the build script."
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
|
|
||||||
(defun fg42/build-prepare-docs (build-dir host)
|
(defun fg42/build-prepare-docs (build-dir host)
|
||||||
"Prepare the documents and the website in the given BUILD-DIR."
|
"Prepare the documents and the website in the given BUILD-DIR and HOST."
|
||||||
|
|
||||||
;; Build the org files for each cube
|
;; Build the org files for each cube
|
||||||
(message "Processing the docs for all the cubes")
|
(message "Processing the docs for all the cubes")
|
||||||
|
|
|
@ -121,7 +121,7 @@ call `org-html-render-tag-template' otherwise will call ORIG-FN."
|
||||||
("base-url" (plist-get info :base-url))
|
("base-url" (plist-get info :base-url))
|
||||||
("preamble" (org-html--build-pre/postamble 'preamble info))
|
("preamble" (org-html--build-pre/postamble 'preamble info))
|
||||||
("title" (get-file-global-props (plist-get info :input-file) "TITLE"))
|
("title" (get-file-global-props (plist-get info :input-file) "TITLE"))
|
||||||
("version" (fg42/version))
|
("version" (fg42/project-version))
|
||||||
("description" (or (get-file-global-props (plist-get info :input-file) "DESC")
|
("description" (or (get-file-global-props (plist-get info :input-file) "DESC")
|
||||||
""))
|
""))
|
||||||
("postamble" (org-html--build-pre/postamble 'postamble info)))))
|
("postamble" (org-html--build-pre/postamble 'postamble info)))))
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
(require 'fg42/build/core)
|
(require 'fg42/build/core)
|
||||||
|
|
||||||
(defun fg42/rss-map-items (file-and-props link)
|
(defun fg42/rss-map-items (file-and-props link)
|
||||||
"Create a RSS item from the given org FILE with the give http LINK"
|
"Create a RSS item from the given org FILE with the give http LINK."
|
||||||
(let* ((file (car file-and-props))
|
(let* ((file (car file-and-props))
|
||||||
(values (cadr file-and-props)))
|
(values (cadr file-and-props)))
|
||||||
(format
|
(format
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
(nth 2 post))))
|
(nth 2 post))))
|
||||||
|
|
||||||
(defun fg42/rss-create (posts base-url dest)
|
(defun fg42/rss-create (posts base-url dest)
|
||||||
"Create a RSS xml file via POSTS for the give BASE-URL and save to DEST"
|
"Create a RSS xml file via POSTS for the give BASE-URL and save to DEST."
|
||||||
(with-temp-file dest
|
(with-temp-file dest
|
||||||
(insert
|
(insert
|
||||||
(format
|
(format
|
||||||
|
@ -86,8 +86,9 @@
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda (post)
|
(lambda (post)
|
||||||
(fg42/rss-create-item post base-url))
|
(fg42/rss-create-item post base-url))
|
||||||
posts)))))
|
posts
|
||||||
|
"")))))
|
||||||
|
|
||||||
|
|
||||||
(provide 'fg42/build/rss)
|
(provide 'fg42/build/rss)
|
||||||
;;; docs.el ends here
|
;;; rss.el ends here
|
||||||
|
|
|
@ -59,17 +59,21 @@
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
(get-buffer-global-props prop)))
|
(get-buffer-global-props prop)))
|
||||||
|
|
||||||
|
(defmacro with-cwd (path &rest body)
|
||||||
|
"Run the BODY with PATH as the current working dir."
|
||||||
|
`(let ((cwd (getenv "PWD"))
|
||||||
|
(default-directory ,path))
|
||||||
|
(cd default-directory)
|
||||||
|
(prog1
|
||||||
|
,@body
|
||||||
|
(cd cwd))))
|
||||||
|
|
||||||
(defun fg42/exctract-keywords (file keys)
|
(defun fg42/exctract-keywords (file keys)
|
||||||
"Create a RSS item from the given org FILE"
|
"Create a RSS item from the given org FILE for the give KEYS."
|
||||||
(let ((cwd (getenv "PWD"))
|
(with-cwd (file-name-directory file)
|
||||||
(old-org-directory org-directory))
|
|
||||||
(cd fg42/build-project-root)
|
|
||||||
(prog1
|
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
(org-collect-keywords keys))
|
(org-collect-keywords keys))))
|
||||||
(cd cwd))))
|
|
||||||
|
|
||||||
|
|
||||||
(defun pair-file-with-date (file)
|
(defun pair-file-with-date (file)
|
||||||
|
@ -87,15 +91,20 @@
|
||||||
|
|
||||||
|
|
||||||
(defun fg42/git-branch ()
|
(defun fg42/git-branch ()
|
||||||
(cd fg42/build-project-root)
|
"Return the branch name of the project."
|
||||||
(shell-command-to-string "git branch --show-current"))
|
(let ((default-directory fg42/build-project-root))
|
||||||
|
(shell-command-to-string "git branch --show-current")))
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/project-version ()
|
||||||
|
"Return the current version of the project."
|
||||||
|
(let ((default-directory fg42/build-project-root))
|
||||||
|
(shell-command-to-string (format "git describe %s" (fg42/git-branch)))))
|
||||||
|
|
||||||
(defun fg42/version ()
|
(defun fg42/version ()
|
||||||
"Returns the current version of FG42."
|
"Return the current version of the project."
|
||||||
(cd fg42/build-project-root)
|
(let ((default-directory (getenv "FG42_HOME")))
|
||||||
(shell-command-to-string (format "git describe %s" (fg42/git-branch))))
|
(shell-command-to-string (format "git describe %s" (fg42/git-branch)))))
|
||||||
|
|
||||||
|
|
||||||
(provide 'fg42/build/utils)
|
(provide 'fg42/build/utils)
|
||||||
;;; utils.el ends here
|
;;; utils.el ends here
|
||||||
|
|
|
@ -705,7 +705,8 @@ Never evaluate the arguments of a macro manually. E.g. with =eval=
|
||||||
|
|
||||||
More info: https://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Expansion.html
|
More info: https://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Expansion.html
|
||||||
** What's next?
|
** What's next?
|
||||||
* Episode 12 - Features & Load Paths
|
* DONE Episode 12 - Features & Load Paths
|
||||||
|
CLOSED: [2023-01-14 Sat 11:44]
|
||||||
** Emacs Lisp files
|
** Emacs Lisp files
|
||||||
Write elisp code in files with =.el= suffix.
|
Write elisp code in files with =.el= suffix.
|
||||||
|
|
||||||
|
@ -777,3 +778,4 @@ We can clone a library somewhere on the disk and add the path to it to the =load
|
||||||
and load the library files.
|
and load the library files.
|
||||||
|
|
||||||
But that would be tedious to do so for all the libraries. That's why we use a package manager
|
But that would be tedious to do so for all the libraries. That's why we use a package manager
|
||||||
|
* Episode 13 - Hooks
|
||||||
|
|
Loading…
Reference in New Issue