diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2024-03-28 01:45:54 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2024-03-28 01:45:54 +0900 |
commit | 54823793924e02a3c254eae2a473429ad5be503b (patch) | |
tree | 542ff59827d49b2b6628d1871b6a9a766428d768 /scripts/export-to-text.el | |
parent | 3903337fd701f60cec51014f6670c0ac06e2b247 (diff) |
Remove export-to-text script.
Diffstat (limited to 'scripts/export-to-text.el')
-rw-r--r-- | scripts/export-to-text.el | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/scripts/export-to-text.el b/scripts/export-to-text.el deleted file mode 100644 index 15b17a8..0000000 --- a/scripts/export-to-text.el +++ /dev/null @@ -1,48 +0,0 @@ -(unless (= 2 (length argv)) - (error "Usage: emacs --script scripts/export-to-text <source-file> <output-file>")) - -(let* ((source-filename (file-truename (elt argv 0))) - (output-filename (file-truename (elt argv 1))) - (source-buffer (find-file source-filename)) - (output-buffer (find-file output-filename)) - (text-buffer (get-buffer-create "*Org ASCII Export*")) - (pt nil) - (file-buffer (current-buffer)) - (org-export-with-toc nil)) - (with-current-buffer output-buffer - (erase-buffer)) - - (set-buffer source-buffer) - (org-next-visible-heading 1) - (while (not (equal pt (point))) - (setq pt (point)) - (let ((title (org-get-heading t)) - (id (org-element-property :CUSTOM_ID (org-element-at-point))) - (timestamp (org-read-date nil - t - (org-element-property :TIMESTAMP (org-element-at-point)) - nil)) - (tags (org-get-tags)) - (subtree nil) - (text nil) - (hash nil)) - (org-copy-subtree) - (setq subtree (with-temp-buffer (yank) (buffer-string))) - - (org-ascii-export-as-ascii nil t t t) - (set-buffer text-buffer) - (setq text (buffer-string)) - - (set-buffer output-buffer) - (json-insert `((id . ,id) - (title . ,title) - (timestamp . ,(format-time-string "%FT%T%z" timestamp)) - (tags . ,(vconcat tags)) - (hash . ,(secure-hash 'sha256 subtree)) - (text . ,text))) - - (set-buffer source-buffer)) - (org-forward-heading-same-level 1)) - - (set-buffer output-buffer) - (save-buffer)) |