Int Typecast #1190

Closed
Secretmapper opened this Issue Jun 4, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@Secretmapper
Contributor

Secretmapper commented Jun 4, 2015

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

This comment has been minimized.

Show comment
Hide comment
Member

bep commented Jun 4, 2015

@tatsushid

This comment has been minimized.

Show comment
Hide comment
@tatsushid

tatsushid Jun 4, 2015

Contributor

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

Contributor

tatsushid commented Jun 4, 2015

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

Fix substr tpl func's int type variant issue
`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 #1190

@bep bep closed this in 51cabe6 Jun 6, 2015

tychoish added a commit to tychoish/hugo that referenced this issue Aug 13, 2017

Fix substr tpl func's int type variant issue
`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 #1190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment