|
@@ -508,8 +508,13 @@ func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
|
|
|
plus = 12
|
|
|
}
|
|
|
endIndex := strings.Index(body, "<hr")
|
|
|
- if coreIndex != -1 && endIndex != -1 {
|
|
|
- body = body[coreIndex+plus : endIndex]
|
|
|
+ //如果有下划线跟核心观点就获取 核心观点~下划线之间的内容,如果没有就获取整个下划线的内容
|
|
|
+ if endIndex != -1 {
|
|
|
+ if coreIndex != -1 {
|
|
|
+ body = body[coreIndex+plus : endIndex]
|
|
|
+ } else {
|
|
|
+ body = body[0:endIndex]
|
|
|
+ }
|
|
|
}
|
|
|
annotation = body
|
|
|
return
|