In #542 there was already some discussion about whether type conversion for strings should be im- or explicit. And it seems the conclusion was to be explicit about that.
I'd like to go a step further and start the discussion whether other type conversion functions should be introduced, too.
One use case I had today was that I wanted to use a counter within a calculation, i.e. something like calc(counter(x) * 3)
. Though that currently doesn't work because counter(x)
doesn't return a numeric value.
This could be approached in two ways:
One conversion function that is able to convert any type into any other type. This would require several parameters for the value to convert, the type to convert to and an optional unit.
Examples:
grid-row-start: calc(convert(counter(x), "<numeric>") * 3); height: convert(counter(x), "<length>", "em"); content: convert(5, "<string>"); transform: rotate(convert("45", "<angle>", "deg"));
One conversion function for each type.
Examples:
grid-row-start: calc(number(counter(x)) * 3); height: length(counter(x), "em"); content: string(5); transform: rotate(angle("45", "deg"));
Sebastian
mirisuzanne, ByteEater-pl, Zpiboo, yisibl, Crissov and 5 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4