Compare commits
3 Commits
42be4d084d
...
7690dc82f2
Author | SHA1 | Date |
---|---|---|
|
7690dc82f2 | |
|
c3df4d429e | |
|
e06489bc45 |
|
@ -6,7 +6,7 @@
|
||||||
First we need to get all the posts
|
First we need to get all the posts
|
||||||
|
|
||||||
#+name: collect-posts
|
#+name: collect-posts
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp :eval yes
|
||||||
(setq posts (nreverse
|
(setq posts (nreverse
|
||||||
(directory-files (expand-file-name "../content" default-directory)
|
(directory-files (expand-file-name "../content" default-directory)
|
||||||
t "^[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9]-.+\\.org")))
|
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
|
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
|
can just create a derived export backend which discards elements we don't care
|
||||||
about.
|
about.
|
||||||
|
|
||||||
#+name: count-words-org
|
#+name: count-words-org
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp :eval yes
|
||||||
(defun org-org-content (_blob content _info) (or content ""))
|
(defun org-org-content (_blob content _info) (or content ""))
|
||||||
|
|
||||||
(org-export-define-derived-backend 'org-for-word-counting 'org
|
(org-export-define-derived-backend 'org-for-word-counting 'org
|
||||||
|
@ -52,7 +53,7 @@ about.
|
||||||
Then we want to format the content for inclusion.
|
Then we want to format the content for inclusion.
|
||||||
|
|
||||||
#+name: post-formatting
|
#+name: post-formatting
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp :eval yes
|
||||||
(defun post-item (file)
|
(defun post-item (file)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
|
@ -67,7 +68,7 @@ Then we want to format the content for inclusion.
|
||||||
|
|
||||||
* Output :ignore:
|
* 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>>
|
<<collect-posts>>
|
||||||
<<count-words-org>>
|
<<count-words-org>>
|
||||||
<<post-formatting>>
|
<<post-formatting>>
|
||||||
|
|
|
@ -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.
|
to reverse the sorted directory listing.
|
||||||
|
|
||||||
#+name: collect-posts
|
#+name: collect-posts
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp :eval yes
|
||||||
(setq posts (nreverse
|
(setq posts (nreverse
|
||||||
(directory-files (expand-file-name "../content" default-directory)
|
(directory-files (expand-file-name "../content" default-directory)
|
||||||
t "^[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9]-.+\\.org")))
|
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.
|
modified for inclusion.
|
||||||
|
|
||||||
#+name: post-formatting
|
#+name: post-formatting
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp :eval yes
|
||||||
(defun format-post (file &optional truncate-length)
|
(defun format-post (file &optional truncate-length)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
|
@ -68,7 +68,7 @@ modified for inclusion.
|
||||||
|
|
||||||
* Output :ignore:
|
* 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>>
|
<<collect-posts>>
|
||||||
<<post-formatting>>
|
<<post-formatting>>
|
||||||
(concat
|
(concat
|
||||||
|
|
|
@ -57,7 +57,7 @@ content from being entirely re-parsed (see
|
||||||
information). This improvement is particularly noticeable when refiling and
|
information). This improvement is particularly noticeable when refiling and
|
||||||
archiving headings.
|
archiving headings.
|
||||||
|
|
||||||
#+begin_src julia
|
#+begin_src julia :exports none
|
||||||
using StatsBase, Dates
|
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`,
|
timestamps = read(setenv(`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' --author="Ihor Radchenko <yantar92@gmail.com>" --grep=cache`,
|
||||||
|
|
16
publish.el
16
publish.el
|
@ -130,6 +130,8 @@
|
||||||
user-full-name "TEC"
|
user-full-name "TEC"
|
||||||
user-mail-address "contact.tmio@tecosaur.net")
|
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
|
;;; 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)
|
;; (setcar (rassoc 'emoji org-latex-conditional-features) t)
|
||||||
|
@ -489,13 +491,13 @@ PROJECT is the current project."
|
||||||
(if (= html-changed-files 0)
|
(if (= html-changed-files 0)
|
||||||
(warn! "No changes to push")
|
(warn! "No changes to push")
|
||||||
(let ((default-directory html-dir))
|
(let ((default-directory html-dir))
|
||||||
(and (or source-draft-p
|
(and (prog1 (or (not html-draft-p)
|
||||||
(prog1 (or (not html-draft-p)
|
(git-try-command "reset" "--soft" "HEAD~1"))
|
||||||
(git-try-command "reset" "--soft" "HEAD~1"))
|
(unless source-draft-p
|
||||||
(dolist (file (mapcar #'cdr (get-unstaged-changes)))
|
(dolist (file (mapcar #'cdr (get-unstaged-changes)))
|
||||||
(when (and (file-exists-p file)
|
(when (and (file-exists-p file)
|
||||||
(string-prefix-p "DRAFT-" (file-name-base file)))
|
(string-prefix-p "DRAFT-" (file-name-base file)))
|
||||||
(delete-file file)))))
|
(delete-file file)))))
|
||||||
(git-try-command "add" "-A")
|
(git-try-command "add" "-A")
|
||||||
(git-try-command "commit" "--message" commit-message)
|
(git-try-command "commit" "--message" commit-message)
|
||||||
(git-try-command "push" (and html-draft-p "--force-with-lease"))))))
|
(git-try-command "push" (and html-draft-p "--force-with-lease"))))))
|
||||||
|
|
Loading…
Reference in New Issue