mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
parent
faaafa55b6
commit
fbd164be52
2 changed files with 6 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ import (
|
||||||
type FootnoteLink struct {
|
type FootnoteLink struct {
|
||||||
gast.BaseInline
|
gast.BaseInline
|
||||||
Index int
|
Index int
|
||||||
|
Ref []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump implements Node.Dump.
|
// Dump implements Node.Dump.
|
||||||
|
|
@ -28,9 +29,10 @@ func (n *FootnoteLink) Kind() gast.NodeKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFootnoteLink returns a new FootnoteLink node.
|
// NewFootnoteLink returns a new FootnoteLink node.
|
||||||
func NewFootnoteLink(index int) *FootnoteLink {
|
func NewFootnoteLink(index int, ref []byte) *FootnoteLink {
|
||||||
return &FootnoteLink{
|
return &FootnoteLink{
|
||||||
Index: index,
|
Index: index,
|
||||||
|
Ref: ref,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@ func (s *footnoteParser) Parse(parent gast.Node, block text.Reader, pc parser.Co
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
index := 0
|
index := 0
|
||||||
|
var ref []byte
|
||||||
for def := list.FirstChild(); def != nil; def = def.NextSibling() {
|
for def := list.FirstChild(); def != nil; def = def.NextSibling() {
|
||||||
d := def.(*ast.Footnote)
|
d := def.(*ast.Footnote)
|
||||||
if bytes.Equal(d.Ref, value) {
|
if bytes.Equal(d.Ref, value) {
|
||||||
|
|
@ -157,6 +158,7 @@ func (s *footnoteParser) Parse(parent gast.Node, block text.Reader, pc parser.Co
|
||||||
d.Index = list.Count
|
d.Index = list.Count
|
||||||
}
|
}
|
||||||
index = d.Index
|
index = d.Index
|
||||||
|
ref = d.Ref
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +166,7 @@ func (s *footnoteParser) Parse(parent gast.Node, block text.Reader, pc parser.Co
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return ast.NewFootnoteLink(index)
|
return ast.NewFootnoteLink(index, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
type footnoteASTTransformer struct {
|
type footnoteASTTransformer struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue