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

Int Typecast #1190

Closed
Secretmapper opened this issue Jun 4, 2015 · 3 comments
Closed

Int Typecast #1190

Secretmapper opened this issue Jun 4, 2015 · 3 comments
Labels

Comments

@Secretmapper
Copy link
Contributor

Might be related to #620.

Can I even typecast ints in hugo?

Running:
substr .Permalink (add (len .Site.BaseURL) 3) (len .Permalink)

produces the error:
wrong type for value; expected int; got int64

Because of the (add (len .Site.BaseURL) 3)

I am using 0.14 by the way

@bep
Copy link
Member

bep commented Jun 4, 2015

/cc @tatsushid

@tatsushid
Copy link
Contributor

I checked and found what caused it. I'll fix it in the weekend.

tatsushid added a commit to tatsushid/hugo that referenced this issue Jun 6, 2015
`substr` template function takes one or two range arguments. Both
arguments must be int type values but if it is used with a calclation
function e.g. `add`, `len` etc, it causes a wrong type error.

This fixes the issue to allow the function to take other integer type
variant like `int64` etc.

This also includes a small fix on no range argument case.

Fix gohugoio#1190
@bep bep closed this as completed in 51cabe6 Jun 6, 2015
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
`substr` template function takes one or two range arguments. Both
arguments must be int type values but if it is used with a calclation
function e.g. `add`, `len` etc, it causes a wrong type error.

This fixes the issue to allow the function to take other integer type
variant like `int64` etc.

This also includes a small fix on no range argument case.

Fix gohugoio#1190
@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 Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants