优化
This commit is contained in:
parent
735ae5c951
commit
7c4fdc9084
|
@ -47,11 +47,11 @@ func ExceptRaw(str string, limit, id int) string {
|
||||||
} else {
|
} else {
|
||||||
content = string(ru[:end])
|
content = string(ru[:end])
|
||||||
closeTag := CloseHtmlTag(content)
|
closeTag := CloseHtmlTag(content)
|
||||||
|
tmp := `%s......%s<p class="read-more"><a href="/p/%d">继续阅读</a></p>`
|
||||||
if strings.Contains(closeTag, "pre") || strings.Contains(closeTag, "code") {
|
if strings.Contains(closeTag, "pre") || strings.Contains(closeTag, "code") {
|
||||||
content = fmt.Sprintf(`%s%s......<p class="read-more"><a href="/p/%d">继续阅读</a></p>`, content, closeTag, id)
|
tmp = `%s%s......<p class="read-more"><a href="/p/%d">继续阅读</a></p>`
|
||||||
} else {
|
|
||||||
content = fmt.Sprintf(`%s......%s<p class="read-more"><a href="/p/%d">继续阅读</a></p>`, content, closeTag, id)
|
|
||||||
}
|
}
|
||||||
|
content = fmt.Sprintf(tmp, content, closeTag, id)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user