Subtract int string

Anyone want to make this quicker? It’d be faster to leave parameter as string, convert to int with strings.TrimPrefix

+++
str = "0.1"
+++
{{- $var :=  "" -}}

{{- with .Params.str -}}
{{- $var = float (slicestr  .  2) -}}
{{- $var = div $var (float 10) -}}
{{- $var = sub (float 1) $var -}}
{{- end -}}

I’m not sure what the goal is, but if you want to subtract str from 1:

{{ sub 1 (float $str) }}

Injecting opacity css inline to picture tags. The same parameter is used elsewhere in inline background rgba, for image tint and transparency. Coming from the Hugo side, it’s nice to encounter again go’s typecasting, Javascript makes you lazy.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.