Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bool type params in shortcode #6371

Closed
dtvn opened this issue Sep 27, 2019 · 1 comment · Fixed by #6376
Assignees
Labels
Milestone

Comments

@dtvn
Copy link

@dtvn dtvn commented Sep 27, 2019

This a 4-param shortcode used in a post:

{{< vidur 9KvBeKu false true false>}}
	<a href='https://imgur.com/gallery/QJY9Jy4'>gambrill</a>
{{< /vidur >}}

If boolean can be passed through params, we would have a better code:

<figure class='spotlight'>
	<video
		{{- cond (.Get 1) "autoplay" "" -}}
		{{- cond (.Get 2) "controls" "" -}}
		{{- cond (.Get 3) "loop" "" -}}
	>
		<source src='https://i.imgur.com/{{- .Get 0 -}}.mp4'/>
	</video>
	{{ with .Inner }}<figcaption>{{.}}</figcaption>{{ end }}
</figure>
@bep bep added the Enhancement label Sep 27, 2019
@bep bep added this to the v0.60 milestone Sep 27, 2019
@bep bep changed the title Please support bool type params in shortcode Support bool type params in shortcode Sep 27, 2019
@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Sep 27, 2019

I agree. We should probably also support numbers, so you can do:

{{< vidur 9KvBeKu false true 32 3.14 >}}

This will be a slightly breaking change, but should be very limiting. If people want strings, they should do:

{{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}
@bep bep self-assigned this Sep 27, 2019
@bep bep modified the milestones: v0.60, v0.59 Sep 27, 2019
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

```
{{< vidur 9KvBeKu false true 32 3.14 >}}
```

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

This is a slightly breaking change, but should be very limiting. If people want strings, they should do:

```
{{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}
```

Fixes gohugoio#6371
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes gohugoio#6371
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes gohugoio#6371
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes gohugoio#6371
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes gohugoio#6371
bep added a commit to bep/hugo that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes gohugoio#6371
@bep bep closed this in #6376 Sep 29, 2019
bep added a commit that referenced this issue Sep 29, 2019
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes #6371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.