jungvonmatt/wekit

Respect and allow decimal points in .svg viewboxes

Closed this issue · 1 comments

As of now, the svg partial template tries to cast viewboxes containing decimals to float but fails. An example of the error:

error calling float: unable to cast "<svg id=\"Ebene_1\" data-name=\"Ebene 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 220 214.9\"" of type string to float64

The rather complicated regular expression in partials/utils/svg/parse.html looks as follows:

{{ $w1 := replaceRE "<\\s*\\/?\\s*svg\\s*[^>]*view[bB]ox=\"\\s*(\\d+)\\s+\\d+\\s+\\d+\\s+\\d+\\s*\".*" "${1}" . }}

Duplicate of #6