Add category check ignore list to the doc build processs

Bu işleme şunda yer alıyor:
Sameer Rahmani 2022-07-04 15:33:14 +01:00
ebeveyn c47738ce86
işleme 4aec122767
3 değiştirilmiş dosya ile 50 ekleme ve 36 silme

Dosyayı Görüntüle

@ -29,12 +29,14 @@
(setq debug-on-error t)
(defconst fg42/CORE_DIR (concat (getenv "HOME") "/.fg42/core"))
(setenv "FG42_HOME" (concat (getenv "HOME") "/.fg42/"))
(defconst fg42/CORE_DIR (concat (getenv "FG42_HOME") "core"))
(setq user-emacs-directory (concat (getenv "FG42_HOME") "emacs.d"))
(setq user-emacs-directory (concat (getenv "HOME") "/.fg42/emacs.d"))
(add-to-list 'load-path fg42/CORE_DIR)
(require 'fg42/build/core)
(require 'fg42/build/utils)
(defvar FG42-VERSION "3.0.0-snapshot"
"The version number of the current build of FG42.")
@ -54,12 +56,6 @@ PARAMS:
")
(defproject FG42
project-root (nth 2 command-line-args-left)
docs-actions '(fg42/build-prepare-docs))
(defun print-help (command)
"Print out a usage instructions and print out the invalid msg for COMMAND."
(when command
@ -67,18 +63,15 @@ PARAMS:
(message build/usage))
(defmacro do-command (&rest body)
"Run the BODY after loading FG42."
`(progn
(require 'fg42)
(fg42/before-initialize)
,@body))
(defproject FG42
project-root (nth 2 command-line-args-left)
docs-actions '(fg42/build-prepare-docs))
(defun main ()
"The entry point to the build script."
(message (version))
(message "\nFG42 Build tool v%s\n\n" FG42-VERSION)
(message (fg42/version))
(message "\nFG42 Build tool v%s\n\n" (fg42/version))
;; UTF-8 as default encoding
(prefer-coding-system 'utf-8)

Dosyayı Görüntüle

@ -50,6 +50,12 @@ project root.")
(defvar fg42/build-prod-base-url "https://fg42.org"
"The base url to use with the docs for production.")
(defvar fg42/build-docs-pages-dir "/pages"
"Where to find the pages (relative to docs dir)")
(defvar fg42/build-docs-ignore-category-check nil
"A list of files that should be ignored by category/tag checks")
(defvar fg42/build-docs-actions nil
"Set of actions to run before building the
main docs.")
@ -132,5 +138,13 @@ and write it to DEST."
(replace-in-buffer (format "<<<%s>>>" (car pair)) (cdr pair)))))
(defmacro do-command (&rest body)
"Run the BODY after loading FG42."
`(progn
(require 'fg42)
(fg42/before-initialize)
,@body))
(provide 'fg42/build/core)
;;; core.el ends here

Dosyayı Görüntüle

@ -51,13 +51,14 @@
(defun fg42/build-docs-copy-base (build-dir)
"Copy the base structure of the website to the BUILD-DIR."
(copy-directory (from-docs "/pages")
(expand-file-name "site/pages" build-dir) nil t))
(copy-directory (from-docs fg42/build-docs-pages-dir)
(expand-file-name (format "site/%s" fg42/build-docs-pages-dir)
build-dir)
nil t))
(defun fg42/build-prepare-docs (build-dir host)
"Prepare the documents and the website in the given BUILD-DIR."
(fg42/build-docs-copy-base build-dir)
;; Build the org files for each cube
(message "Processing the docs for all the cubes")
@ -162,22 +163,25 @@ Not pages."
(seq-reduce
;; all-cats is in (cats . cat->files) form
(lambda (all-cats file)
(let ((is-page? (string= (get-file-global-props file "PAGE") "true"))
(cat (get-file-global-props file "CATEGORY"))
(cat-list (car all-cats))
(cat->file (cdr all-cats)))
(if (not (member (file-relative-name file org-directory)
fg42/build-docs-ignore-category-check))
(let ((is-page? (string= (get-file-global-props file "PAGE") "true"))
(cat (get-file-global-props file "CATEGORY"))
(cat-list (car all-cats))
(cat->file (cdr all-cats)))
(if (not is-page?)
(cons
;; Category list
(if (member cat cat-list) cat-list (sort (cons cat cat-list) 'string<))
;; cat->file
(cons (cons cat
;; Current value of the the given cat (all the files
;; under that category)
(append (list file) (cdr (assoc cat cat->file))))
cat->file))
all-cats)))
(if (not is-page?)
(cons
;; Category list
(if (member cat cat-list) cat-list (sort (cons cat cat-list) 'string<))
;; cat->file
(cons (cons cat
;; Current value of the the given cat (all the files
;; under that category)
(append (list file) (cdr (assoc cat cat->file))))
cat->file))
all-cats))
all-cats))
(all-org-files)
'()))
@ -244,10 +248,11 @@ Not pages."
(when (null tag)
(message "[Error]: The following files are missig a category: %s"
(mapconcat
(lambda (x) (format " %s\n" x))
(lambda (x) (format " %s" x))
(sort
(mapcar #'pair-file-with-date files)
(lambda (x y) (> (car x) (car y))))))
(lambda (x y) (> (car x) (car y))))
"\n"))
(error "The above list of files are missing a category"))
(copy-template
@ -276,6 +281,8 @@ Not pages."
(stage1-dir (expand-file-name "site" build-dir))
(final-dir (expand-file-name "site-build" build-dir)))
(fg42/build-docs-copy-base build-dir)
;; Apply all the actions
(mapcar (lambda (f)
(funcall f build-dir base-url))