MCPcopy Index your code
hub / github.com/writefreely/writefreely / shortPostDescription

Function shortPostDescription

postrender.go:327–337  ·  view source on GitHub ↗
(content string)

Source from the content-addressed store, hash-verified

325}
326
327func 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
339func handleRenderMarkdown(app *App, w http.ResponseWriter, r *http.Request) error {
340 if !IsJSON(r) {

Callers 3

SummaryMethod · 0.85
handleViewPostFunction · 0.85
handleTemplatedPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected