Skip to content

Commit

Permalink
fix: regex of content.html
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Jan 8, 2020
1 parent f4a3dd0 commit 01039b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions layouts/partials/components/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

<!-- Video -->
{{- $Content := .Scratch.Get "Content" -}}
{{- $regexPatternVideo := `(<img)( src="[^"]+\.(mp4|webm|ogg)")( alt="[^"]+.)?(.+)?( />)` -}}
{{- $regexPatternVideo := `(<img)( src="[^"]+\.(mp4|webm|ogg)")( alt="[^"]+.)?(.[^>]+)?( />|>)` -}}
{{- $regexReplacementVideo := `<video$2$5 controls></video>` -}}
{{- $Content := $Content | replaceRE $regexPatternVideo $regexReplacementVideo | safeHTML -}}
{{- .Scratch.Set "Content" $Content -}}
Expand Down Expand Up @@ -198,7 +198,7 @@
<!-- Medium Zoom -->
{{- $Content := .Scratch.Get "Content" -}}
{{- if .Site.Params.enableMediumZoom -}}
{{- $regexPatternMediumZoom := `(<img)(.+)( />)` -}}
{{- $regexPatternMediumZoom := `(<img)(.[^>]+)( />|>)` -}}
{{- $regexReplacementMediumZoom := `$1$2 data-zoomable$3` -}}
{{- $Content := $Content | replaceRE $regexPatternMediumZoom $regexReplacementMediumZoom | safeHTML -}}
{{- .Scratch.Set "Content" $Content -}}
Expand Down

0 comments on commit 01039b7

Please sign in to comment.