forked from b3log/lute
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththematic_break.go
More file actions
41 lines (36 loc) · 1.12 KB
/
thematic_break.go
File metadata and controls
41 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Lute - A structured markdown engine.
// Copyright (c) 2019-present, b3log.org
//
// Lute is licensed under the Mulan PSL v1.
// You can use this software according to the terms and conditions of the Mulan PSL v1.
// You may obtain a copy of Mulan PSL v1 at:
// http://license.coscl.org.cn/MulanPSL
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v1 for more details.
package lute
func (t *Tree) parseThematicBreak() (ok bool, markers []byte) {
markerCnt := 0
var marker byte
for i := t.context.nextNonspace; i < t.context.currentLineLen-1; i++ {
token := t.context.currentLine[i]
term := token
markers = append(markers, t.context.currentLine[i])
if itemSpace == term || itemTab == term {
continue
}
if itemHyphen != term && itemUnderscore != term && itemAsterisk != term {
return
}
if 0 != marker {
if marker != term {
return
}
} else {
marker = term
}
markerCnt++
}
return 3 <= markerCnt, markers
}