(content string)
| 325 | } |
| 326 | |
| 327 | func shortPostDescription(content string) string { |
| 328 | maxLen := 140 |
| 329 | fmtStr := "%s" |
| 330 | truncation := 0 |
| 331 | if utf8.RuneCountInString(content) > maxLen { |
| 332 | // Post is longer than the max description, so let's show a better description |
| 333 | fmtStr = "%s..." |
| 334 | truncation = 3 |
| 335 | } |
| 336 | return strings.TrimSpace(fmt.Sprintf(fmtStr, strings.Replace(stringmanip.Substring(content, 0, maxLen-truncation), "\n", " ", -1))) |
| 337 | } |
| 338 | |
| 339 | func handleRenderMarkdown(app *App, w http.ResponseWriter, r *http.Request) error { |
| 340 | if !IsJSON(r) { |
no outgoing calls
no test coverage detected