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

View File

@ -130,34 +130,31 @@ Separate as may be, they can freely link other notes.
** Appendix — e.g., `#+begin_appendix`. ** Appendix — e.g., `#+begin_appendix`.
** link:https://docs.asciidoctor.org/asciidoc/latest/blocks/admonitions/[Admonition blocks] — e.g., `\#+begin_important`, `#+begin_tip`, `#+begin_warning`. ** 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. 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. 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. It is basically my inbox for various things: my random realizations, ideas, and whatnot.
** My "traditional" notes is at link:./notebook/[`./notebook/`]. ** 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. 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). 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`). 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. This allows to make a directory of flat files while representing the schema of your notes.
Pretty handy. Pretty handy.
** Literature notes are in my notebook. ** Literature notes are in my notebook, too.
The file name are prefixed with `literature`. 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. 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. Eventually, the ideas will be added to the evergreen notes.
Furthermore, they shouldn't be referenced anywhere. Furthermore, they shouldn't be referenced anywhere.
Naming them is the same as the one in my traditional notes. 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). 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.] 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`. ** 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-directory "~/writings/wiki")
(defvar +wiki-notebook-name "notebook") (defvar +wiki-notebook-name "notebook")
(defvar +wiki-notebook-directory (f-join +wiki-directory +wiki-notebook-name)) (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") (defvar my/wiki-asset-directory-name "assets")
(+wiki/biblio-setup)
(defun my/is-in-wiki-directory () (defun my/is-in-wiki-directory ()
"Return t if the file buffer is in the wiki directory." "Return t if the file buffer is in the wiki directory."
(if (and (not (string= (f-base (buffer-file-name)) (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)))) (f-join my/wiki-asset-directory-name (file-name-sans-extension (buffer-file-name))))
(message "Not in the wiki directory."))) (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 () (defun my/anki-editor-delete-note ()
"Request AnkiConnect for deleting a note at point." "Request AnkiConnect for deleting a note at point."
(interactive) (interactive)
@ -43,11 +55,9 @@
(setq (setq
org-roam-v2-ack 't org-roam-v2-ack 't
org-roam-directory "~/writings/wiki" org-roam-capture-templates `(("e" "evergreen" plain "%?"
org-roam-db-location (f-join org-roam-directory "org-roam.db") :target
org-roam-capture-templates `(("p" "permanent" plain "%?" (file+head ,(f-join +wiki-notebook-directory "%<%Y-%m-%d-%H-%M-%S>.org")
:if-new
(file+head (f-join "notebook/" "%<%Y-%m-%d-%H-%M-%S>.org")
"#+title: ${title} "#+title: ${title}
#+date: %<%Y-%m-%d %T %:z> #+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z> #+date_modified: %<%Y-%m-%d %T %:z>
@ -55,7 +65,7 @@
:unnarrowed t) :unnarrowed t)
("c" "cards" plain "%?" ("c" "cards" plain "%?"
:if-new :target
(file+head ,(f-join +anki-cards-directory-name "%<%Y>.org") "#+title: Anki: ${title} (file+head ,(f-join +anki-cards-directory-name "%<%Y>.org") "#+title: Anki: ${title}
#+date: %<%Y-%m-%d %T %:z> #+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z> #+date_modified: %<%Y-%m-%d %T %:z>
@ -64,40 +74,41 @@
:unnarrowed t) :unnarrowed t)
("l" "literature" plain "%?" ("l" "literature" plain "%?"
:if-new :target
(file+head ,(f-join +wiki-notebook-directory "literature.${slug}.org") "#+title: ${title} (file+head ,(f-join +wiki-notebook-directory "literature.${slug}.org") "#+title: ${title}
#+date: %<%Y-%m-%d %T %:z> #+date: %<%Y-%m-%d %T %:z>
#+date_modified: %<%Y-%m-%d %T %:z> #+date_modified: %<%Y-%m-%d %T %:z>
#+language: en") #+language: en")
:unnarrowed t) :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 "* %?" ("d" "dailies" entry "* %?"
:if-new :target
(file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n")) (file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n"))
("s" "structured" plain "%?" ("s" "structured" plain "%?"
:if-new :target
(file+head ,(f-join +wiki-notebook-directory "${slug}.org") "#+title: ${title}") (file+head ,(f-join +wiki-notebook-directory "${slug}.org") "#+title: ${title}")
:unnarrowed t))) :unnarrowed t)))
(eval-after-load "org-roam" ;; Change how slugs are generated.
'(cl-defmethod org-roam-node-slug ((node org-roam-node)) ;; I prefer dashes over the default underscores.
"Override the slug method with a kebab-case instead of the ;;(eval-after-load "org-roam"
snake_case." ;; '(cl-defmethod org-roam-node-slug ((node org-roam-node))
(let ((title (org-roam-node-title node))) ;; (let ((title (org-roam-node-title node)))
(cl-flet* ((nonspacing-mark-p (char) ;; (cl-flet* ((strip-nonspacing-marks (s)
(memq char org-roam-slug-trim-chars)) ;; (ucs-normalize-NFC-string (ucs-normalize-NFD-string s)))
(strip-nonspacing-marks (s) ;; (cl-replace (title pair)
(ucs-normalize-NFC-string ;; (replace-regexp-in-string (car pair) (cdr pair) title)))
(apply #'string (seq-remove #'nonspacing-mark-p ;; (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-")
(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 "." ;; (slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
("\s+" . "-") ;; remove whitespaces ;; (downcase slug))))))
("__*" . "-") ;; remove sequential underscores
("^_" . "") ;; remove starting underscore
("_$" . ""))) ;; remove ending underscore
(slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
(downcase slug))))))
;;; config.el ends here ;;; 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