enhance(ux): support audio player renderer for the local audio asset

pull/8874/head
charlie 2023-03-23 14:31:32 +08:00 committed by Gabriel Horner
parent 5913d81e6f
commit 6e357f3804
2 changed files with 9 additions and 3 deletions

View File

@ -1360,10 +1360,11 @@
(defn get-asset-file-link
[format url file-name image?]
(let [pdf? (and url (string/ends-with? (string/lower-case url) ".pdf"))
video? (and url (util/ext-of-video? url))]
(let [pdf? (and url (string/ends-with? (string/lower-case url) ".pdf"))
media? (and url (or (util/ext-of-audio? url)
(util/ext-of-video? url)))]
(case (keyword format)
:markdown (util/format (str (when (or image? video? pdf?) "!") "[%s](%s)") file-name url)
:markdown (util/format (str (when (or image? media? pdf?) "!") "[%s](%s)") file-name url)
:org (if image?
(util/format "[[%s]]" url)
(util/format "[[%s][%s]]" url file-name))

View File

@ -241,6 +241,11 @@
(string/ends-with? %))
[".mp4" ".mkv" ".mov" ".wmv" ".avi" ".webm" ".mpg" ".ts" ".ogg" ".flv"]))
(defn ext-of-audio? [s]
(some #(-> (string/lower-case s)
(string/ends-with? %))
[".mp3" ".wav" "ogg"]))
;; ".lg:absolute.lg:inset-y-0.lg:right-0.lg:w-1/2"
(defn hiccup->class
[class]