Issue #17 resolved
Josh Hunsaker
created an issue

Is there a way to export notes as an Anki deck? Even a CSV would work great.

Comments (2)

  1. Paul Sexton repo owner

    There is not, since the format for org-drill "items" is richer and more freeform than the Anki format. You would basically need to write a bespoke "export" function for every org-drill card type.

    However, here is a function that will export all "simple" or "twosided" cards to a new buffer in CSV format; this might help your situation or give you ideas for how to write your own function.

    (defun org-drill-to-csv ()
      "Find every 'simple' or 'twosided' org-drill item in the current scope. Create a new buffer,
    where we write the contents of the first 2 subheadings (sides) of each such item in CSV
    format. Switch to the new buffer when we finish."
      (let ((buf (generate-new-buffer "*org-drill output*"))
                (lambda ()
                  (when (and (org-drill-entry-p)
                             (member (org-entry-get (point) "DRILL_CARD_TYPE" t)
                                     '("simple" "twosided")))
                    (let ((bodies nil)
                          (lvl (org-current-level)))
                       (lambda ()
                         (when (> (org-current-level) lvl)
                           (push (org-drill-get-entry-text) bodies)))
                       nil 'tree)
                      (setq bodies (reverse bodies))
                      (princ (format "%S,%S\n" (first bodies) (second bodies))))))))))
        (with-current-buffer buf
          (insert csv)
          (display-buffer (current-buffer)))))
  2. Log in to comment