Skip to content

Commit

Permalink
Incorporate changes in PR#62
Browse files Browse the repository at this point in the history
  • Loading branch information
louie committed Mar 9, 2020
1 parent c74e864 commit ff3230f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Changelog.org
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
4. Command ~anki-editor-remove-styles~
11. Updated anki-connect to version 6
1. ~anki-editor-api-upgrade~ removed
12. Added variable ~anki-editor-note-match~ to make matching note
entries customizable

** v0.3.3

Expand Down
1 change: 1 addition & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ there are any ambiguity or grammatical mistakes ;-)/
| anki-editor-latex-style | builtin | The style of latex to translate into. |
| anki-editor-include-default-style | t | Wheter or not to include `org-html-style-default' when using `anki-editor-copy-styles'. |
| anki-editor-html-head | nil | Additional html tags to append to card stylings when using `anki-editor-copy-styles'. |
| anki-editor-note-match | nil | Additional matching string for mapping through anki note headings. |

** Functions and Macros

Expand Down
17 changes: 14 additions & 3 deletions anki-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ provide your custom styles in `anki-editor-html-head'."
For example, you can put custom styles or scripts in this variable."
:type 'string)

(defcustom anki-editor-note-match nil
"Additional matching string for mapping through anki note headings.
A leading logical operator like `+' or `&' is required."
:type 'string)


;;; AnkiConnect

Expand Down Expand Up @@ -451,12 +456,18 @@ as note types won't change in BODY."
(setq anki-editor--collection-data-updated nil)))))

(defun anki-editor-map-note-entries (func &optional match scope &rest skip)
"Simple wrapper that calls `org-map-entries' with
`&ANKI_NOTE_TYPE<>\"\"' appended to MATCH."
"Simple wrapper that calls `org-map-entries' with entries that match
`ANKI_NOTE_TYPE<>\"\"', `anki-editor-note-match' and MATCH.
A leading logical operator like `+' or `&' is required in MATCH."
;; disable property inheritance temporarily, or all subheadings of a
;; note heading will be counted as note headings as well
(let ((org-use-property-inheritance nil))
(org-map-entries func (concat match "&" anki-editor-prop-note-type "<>\"\"") scope skip)))
(org-map-entries func
(concat "+" anki-editor-prop-note-type "<>\"\""
match
anki-editor-note-match)
scope
skip)))

(defun anki-editor--insert-note-skeleton (prefix deck heading type fields)
"Insert a note subtree (skeleton) with HEADING, TYPE and FIELDS.
Expand Down

0 comments on commit ff3230f

Please sign in to comment.