Recognize the same audio types as Anki

Addresses louietan/anki-editor#87.
This commit is contained in:
orgtre 2022-10-31 08:51:19 +01:00
parent 8a085dff84
commit 1f8b222e08

View file

@ -273,6 +273,9 @@ The result is the path to the newly stored media file."
(defconst anki-editor--ox-export-ext-plist
'(:with-toc nil :with-properties nil :with-planning nil :anki-editor-mode t))
(defconst anki-editor--audio-extensions
'(".mp3" ".3gp" ".flac" ".m4a" ".oga" ".ogg" ".opus" ".spx" ".wav"))
(cl-macrolet ((with-table (table)
`(cl-loop for delims in ,table
collect
@ -372,7 +375,8 @@ The implementation is borrowed and simplified from ox-html."
(org-html--format-image path attributes-plist info))
;; Audio file.
((string-suffix-p ".mp3" path t)
((cl-some (lambda (string) (string-suffix-p string path t))
anki-editor--audio-extensions)
(format "[sound:%s]" path))
;; External link with a description part.