Update dependencies and fix whatsmeow API changes (#1887)

* Update dependencies

* Fix whatsmau API changes
This commit is contained in:
Wim
2022-09-05 21:00:54 +02:00
committed by GitHub
parent 7abf1a5884
commit fda05f2262
44 changed files with 2008 additions and 1703 deletions

View File

@@ -7,8 +7,8 @@ import (
"github.com/gomarkdown/markdown/ast"
)
// parse '(#r)', where r does not contain spaces. Or.
// (!item) (!item, subitem), for an index, (!!item) signals primary.
// parse '(#r, text)', where r does not contain spaces, but text may (similar to a citation). Or. (!item) (!item,
// subitem), for an index, (!!item) signals primary.
func maybeShortRefOrIndex(p *Parser, data []byte, offset int) (int, ast.Node) {
if len(data[offset:]) < 4 {
return 0, nil
@@ -25,8 +25,8 @@ func maybeShortRefOrIndex(p *Parser, data []byte, offset int) (int, ast.Node) {
switch {
case c == ')':
break Loop
case !isAlnum(c):
if c == '_' || c == '-' || c == ':' {
case !IsAlnum(c):
if c == '_' || c == '-' || c == ':' || c == ' ' || c == ',' {
i++
continue
}
@@ -45,6 +45,21 @@ func maybeShortRefOrIndex(p *Parser, data []byte, offset int) (int, ast.Node) {
id := data[2:i]
node := &ast.CrossReference{}
node.Destination = id
if c := bytes.Index(id, []byte(",")); c > 0 {
idpart := id[:c]
suff := id[c+1:]
suff = bytes.TrimSpace(suff)
node.Destination = idpart
node.Suffix = suff
}
if bytes.Index(node.Destination, []byte(" ")) > 0 {
// no spaces allowed in id
return 0, nil
}
if bytes.Index(node.Destination, []byte(",")) > 0 {
// nor comma
return 0, nil
}
return i + 1, node