|
|
@@ -762,24 +762,23 @@
|
|
|
|
|
|
(= name "youtube")
|
|
|
(let [url (first arguments)]
|
|
|
- ;; javascript regex "^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)(?<id>[\w\-]+)(\S+)?$"
|
|
|
- (def YouTube-regex #"^((?:https?:)?//)?((?:www|m).)?((?:youtube.com|youtu.be))(/(?:[\w-]+\?v=|embed/|v/)?)([\w-]+)(\S+)?$")
|
|
|
- (when-let [youtube-id (cond
|
|
|
- (== 11 (count url)) url
|
|
|
- :else
|
|
|
- (nth (re-find YouTube-regex url) 5))]
|
|
|
- (when-not (string/blank? youtube-id)
|
|
|
- (let [width (min (- (util/get-width) 96)
|
|
|
- 560)
|
|
|
- height (int (* width (/ 315 560)))]
|
|
|
- [:iframe
|
|
|
- {:allow-full-screen "allowfullscreen"
|
|
|
- :allow
|
|
|
- "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
|
- :frame-border "0"
|
|
|
- :src (str "https://www.youtube.com/embed/" youtube-id)
|
|
|
- :height height
|
|
|
- :width width}]))))
|
|
|
+ (let YouTube-regex #"^((?:https?:)?//)?((?:www|m).)?((?:youtube.com|youtu.be))(/(?:[\w-]+\?v=|embed/|v/)?)([\w-]+)(\S+)?$"
|
|
|
+ (when-let [youtube-id (cond
|
|
|
+ (== 11 (count url)) url
|
|
|
+ :else
|
|
|
+ (nth (re-find YouTube-regex url) 5))]
|
|
|
+ (when-not (string/blank? youtube-id)
|
|
|
+ (let [width (min (- (util/get-width) 96)
|
|
|
+ 560)
|
|
|
+ height (int (* width (/ 315 560)))]
|
|
|
+ [:iframe
|
|
|
+ {:allow-full-screen "allowfullscreen"
|
|
|
+ :allow
|
|
|
+ "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
|
+ :frame-border "0"
|
|
|
+ :src (str "https://www.youtube.com/embed/" youtube-id)
|
|
|
+ :height height
|
|
|
+ :width width}])))))
|
|
|
|
|
|
(= name "embed")
|
|
|
(let [a (first arguments)]
|