org_reader.el 547 B

1234567891011121314
  1. (require 'json)
  2. (require 'org)
  3. (defun org->pelican (filename backend)
  4. (progn
  5. (save-excursion
  6. (find-file filename)
  7. (let ((properties (org-export-get-environment)))
  8. (princ (json-encode
  9. (list
  10. :date (org-timestamp-format (car (plist-get properties :date)) "%Y-%m-%d")
  11. :category (cdr (assoc "CATEGORY" org-file-properties))
  12. :post (org-export-as backend nil nil t)
  13. :title (substring-no-properties (car (plist-get properties :title))))))))))