Don't override normal links
This commit is contained in:
parent
2920027f30
commit
6883396a74
@ -1,6 +1,7 @@
|
|||||||
package attributes
|
package attributes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -29,9 +30,10 @@ func (s *attributesParser) Trigger() []byte {
|
|||||||
var attributeBottom = parser.NewContextKey()
|
var attributeBottom = parser.NewContextKey()
|
||||||
|
|
||||||
func (s *attributesParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node {
|
func (s *attributesParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node {
|
||||||
|
sl, ss := block.Position()
|
||||||
line, seg := block.PeekLine()
|
line, seg := block.PeekLine()
|
||||||
|
|
||||||
if line[0] == '[' {
|
if line[0] == '[' && bytes.Contains(line, []byte("]{")) {
|
||||||
pc.Set(attributeBottom, pc.LastDelimiter())
|
pc.Set(attributeBottom, pc.LastDelimiter())
|
||||||
return processSpanContentOpen(block, seg.Start, pc)
|
return processSpanContentOpen(block, seg.Start, pc)
|
||||||
}
|
}
|
||||||
@ -39,6 +41,7 @@ func (s *attributesParser) Parse(parent ast.Node, block text.Reader, pc parser.C
|
|||||||
// line[0] == ']'
|
// line[0] == ']'
|
||||||
tlist := pc.Get(spanContentStateKey)
|
tlist := pc.Get(spanContentStateKey)
|
||||||
if tlist == nil {
|
if tlist == nil {
|
||||||
|
block.SetPosition(sl, ss)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +55,13 @@ func (s *attributesParser) Parse(parent ast.Node, block text.Reader, pc parser.C
|
|||||||
|
|
||||||
c := block.Peek()
|
c := block.Peek()
|
||||||
if c != '{' {
|
if c != '{' {
|
||||||
|
block.SetPosition(sl, ss)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs, ok := parser.ParseAttributes(block)
|
attrs, ok := parser.ParseAttributes(block)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
block.SetPosition(sl, ss)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user