Add RegEx capturing group

This commit is contained in:
Ben Goldsworthy 2022-11-28 14:40:00 -06:00
parent 767be0043a
commit 6797150c73

View file

@ -6,16 +6,16 @@
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p> <p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary> </summary>
@if($checkin->note) @if($checkin->note)
@if(preg_match("/\[\[[^\]]+\]\]/", $checkin->note, $filepath)) @if(preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath))
@if(preg_match("/\.webm/", $filepath[0])) @if(preg_match("/\.webm/", $filepath[1]))
<video controls> <video controls>
<source src="/{{ $filepath[0] }}" type="video/webm"> <source src="/{{ $filepath[1] }}" type="video/webm">
<p>Your browser doesn't support HTML video. Here is a <a href="/{{ $filepath[0] }}">link to the video</a> instead.</p> <p>Your browser doesn't support HTML video. Here is a <a href="/{{ $filepath[1] }}">link to the video</a> instead.</p>
</video> </video>
@elseif(preg_match("/\.ogg/", $filepath[0])) @elseif(preg_match("/\.ogg/", $filepath[1]))
<audio controls> <audio controls>
<source src="/{{ $filepath[0] }}" type="audio/off"> <source src="/{{ $filepath[1] }}" type="audio/off">
<p>Download <a href="/{{ $filepath[0] }}">OGG</a> audio.</p> <p>Download <a href="/{{ $filepath[1] }}">OGG</a> audio.</p>
</audio> </audio>
@endif @endif
@else @else