Fix parsing ordered lists that start at zero

Backported from 28fbb3851d
This commit is contained in:
Tulir Asokan 2023-01-15 15:46:53 +02:00
commit 0d23249f92
2 changed files with 7 additions and 2 deletions

View file

@ -71,8 +71,13 @@ func (parser *HTMLParser) getAttribute(node *html.Node, attribute string) string
return ""
}
// Digits counts the number of digits in a non-negative integer.
// Digits counts the number of digits (and the sign, if negative) in an integer.
func Digits(num int) int {
if num == 0 {
return 1
} else if num < 0 {
return Digits(-num) + 1
}
return int(math.Floor(math.Log10(float64(num))) + 1)
}

View file

@ -1,5 +1,5 @@
package mautrix
const Version = "v0.11.0"
const Version = "v0.11.1"
var DefaultUserAgent = "mautrix-go/" + Version