org_reader.el 635 B

123456789101112131415
  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. :author (substring-no-properties (car (plist-get properties :author)))
  12. :category (cdr (assoc "CATEGORY" org-file-properties))
  13. :post (org-export-as backend nil nil t)
  14. :title (substring-no-properties (car (plist-get properties :title))))))))))