Update miscellany... things

Documentation, project configuration, GitHub workflow, and added a
template file which could be better if I'm using Cookiecutter.
This commit is contained in:
Gabriel Arazas 2021-11-07 18:42:50 +08:00
parent d27234e609
commit e33781ec0c
4 changed files with 62 additions and 43 deletions

View File

@ -1,5 +1,7 @@
name: Generate site to GitHub pages
on: [push]
on:
push:
- master
jobs:
generate-site:
runs-on: ubuntu-latest
@ -13,8 +15,7 @@ jobs:
with:
packages: nodejs,coreutils
script: |
mkdir -p site/public
mv notebook/* site/public
mv notebook/ site/public/
cd site
npm install
npm run build

View File

@ -130,34 +130,31 @@ Separate as may be, they can freely link other notes.
** Appendix — e.g., `#+begin_appendix`.
** link:https://docs.asciidoctor.org/asciidoc/latest/blocks/admonitions/[Admonition blocks] — e.g., `\#+begin_important`, `#+begin_tip`, `#+begin_warning`.
* Mainly uses https://zk.zettel.page/types-of-notes[the convention of note categories found in zk.zettel.page].
* All of my notes (in a normal sense) are in link:./notebook[`./notebook`].
Mainly uses https://zk.zettel.page/types-of-notes[the convention of note categories found in zk.zettel.page].
But in practice, the separation is a bit blurry so feel free to combine them in some way.
+
The entire point is separating the notes by purpose.
That said, just don't sweat it too much when you find something that doesn't belong there.
Ask yourself if a note really serves its intended purpose.
** Fleeting notes are in link:./daily/[`./daily/`].
** However, my fleeting notes are in link:./daily/[`./daily/`].
The fleeting notes are ignored since they're meant to processed on the daily so having them in the worktree will make a messy history.
It is basically my inbox for various things: my random realizations, ideas, and whatnot.
** My "traditional" notes is at link:./notebook/[`./notebook/`].
Since both of my evergreen and traditional notes are in the same folder, you can tell with the traditional notes not having a timestamp as the file name.
Practically, this is your 2D system of notes — the hierarchical notebook.
All notes here are named with the safe version of the filename (in kebab-case).
The filename is also just the normal path name except with the directory separator replaced with the dot (e.g., `cookbook/introduction-to-builder-pattern.org` will be `cookbook.introduction-to-builder-pattern.org`).
This allows to make a directory of flat files while representing the schema of your notes.
Pretty handy.
** Literature notes are in my notebook.
** Literature notes are in my notebook, too.
The file name are prefixed with `literature`.
These are notes from a specific resource (e.g., an article, talk, video, post, tweet) intended for recording the key ideas from it.
Eventually, the ideas will be added to the evergreen notes.
Furthermore, they shouldn't be referenced anywhere.
Naming them is the same as the one in my traditional notes.
** The root folder contains my evergreen notes.
** My evergreen notes, essentially a ripoff from Andy Matuschak's notes.
These are essentially like my Zettelkasten, a bunch of my own ideas (that I have processed and realized myself, anyways).
The file name are just timestamps for convenience.
footnote:[Not necessarily original but just some of them being developed and processed, with/out a Eureka moment.]
** For challenges and answers to problem sets, they are set in my hierarchical notebook with the prefix `challenges`.

View File

@ -1,10 +1,10 @@
(defvar +wiki-directory "~/writings/wiki")
(defvar +wiki-notebook-name "notebook")
(defvar +wiki-notebook-directory (f-join +wiki-directory +wiki-notebook-name))
(defvar +structured-notes-directory-name "structured")
(defvar +structured-notes-directory (f-join +wiki-directory +structured-notes-directory-name))
(defvar my/wiki-asset-directory-name "assets")
(+wiki/biblio-setup)
(defun my/is-in-wiki-directory ()
"Return t if the file buffer is in the wiki directory."
(if (and (not (string= (f-base (buffer-file-name))
@ -32,6 +32,18 @@
(f-join my/wiki-asset-directory-name (file-name-sans-extension (buffer-file-name))))
(message "Not in the wiki directory.")))
(defun my/parse-links-in-org (filename)
"Returns a list of links in an Org buffer."
(let ((ast (with-temp-buffer
(insert-file-contents filename)
(org-mode)
(org-element-parse-buffer))))
(org-element-map ast 'link
(lambda (link)
(when (or (string= (org-element-property :type link) "http")
(string= (org-element-property :type link) "https"))
(org-element-property :path link))))))
(defun my/anki-editor-delete-note ()
"Request AnkiConnect for deleting a note at point."
(interactive)
@ -43,11 +55,9 @@
(setq
org-roam-v2-ack 't
org-roam-directory "~/writings/wiki"
org-roam-db-location (f-join org-roam-directory "org-roam.db")
org-roam-capture-templates `(("p" "permanent" plain "%?"
:if-new
(file+head (f-join "notebook/" "%<%Y-%m-%d-%H-%M-%S>.org")
org-roam-capture-templates `(("e" "evergreen" plain "%?"
:target
(file+head ,(f-join +wiki-notebook-directory "%<%Y-%m-%d-%H-%M-%S>.org")
"#+title: ${title}
#+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z>
@ -55,7 +65,7 @@
:unnarrowed t)
("c" "cards" plain "%?"
:if-new
:target
(file+head ,(f-join +anki-cards-directory-name "%<%Y>.org") "#+title: Anki: ${title}
#+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z>
@ -64,40 +74,41 @@
:unnarrowed t)
("l" "literature" plain "%?"
:if-new
:target
(file+head ,(f-join +wiki-notebook-directory "literature.${slug}.org") "#+title: ${title}
#+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z>
#+language: en")
:unnarrowed t)
("L" "literature reference" plain
(file ,(f-join +wiki-directory "templates" "literature.org"))
:target
(file ,(f-join +wiki-notebook-directory "literature.${citekey}.org"))
:unnarrowed t)
("d" "dailies" entry "* %?"
:if-new
:target
(file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n"))
("s" "structured" plain "%?"
:if-new
:target
(file+head ,(f-join +wiki-notebook-directory "${slug}.org") "#+title: ${title}")
:unnarrowed t)))
(eval-after-load "org-roam"
'(cl-defmethod org-roam-node-slug ((node org-roam-node))
"Override the slug method with a kebab-case instead of the
snake_case."
(let ((title (org-roam-node-title node)))
(cl-flet* ((nonspacing-mark-p (char)
(memq char org-roam-slug-trim-chars))
(strip-nonspacing-marks (s)
(ucs-normalize-NFC-string
(apply #'string (seq-remove #'nonspacing-mark-p
(ucs-normalize-NFD-string s)))))
(cl-replace (title pair)
(replace-regexp-in-string (car pair) (cdr pair) title)))
(let* ((pairs `(("[^[:alnum:][:digit:]_.]+" . "-") ;; convert anything not alphanumeric except "."
("\s+" . "-") ;; remove whitespaces
("__*" . "-") ;; remove sequential underscores
("^_" . "") ;; remove starting underscore
("_$" . ""))) ;; remove ending underscore
(slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
(downcase slug))))))
;; Change how slugs are generated.
;; I prefer dashes over the default underscores.
;;(eval-after-load "org-roam"
;; '(cl-defmethod org-roam-node-slug ((node org-roam-node))
;; (let ((title (org-roam-node-title node)))
;; (cl-flet* ((strip-nonspacing-marks (s)
;; (ucs-normalize-NFC-string (ucs-normalize-NFD-string s)))
;; (cl-replace (title pair)
;; (replace-regexp-in-string (car pair) (cdr pair) title)))
;; (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-")
;; ("--*" . "-")
;; ("^-" . "")
;; ("-$" . "")))
;; (slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
;; (downcase slug))))))
;;; config.el ends here

10
templates/literature.org Normal file
View File

@ -0,0 +1,10 @@
:properties:
:roam_refs: @%^{citekey}
:end:
#+title: ${title}
#+date: %<%Y-%m-%d %T %:z>
#+date_modified: 2021-11-07 00:34:33 +08:00>
#+published: %^{date}
#+author: %^{author}
#+source: %^{url}
#+language: en