Skip to content

Commit

Permalink
Fix parsing ordered lists that start at zero
Browse files Browse the repository at this point in the history
Backported from 28fbb38
  • Loading branch information
tulir committed Jan 15, 2023
1 parent 420b820 commit 0d23249
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion format/htmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package mautrix

const Version = "v0.11.0"
const Version = "v0.11.1"

var DefaultUserAgent = "mautrix-go/" + Version

0 comments on commit 0d23249

Please sign in to comment.