From 1f8b222e08bfa851d71f7d95040f3dd069bc55c3 Mon Sep 17 00:00:00 2001 From: orgtre Date: Mon, 31 Oct 2022 08:51:19 +0100 Subject: [PATCH] Recognize the same audio types as Anki Addresses louietan/anki-editor#87. --- anki-editor.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/anki-editor.el b/anki-editor.el index 92a7add..a7a58d4 100644 --- a/anki-editor.el +++ b/anki-editor.el @@ -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,8 +375,9 @@ 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) - (format "[sound:%s]" path)) + ((cl-some (lambda (string) (string-suffix-p string path t)) + anki-editor--audio-extensions) + (format "[sound:%s]" path)) ;; External link with a description part. ((and path desc) (format "%s"