Compare commits

...

3 Commits

4 changed files with 18 additions and 15 deletions

View File

@ -6,7 +6,7 @@
First we need to get all the posts
#+name: collect-posts
#+begin_src emacs-lisp
#+begin_src emacs-lisp :eval yes
(setq posts (nreverse
(directory-files (expand-file-name "../content" default-directory)
t "^[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9]-.+\\.org")))
@ -16,8 +16,9 @@ Word counting would be helpful, but ~count-words~ includes parts of the document
we don't want to count, like code blocks. To help us count words accurately, we
can just create a derived export backend which discards elements we don't care
about.
#+name: count-words-org
#+begin_src emacs-lisp
#+begin_src emacs-lisp :eval yes
(defun org-org-content (_blob content _info) (or content ""))
(org-export-define-derived-backend 'org-for-word-counting 'org
@ -52,7 +53,7 @@ about.
Then we want to format the content for inclusion.
#+name: post-formatting
#+begin_src emacs-lisp
#+begin_src emacs-lisp :eval yes
(defun post-item (file)
(with-temp-buffer
(insert-file-contents file)
@ -67,7 +68,7 @@ Then we want to format the content for inclusion.
* Output :ignore:
#+begin_src emacs-lisp :noweb yes :results raw :exports results
#+begin_src emacs-lisp :noweb yes :eval yes :results raw :exports results
<<collect-posts>>
<<count-words-org>>
<<post-formatting>>

View File

@ -26,7 +26,7 @@ First we need to get all the posts. To get a recent-first ordering we just need
to reverse the sorted directory listing.
#+name: collect-posts
#+begin_src emacs-lisp
#+begin_src emacs-lisp :eval yes
(setq posts (nreverse
(directory-files (expand-file-name "../content" default-directory)
t "^[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9]-.+\\.org")))
@ -36,7 +36,7 @@ Then we want to format the content for inclusion. Each file can be visited and
modified for inclusion.
#+name: post-formatting
#+begin_src emacs-lisp
#+begin_src emacs-lisp :eval yes
(defun format-post (file &optional truncate-length)
(with-temp-buffer
(insert-file-contents file)
@ -68,7 +68,7 @@ modified for inclusion.
* Output :ignore:
#+begin_src emacs-lisp :noweb yes :results raw :exports results
#+begin_src emacs-lisp :noweb yes :eval yes :results raw :exports results
<<collect-posts>>
<<post-formatting>>
(concat

View File

@ -57,7 +57,7 @@ content from being entirely re-parsed (see
information). This improvement is particularly noticeable when refiling and
archiving headings.
#+begin_src julia
#+begin_src julia :exports none
using StatsBase, Dates
timestamps = read(setenv(`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' --author="Ihor Radchenko <yantar92@gmail.com>" --grep=cache`,

View File

@ -130,6 +130,8 @@
user-full-name "TEC"
user-mail-address "contact.tmio@tecosaur.net")
(setf (alist-get :eval org-babel-default-header-args) "no")
;;; For some reason emoji detection doesn't seem to work, so let's just turn it on
;; (setcar (rassoc 'emoji org-latex-conditional-features) t)
@ -489,13 +491,13 @@ PROJECT is the current project."
(if (= html-changed-files 0)
(warn! "No changes to push")
(let ((default-directory html-dir))
(and (or source-draft-p
(prog1 (or (not html-draft-p)
(git-try-command "reset" "--soft" "HEAD~1"))
(dolist (file (mapcar #'cdr (get-unstaged-changes)))
(when (and (file-exists-p file)
(string-prefix-p "DRAFT-" (file-name-base file)))
(delete-file file)))))
(and (prog1 (or (not html-draft-p)
(git-try-command "reset" "--soft" "HEAD~1"))
(unless source-draft-p
(dolist (file (mapcar #'cdr (get-unstaged-changes)))
(when (and (file-exists-p file)
(string-prefix-p "DRAFT-" (file-name-base file)))
(delete-file file)))))
(git-try-command "add" "-A")
(git-try-command "commit" "--message" commit-message)
(git-try-command "push" (and html-draft-p "--force-with-lease"))))))