diff options
Diffstat (limited to 'blog/index.org')
| -rw-r--r-- | blog/index.org | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/blog/index.org b/blog/index.org deleted file mode 100644 index 62167c8..0000000 --- a/blog/index.org +++ /dev/null @@ -1,65 +0,0 @@ -#+TITLE: Blogin sisällys - -#+begin_src emacs-lisp :exports results - - (defun get-org-file-property (path property) - "Gets PROPERTY of org file at PATH. Returns nil if not found." - (with-temp-buffer (setq case-fold-search t) - (insert-file-contents path) - (if (search-forward (concat "#+" property ":") nil t) - (string-trim-left (buffer-substring (point) (line-end-position))) - nil))) - - (defun get-org-file-title (name) - "Gets the title of the org file. Returns nil if not found." - (get-org-file-property name "TITLE")) - - (defun get-file-date (path) - "Gets the date of the file at PATH. - For an Org file where the date option is specified, it is used. - Otherwise the file modification date is used. - The date is returned in textual form, YYYY-MM-DD." - (or (if (string= (file-name-extension path) "org") - (get-org-file-property path "DATE") - nil) - (format-time-string "%Y-%m-%d" - (file-attribute-modification-time - (file-attributes (concat "./" name)))))) - - (defun generate-entry - (name) - "Generates an index entry for file NAME." - (let ((extension (file-name-extension name)) (bname (file-name-sans-extension name))) - (concat "[[./" - name - "][" - (or - (if (string= extension "org") - (get-org-file-title (concat "./" name)) - nil) - bname) - "]] (" - (get-file-date (concat "./" name)) - ") " - (or (if (string= extension "org") - (get-org-file-property (concat "./" name) "SUBTITLE") - nil) - "Alaotsikkoa ei saatavilla")))) - - (let ((files - (seq-filter (lambda (name) - (not (or - (string-suffix-p "~" name) - (string-suffix-p "#" name) - (string-prefix-p "#" name) - (string-prefix-p "." name) - (string= "index.org" name)))) - (directory-files "./")))) - (seq-map (lambda (name) `(,(generate-entry name))) files)) -#+end_src - -#+RESULTS: -| [[./post.org][Test-post-title]] (2026-06-12) Test subtitle | -| [[./tekstinsyotto.html][tekstinsyotto]] (2025-07-28) Alaotsikkoa ei saatavilla | -| [[./yksinkertaisesti-monipuolinen.txt][yksinkertaisesti-monipuolinen]] (2024-05-06) Alaotsikkoa ei saatavilla | - |
