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

tpl: "int" func should handle template.HTML input #3308

Closed
jpap opened this Issue Apr 9, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@jpap

jpap commented Apr 9, 2017

Constructing a string from a string array fails:

$array := "1,3"
$values = split $array ","
$str := delimit (last 1 $values)
$int := int $str

It however can be done using printf which indicates that the above may be a bug:

$array := "1,3"
$values = split $array ","
$str := delimit (last 1 $values)
$int := int (sprintf "%s" $str)

@moorereason moorereason changed the title from `delimit`ed string can't be cast to int to tpl: "int" func should handle template.HTML input Apr 9, 2017

@moorereason

This comment has been minimized.

Show comment
Hide comment
@moorereason

moorereason Apr 9, 2017

Contributor

I tagged this as upstream as I'm thinking that cast.ToIntE could detect a fmt.Stringer interface if not a basic type. However, we may need to just put template.HTML handling into Hugo.

Contributor

moorereason commented Apr 9, 2017

I tagged this as upstream as I'm thinking that cast.ToIntE could detect a fmt.Stringer interface if not a basic type. However, we may need to just put template.HTML handling into Hugo.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep May 22, 2017

Member

@moorereason is this fixed?

Member

bep commented May 22, 2017

@moorereason is this fixed?

@moorereason

This comment has been minimized.

Show comment
Hide comment
@moorereason

moorereason May 22, 2017

Contributor

No, I'll send a PR to fix this.

Contributor

moorereason commented May 22, 2017

No, I'll send a PR to fix this.

@moorereason moorereason removed the Upstream label May 22, 2017

@moorereason moorereason self-assigned this May 22, 2017

moorereason added a commit to moorereason/hugo that referenced this issue May 22, 2017

tpl/cast: Handle template.HTML and friends in ToInt
Also add tests for ToInt and ToString.

Resolves #3308

@bep bep closed this in #3501 May 22, 2017

bep added a commit that referenced this issue May 22, 2017

tpl/cast: Handle template.HTML and friends in ToInt
Also add tests for ToInt and ToString.

Resolves #3308

@ghost ghost referenced this issue Jun 12, 2017

Open

spf13/hugo v0.22 released #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment