add line breaks if detected in html document
This commit is contained in:
parent
8e2a642bc0
commit
fd9985892c
1 changed files with 7 additions and 1 deletions
|
@ -43,7 +43,13 @@ func StripHTMLTags(text string) string {
|
||||||
case html.ErrorToken:
|
case html.ErrorToken:
|
||||||
return builder.String()
|
return builder.String()
|
||||||
case html.TextToken:
|
case html.TextToken:
|
||||||
builder.WriteString(token.Token().String() + "")
|
text := token.Token().String()
|
||||||
|
builder.WriteString(text)
|
||||||
|
case html.StartTagToken:
|
||||||
|
tag := token.Token().String()
|
||||||
|
if tag == "<br>" {
|
||||||
|
builder.WriteString("\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue