ensures consistency for .jpg/.JPG, .mp4/.MP4, etc
This commit is contained in:
parent
0e6e7af934
commit
a3fcd79545
22
nip27.ts
22
nip27.ts
|
@ -90,35 +90,19 @@ export function* parse(content: string): Iterable<Block> {
|
||||||
yield { type: 'text', text: content.substring(prevIndex, u - prefixLen) }
|
yield { type: 'text', text: content.substring(prevIndex, u - prefixLen) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (/\.(png|jpe?g|gif|webp)$/i.test(url.pathname)) {
|
||||||
url.pathname.endsWith('.png') ||
|
|
||||||
url.pathname.endsWith('.jpg') ||
|
|
||||||
url.pathname.endsWith('.jpeg') ||
|
|
||||||
url.pathname.endsWith('.gif') ||
|
|
||||||
url.pathname.endsWith('.webp')
|
|
||||||
) {
|
|
||||||
yield { type: 'image', url: url.toString() }
|
yield { type: 'image', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (
|
if (/\.(mp4|avi|webm|mkv)$/i.test(url.pathname)) {
|
||||||
url.pathname.endsWith('.mp4') ||
|
|
||||||
url.pathname.endsWith('.avi') ||
|
|
||||||
url.pathname.endsWith('.webm') ||
|
|
||||||
url.pathname.endsWith('.mkv')
|
|
||||||
) {
|
|
||||||
yield { type: 'video', url: url.toString() }
|
yield { type: 'video', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (
|
if (/\.(mp3|aac|ogg|opus)$/i.test(url.pathname)) {
|
||||||
url.pathname.endsWith('.mp3') ||
|
|
||||||
url.pathname.endsWith('.aac') ||
|
|
||||||
url.pathname.endsWith('.ogg') ||
|
|
||||||
url.pathname.endsWith('.opus')
|
|
||||||
) {
|
|
||||||
yield { type: 'audio', url: url.toString() }
|
yield { type: 'audio', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
|
|
Loading…
Reference in New Issue