-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: shortcode
imgproc
does not work with % for markdown body (#332)
- Loading branch information
Showing
2 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
{{ $original := .Page.Resources.GetMatch (printf "**%s*" (.Get 0)) }} | ||
{{ $command := .Get 1 }} | ||
{{ $options := .Get 2 }} | ||
{{ if eq $command "Fit"}} | ||
{{ .Scratch.Set "image" ($original.Fit $options) }} | ||
{{ else if eq $command "Resize"}} | ||
{{ .Scratch.Set "image" ($original.Resize $options) }} | ||
{{ else if eq $command "Fill"}} | ||
{{ .Scratch.Set "image" ($original.Fill $options) }} | ||
{{ else if eq $command "Crop"}} | ||
{{ .Scratch.Set "image" ($original.Crop $options) }} | ||
{{ else }} | ||
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Crop or Resize."}} | ||
{{ end }} | ||
{{ $image := .Scratch.Get "image" }} | ||
<figure class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 }}px"> | ||
<img class="card-img-top" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> | ||
{{ with .Inner }} | ||
<figcaption class="card-body px-0 pt-2 pb-0"> | ||
<p class="card-text">{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . | html }}</small>{{ end }}</p> | ||
</figcaption> | ||
{{ end }} | ||
{{ $original := .Page.Resources.GetMatch (printf "**%s*" (.Get 0)) -}} | ||
{{ $command := .Get 1 -}} | ||
{{ $options := .Get 2 -}} | ||
{{ if eq $command "Fit" -}} | ||
{{ .Scratch.Set "image" ($original.Fit $options) -}} | ||
{{ else if eq $command "Resize" -}} | ||
{{ .Scratch.Set "image" ($original.Resize $options) -}} | ||
{{ else if eq $command "Fill" -}} | ||
{{ .Scratch.Set "image" ($original.Fill $options) -}} | ||
{{ else if eq $command "Crop" -}} | ||
{{ .Scratch.Set "image" ($original.Crop $options) -}} | ||
{{ else -}} | ||
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Crop or Resize." -}} | ||
{{ end -}} | ||
{{ $image := .Scratch.Get "image" -}} | ||
|
||
<figure class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 -}}px"> | ||
<img class="card-img-top" src="{{- $image.RelPermalink -}}" width="{{- $image.Width -}}" height="{{- $image.Height -}}"> | ||
{{ with .Inner -}} | ||
<figcaption class="card-body px-0 pt-2 pb-0"> | ||
<p class="card-text"> | ||
|
||
{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . }}</small>{{ end }} | ||
</p> | ||
</figcaption> | ||
{{ end -}} | ||
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters