Simplify and rename exporting command
This commit is contained in:
parent
7270842948
commit
5f7e38929e
2 changed files with 15 additions and 24 deletions
18
README.org
18
README.org
|
@ -51,15 +51,15 @@ anki-editor -- Make Anki Cards in Org-mode
|
|||
|
||||
** Command Cheatsheet
|
||||
|
||||
| Command | Brief Description |
|
||||
|-----------------------------------------------+---------------------------------------------------------------------|
|
||||
| =anki-editor-submit= | Send notes in current buffer to Anki. |
|
||||
| =anki-editor-insert-deck= | Insert a deck heading. |
|
||||
| =anki-editor-insert-note= | Insert the skeleton of a note. |
|
||||
| =anki-editor-add-tags= | Add tags to property drawer of current heading with autocompletion. |
|
||||
| =anki-editor-cloze-region= | Cloze region. |
|
||||
| =anki-editor-export-heading-contents-to-html= | Export the contents of the heading at point to HTML. |
|
||||
| =anki-editor-convert-region-to-html= | Convert and replace region to HTML. |
|
||||
| Command | Brief Description |
|
||||
|--------------------------------------+---------------------------------------------------------------------|
|
||||
| =anki-editor-submit= | Send notes in current buffer to Anki. |
|
||||
| =anki-editor-insert-deck= | Insert a deck heading. |
|
||||
| =anki-editor-insert-note= | Insert the skeleton of a note. |
|
||||
| =anki-editor-add-tags= | Add tags to property drawer of current heading with autocompletion. |
|
||||
| =anki-editor-cloze-region= | Cloze region. |
|
||||
| =anki-editor-export-subtree-to-html= | Export subtree of the element at point to HTML. |
|
||||
| =anki-editor-convert-region-to-html= | Convert and replace region to HTML. |
|
||||
|
||||
Note that =anki-editor-submit= will fail if the deck does not exist
|
||||
yet. New decks must be created in Anki first.
|
||||
|
|
|
@ -336,22 +336,13 @@ Otherwise, it's inserted below current heading at point."
|
|||
(princ "}}"))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun anki-editor-export-heading-contents-to-html ()
|
||||
"Export the contents of the heading at point to HTML."
|
||||
(defun anki-editor-export-subtree-to-html ()
|
||||
"Export subtree of the element at point to HTML."
|
||||
(interactive)
|
||||
(let* ((tree (org-element-at-point))
|
||||
(contents (or (and (org-element-property :contents-begin tree)
|
||||
(org-element-property :contents-end tree)
|
||||
(buffer-substring (org-element-property :contents-begin tree)
|
||||
(org-element-property :contents-end tree)))
|
||||
"")))
|
||||
(if (or (null tree)
|
||||
(not (eq (org-element-type tree) 'headline)))
|
||||
(error "No element at point or it's not a heading")
|
||||
(when (buffer-live-p (get-buffer anki-editor-buffer-html-output))
|
||||
(kill-buffer anki-editor-buffer-html-output))
|
||||
(switch-to-buffer-other-window (get-buffer-create anki-editor-buffer-html-output))
|
||||
(insert (org-export-string-as contents anki-editor--ox-anki-html-backend t)))))
|
||||
(org-export-to-buffer
|
||||
anki-editor--ox-anki-html-backend
|
||||
anki-editor-buffer-html-output nil t nil t nil
|
||||
(lambda () (html-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun anki-editor-convert-region-to-html ()
|
||||
|
|
Loading…
Reference in a new issue