WIP update deps, sql builder instead of jet
This commit is contained in:
81
vendor/github.com/gomarkdown/markdown/parser/block.go
generated
vendored
81
vendor/github.com/gomarkdown/markdown/parser/block.go
generated
vendored
@@ -951,8 +951,6 @@ func (p *Parser) fencedCodeBlock(data []byte, doRender bool) int {
|
||||
work.WriteByte('\n')
|
||||
|
||||
for {
|
||||
// safe to assume beg < len(data)
|
||||
|
||||
// check for the end of the code block
|
||||
fenceEnd, _ := isFenceLine(data[beg:], nil, marker)
|
||||
if fenceEnd != 0 {
|
||||
@@ -969,48 +967,47 @@ func (p *Parser) fencedCodeBlock(data []byte, doRender bool) int {
|
||||
}
|
||||
|
||||
// verbatim copy to the working buffer
|
||||
if doRender {
|
||||
work.Write(data[beg:end])
|
||||
}
|
||||
work.Write(data[beg:end])
|
||||
beg = end
|
||||
}
|
||||
|
||||
if doRender {
|
||||
codeBlock := &ast.CodeBlock{
|
||||
IsFenced: true,
|
||||
}
|
||||
codeBlock.Content = work.Bytes() // TODO: get rid of temp buffer
|
||||
if !doRender {
|
||||
return beg
|
||||
}
|
||||
codeBlock := &ast.CodeBlock{
|
||||
IsFenced: true,
|
||||
}
|
||||
codeBlock.Content = work.Bytes() // TODO: get rid of temp buffer
|
||||
|
||||
if p.extensions&Mmark == 0 {
|
||||
p.AddBlock(codeBlock)
|
||||
finalizeCodeBlock(codeBlock)
|
||||
return beg
|
||||
}
|
||||
|
||||
// Check for caption and if found make it a figure.
|
||||
if captionContent, id, consumed := p.caption(data[beg:], []byte(captionFigure)); consumed > 0 {
|
||||
figure := &ast.CaptionFigure{}
|
||||
caption := &ast.Caption{}
|
||||
figure.HeadingID = id
|
||||
p.Inline(caption, captionContent)
|
||||
|
||||
p.AddBlock(figure)
|
||||
codeBlock.AsLeaf().Attribute = figure.AsContainer().Attribute
|
||||
p.addChild(codeBlock)
|
||||
finalizeCodeBlock(codeBlock)
|
||||
p.addChild(caption)
|
||||
p.Finalize(figure)
|
||||
|
||||
beg += consumed
|
||||
|
||||
return beg
|
||||
}
|
||||
|
||||
// Still here, normal block
|
||||
if p.extensions&Mmark == 0 {
|
||||
p.AddBlock(codeBlock)
|
||||
finalizeCodeBlock(codeBlock)
|
||||
return beg
|
||||
}
|
||||
|
||||
// Check for caption and if found make it a figure.
|
||||
if captionContent, id, consumed := p.caption(data[beg:], []byte(captionFigure)); consumed > 0 {
|
||||
figure := &ast.CaptionFigure{}
|
||||
caption := &ast.Caption{}
|
||||
figure.HeadingID = id
|
||||
p.Inline(caption, captionContent)
|
||||
|
||||
p.AddBlock(figure)
|
||||
codeBlock.AsLeaf().Attribute = figure.AsContainer().Attribute
|
||||
p.addChild(codeBlock)
|
||||
finalizeCodeBlock(codeBlock)
|
||||
p.addChild(caption)
|
||||
p.Finalize(figure)
|
||||
|
||||
beg += consumed
|
||||
|
||||
return beg
|
||||
}
|
||||
|
||||
// Still here, normal block
|
||||
p.AddBlock(codeBlock)
|
||||
finalizeCodeBlock(codeBlock)
|
||||
|
||||
return beg
|
||||
}
|
||||
|
||||
@@ -1353,6 +1350,7 @@ func finalizeList(list *ast.List) {
|
||||
// Parse a single list item.
|
||||
// Assumes initial prefix is already removed if this is a sublist.
|
||||
func (p *Parser) listItem(data []byte, flags *ast.ListType) int {
|
||||
isDefinitionList := *flags&ast.ListTypeDefinition != 0
|
||||
// keep track of the indentation of the first line
|
||||
itemIndent := 0
|
||||
if data[0] == '\t' {
|
||||
@@ -1385,7 +1383,7 @@ func (p *Parser) listItem(data []byte, flags *ast.ListType) int {
|
||||
}
|
||||
if i == 0 {
|
||||
// if in definition list, set term flag and continue
|
||||
if *flags&ast.ListTypeDefinition != 0 {
|
||||
if isDefinitionList {
|
||||
*flags |= ast.ListTypeTerm
|
||||
} else {
|
||||
return 0
|
||||
@@ -1446,7 +1444,14 @@ gatherlines:
|
||||
|
||||
// If there is a fence line (marking starting of a code block)
|
||||
// without indent do not process it as part of the list.
|
||||
if p.extensions&FencedCode != 0 {
|
||||
//
|
||||
// does not apply for definition lists because it causes infinite
|
||||
// loop if text before defintion term is fenced code block start
|
||||
// marker but not part of actual fenced code block
|
||||
// for defnition lists we're called after parsing fence code blocks
|
||||
// so we kno this cannot be a fenced block
|
||||
// https://github.com/gomarkdown/markdown/issues/326
|
||||
if !isDefinitionList && p.extensions&FencedCode != 0 {
|
||||
fenceLineEnd, _ := isFenceLine(chunk, nil, "")
|
||||
if fenceLineEnd > 0 && indent == 0 {
|
||||
*flags |= ast.ListItemEndOfList
|
||||
|
||||
Reference in New Issue
Block a user