[Quotes]: quotes parser
This commit is contained in:
parent
2540eeee26
commit
5161350c20
10
node/ssr.go
10
node/ssr.go
@ -69,7 +69,7 @@ func parseQuotes(message string) string {
|
|||||||
for _, line := range strings.Split(message, "\n") {
|
for _, line := range strings.Split(message, "\n") {
|
||||||
if r.MatchString(line) {
|
if r.MatchString(line) {
|
||||||
author := r.FindAllStringSubmatch(line, 1)
|
author := r.FindAllStringSubmatch(line, 1)
|
||||||
quote := "<figure class=\"text-end\"><blockquote class=\"blockquote quote\"><small>" + author[0][2] + "</small></blockquote>"
|
quote := "<figure class=\"text-end quote\"><blockquote class=\"blockquote\"><small>" + author[0][2] + "</small></blockquote>"
|
||||||
if len(author) > 0 && author[0][1] != "" {
|
if len(author) > 0 && author[0][1] != "" {
|
||||||
quote += `<figcaption class="blockquote-footer">` + author[0][1] + `</figcaption>`
|
quote += `<figcaption class="blockquote-footer">` + author[0][1] + `</figcaption>`
|
||||||
}
|
}
|
||||||
@ -245,7 +245,12 @@ func (s *ssr) singleMessageHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tpl.Execute(w, s.newPageData(msgid, s.es.GetMessage(msgid), 1, false)); err != nil {
|
post := s.es.GetMessage(msgid)
|
||||||
|
if len(post) > 0 {
|
||||||
|
post[0].Message = parseQuotes(post[0].Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tpl.Execute(w, s.newPageData(msgid, post, 1, false)); err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,6 +273,7 @@ func (s *ssr) searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
posts := s.es.DoSearch(string(m))
|
posts := s.es.DoSearch(string(m))
|
||||||
for i := range posts {
|
for i := range posts {
|
||||||
posts[i].Date = parseTime(posts[i].Date)
|
posts[i].Date = parseTime(posts[i].Date)
|
||||||
|
posts[i].Message = parseQuotes(posts[i].Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tpl.Execute(w, s.newPageData("search", posts, 1, false)); err != nil {
|
if err := tpl.Execute(w, s.newPageData("search", posts, 1, false)); err != nil {
|
||||||
|
@ -93,11 +93,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.quote {
|
.quote {
|
||||||
color: green;
|
color: #859900;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-right: 1px;
|
border-right: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: grey;
|
border-color: #586e75;
|
||||||
padding-right: 0.5em;
|
padding-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user