diff options
author | 2023-08-21 06:39:14 +0000 | |
---|---|---|
committer | 2023-08-21 06:39:14 +0000 | |
commit | 36dceac56c467033648590dd7e6ea100e1f824a2 (patch) | |
tree | 54d1d6451c63785278ad5c1a6331a1d38fe2363e /vendor/github.com/yuin/goldmark/parser/parser.go | |
parent | [feature/bugfix] Probe S3 storage for CSP uri, add config flag for extra URIs... (diff) | |
download | gotosocial-36dceac56c467033648590dd7e6ea100e1f824a2.tar.xz |
[chore]: Bump github.com/yuin/goldmark from 1.5.5 to 1.5.6 (#2140)
Diffstat (limited to 'vendor/github.com/yuin/goldmark/parser/parser.go')
-rw-r--r-- | vendor/github.com/yuin/goldmark/parser/parser.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/vendor/github.com/yuin/goldmark/parser/parser.go b/vendor/github.com/yuin/goldmark/parser/parser.go index a82369266..5cc2175f9 100644 --- a/vendor/github.com/yuin/goldmark/parser/parser.go +++ b/vendor/github.com/yuin/goldmark/parser/parser.go @@ -403,7 +403,8 @@ func (p *parseContext) IsInLinkLabel() bool { type State int const ( - none State = 1 << iota + // None is a default value of the [State]. + None State = 1 << iota // Continue indicates parser can continue parsing. Continue @@ -1049,7 +1050,7 @@ func isBlankLine(lineNum, level int, stats []lineStat) bool { func (p *parser) parseBlocks(parent ast.Node, reader text.Reader, pc Context) { pc.SetOpenedBlocks([]Block{}) blankLines := make([]lineStat, 0, 128) - isBlank := false + var isBlank bool for { // process blocks separated by blank lines _, lines, ok := reader.SkipBlankLines() if !ok { @@ -1152,18 +1153,23 @@ func (p *parser) parseBlock(block text.BlockReader, parent ast.Node, pc Context) break } lineLength := len(line) - var lineBreakFlags uint8 = 0 + var lineBreakFlags uint8 hasNewLine := line[lineLength-1] == '\n' - if ((lineLength >= 3 && line[lineLength-2] == '\\' && line[lineLength-3] != '\\') || (lineLength == 2 && line[lineLength-2] == '\\')) && hasNewLine { // ends with \\n + if ((lineLength >= 3 && line[lineLength-2] == '\\' && + line[lineLength-3] != '\\') || (lineLength == 2 && line[lineLength-2] == '\\')) && hasNewLine { // ends with \\n lineLength -= 2 lineBreakFlags |= lineBreakHard | lineBreakVisible - } else if ((lineLength >= 4 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r' && line[lineLength-4] != '\\') || (lineLength == 3 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r')) && hasNewLine { // ends with \\r\n + } else if ((lineLength >= 4 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r' && + line[lineLength-4] != '\\') || (lineLength == 3 && line[lineLength-3] == '\\' && line[lineLength-2] == '\r')) && + hasNewLine { // ends with \\r\n lineLength -= 3 lineBreakFlags |= lineBreakHard | lineBreakVisible - } else if lineLength >= 3 && line[lineLength-3] == ' ' && line[lineLength-2] == ' ' && hasNewLine { // ends with [space][space]\n + } else if lineLength >= 3 && line[lineLength-3] == ' ' && line[lineLength-2] == ' ' && + hasNewLine { // ends with [space][space]\n lineLength -= 3 lineBreakFlags |= lineBreakHard - } else if lineLength >= 4 && line[lineLength-4] == ' ' && line[lineLength-3] == ' ' && line[lineLength-2] == '\r' && hasNewLine { // ends with [space][space]\r\n + } else if lineLength >= 4 && line[lineLength-4] == ' ' && line[lineLength-3] == ' ' && + line[lineLength-2] == '\r' && hasNewLine { // ends with [space][space]\r\n lineLength -= 4 lineBreakFlags |= lineBreakHard } else if hasNewLine { |