From 639c73618a578ace0b436def2be210a45677473a Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 29 Jul 2022 23:13:07 +0800 Subject: [PATCH] Revise templates for this notebook --- config.el | 45 +++++++++++++--------------------------- templates/anki.org | 5 +++++ templates/default.org | 4 ++++ templates/literature.org | 5 +---- 4 files changed, 24 insertions(+), 35 deletions(-) create mode 100644 templates/anki.org create mode 100644 templates/default.org diff --git a/config.el b/config.el index 4c74ea2..b5b6ae9 100644 --- a/config.el +++ b/config.el @@ -55,30 +55,28 @@ (setq org-roam-v2-ack 't + org-roam-node-display-template "${doom-hierarchy:100} ${file:45}" + org-roam-node-display-template + (format "${doom-hierarchy:*} %s %s" + (propertize "${doom-tags:15}" 'face 'org-tag) + (propertize "${file:60}" 'face 'font-lock-default-face)) + org-roam-capture-templates `(("e" "evergreen" plain "%?" + (file ,(f-join +wiki-directory "templates" "default.org")) :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> -#+language: en") + (file ,(f-join +wiki-notebook-directory "%<%Y-%m-%d-%H-%M-%S>.org")) :unnarrowed t) ("c" "cards" plain "%?" + (file ,(f-join +wiki-directory "templates" "anki.org")) :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> -#+language: en -#+property: anki_deck ${title}") + (file ,(f-join +anki-cards-directory-name "%<%Y>.org")) :unnarrowed t) ("l" "literature" plain "%?" + (file ,(f-join +wiki-directory "templates" "default.org")) :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") + (file ,(f-join +wiki-notebook-directory "literature.${slug}.org")) :unnarrowed t) ("L" "literature reference" plain @@ -92,23 +90,8 @@ (file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n")) ("s" "structured" plain "%?" + (file ,(f-join +wiki-directory "templates" "default.org")) :target - (file+head ,(f-join +wiki-notebook-directory "${slug}.org") "#+title: ${title}") + (file ,(f-join +wiki-notebook-directory "${slug}.org")) :unnarrowed t))) - -;; 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 diff --git a/templates/anki.org b/templates/anki.org new file mode 100644 index 0000000..b109eb1 --- /dev/null +++ b/templates/anki.org @@ -0,0 +1,5 @@ +#+title: Anki: ${title} +#+date: %<%Y-%m-%d %T %:z> +#+date_modified: %<%Y-%m-%d %T %:z> +#+language: en +#+property: anki_deck ${title} diff --git a/templates/default.org b/templates/default.org new file mode 100644 index 0000000..842d700 --- /dev/null +++ b/templates/default.org @@ -0,0 +1,4 @@ +#+title: ${title} +#+date: %<%Y-%m-%d %T %:z> +#+date_modified: %<%Y-%m-%d %T %:z> +#+language: en diff --git a/templates/literature.org b/templates/literature.org index 8128b1f..365445c 100644 --- a/templates/literature.org +++ b/templates/literature.org @@ -1,9 +1,6 @@ -:properties: -:roam_refs: @%^{citekey} -:end: #+title: ${title} #+date: %<%Y-%m-%d %T %:z> -#+date_modified: 2021-11-07 00:34:33 +08:00> +#+date_modified: %<%Y-%m-%d %T %:z> #+published: %^{date} #+author: %^{author} #+source: %^{url}