summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gomarkdown/markdown/parser/ref.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-09-05 21:00:54 +0200
committerGitHub <noreply@github.com>2022-09-05 21:00:54 +0200
commitfda05f22629156cc2eae130b501ebced2261ab42 (patch)
treeb9761fb5202ab476b11c1136a5bea69df0dd0f83 /vendor/github.com/gomarkdown/markdown/parser/ref.go
parent7abf1a5884bfba9ac19df26495924d86613874f3 (diff)
downloadmatterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.tar.gz
matterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.tar.bz2
matterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.zip
Update dependencies and fix whatsmeow API changes (#1887)
* Update dependencies * Fix whatsmau API changes
Diffstat (limited to 'vendor/github.com/gomarkdown/markdown/parser/ref.go')
-rw-r--r--vendor/github.com/gomarkdown/markdown/parser/ref.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/parser/ref.go b/vendor/github.com/gomarkdown/markdown/parser/ref.go
index 0b59a196..c1e05341 100644
--- a/vendor/github.com/gomarkdown/markdown/parser/ref.go
+++ b/vendor/github.com/gomarkdown/markdown/parser/ref.go
@@ -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