diff --git a/copy_log.sh b/copy_log.sh index 19b06c3..0406735 100755 --- a/copy_log.sh +++ b/copy_log.sh @@ -1,4 +1,6 @@ #!/bin/sh -./org_fix_links.py < /mnt/share/syncthing/notes/log.org > log_tmp.org +emacs -q --batch -l util.el -f filter-org +echo "Calling org_fix_links.py..." +./org_fix_links.py < ./_tmp_filtered.org > ./_tmp_filtered2.org emacs -q --batch -l util.el -f export-run diff --git a/util.el b/util.el index 9a0189c..bc9e5b8 100644 --- a/util.el +++ b/util.el @@ -1,6 +1,3 @@ -;; See still: -;; command-line-args - (require 'ox-hugo) (require 'cl) @@ -51,8 +48,18 @@ ;; (filter-out-tag-from-file "/Users/hodapp/log_tmp2.org" "tmp.org" "dream") ;; (filter-org-tag "dream" "/Users/hodapp/log_tmp2.org" "/Users/hodapp/log_tmp_filter.org") +(defun filter-org () + (let ((fname "/mnt/share/syncthing/notes/log.org") + (tag "private")) + (princ (format "Filtering %s...\n" fname)) + (with-current-buffer (filter-buffer fname "tmp.org" tag) + (write-file "./_tmp_filtered.org")))) + (defun export-run () - (progn - (find-file "./log_tmp.org") - (org-hugo-export-as-md) - (write-file "./log_tmp.md"))) + (find-file "./_tmp_filtered2.org") + (princ "Exporting with ox-hugo...\n") + (org-hugo-export-as-md) + (write-file "./log.md")) +;; TODO: use command-line-args so that I can pass in the filename +;; instead of hard-code it +