-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_quote.go
66 lines (56 loc) · 1.43 KB
/
mod_quote.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package white600
import (
"strings"
)
// convQuote ...引用の解析。
func (data *MarkdownInfo) convQuote() {
// >
nest := strings.Count(data.currentData.currentLine, "> ")
inQuote := data.currentData.currentLine
if nest == 0 {
nest = data.options.nestQuote
} else {
inQuote = inQuote[2*nest:]
}
// インライン解析
inQuote = data.inlineConv(inQuote)
// open
if data.options.nestQuote < nest {
var text []string
var oldNest = data.options.nestQuote
for data.options.nestQuote < nest {
data.options.nestQuote++
if oldNest != 0 {
text = append(text, "</p>")
}
text = append(text, "<blockquote>")
}
text = append(text, "<p>")
data.html = append(data.html, text...)
}
// インライン要素を追加
data.html = append(data.html, inQuote)
// close
data.quoteTagClose(nest)
// inline
// convData.inlineConv()
}
// closeQuote ...引用ブロックを閉じる。
func (data *MarkdownInfo) closeQuote() {
data.shiftLine()
data.quoteTagClose(0)
}
// quoteTagClose ...引用タグを閉じる。
func (data *MarkdownInfo) quoteTagClose(nest int) {
if data.options.nestQuote > nest {
var text []string
text = append(text, "</p>")
text = append(text, data.currentData.currentLine)
for data.options.nestQuote > nest {
text = append(text, "</blockquote>")
data.options.nestQuote--
}
//data.currentData.currentLine = strings.Join(text, "")
data.html = append(data.html, text...)
}
}