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

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

Closed
jpap opened this issue Apr 9, 2017 · 4 comments · Fixed by #3501
Closed

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

jpap opened this issue Apr 9, 2017 · 4 comments · Fixed by #3501

Comments

@jpap
Copy link

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 delimited string can't be cast to int tpl: "int" func should handle template.HTML input Apr 9, 2017
@moorereason
Copy link
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.

@bep
Copy link
Member

bep commented May 22, 2017

@moorereason is this fixed?

@moorereason
Copy link
Contributor

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

@moorereason moorereason self-assigned this May 22, 2017
moorereason added a commit to moorereason/hugo that referenced this issue May 22, 2017
Also add tests for ToInt and ToString.

Resolves gohugoio#3308
@bep bep closed this as completed in #3501 May 22, 2017
bep pushed a commit that referenced this issue May 22, 2017
Also add tests for ToInt and ToString.

Resolves #3308
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants