MCPcopy Index your code
hub / github.com/TruthHun/BookStack / BookStackAuto

Method BookStackAuto

models/document.go:592–605  ·  view source on GitHub ↗

自动生成下一级的内容

(bookId, docId int, isSummary ...bool)

Source from the content-addressed store, hash-verified

590
591//自动生成下一级的内容
592func (m *Document) BookStackAuto(bookId, docId int, isSummary ...bool) (md, cont string) {
593 //自动生成文档内容
594 var docs []Document
595 orm.NewOrm().QueryTable("md_documents").Filter("book_id", bookId).Filter("parent_id", docId).OrderBy("order_sort").All(&docs, "document_id", "document_name", "identify")
596 var newCont []string //新HTML内容
597 var newMd []string //新markdown内容
598 for _, doc := range docs {
599 newMd = append(newMd, fmt.Sprintf(`- [%v]($%v)`, doc.DocumentName, doc.Identify))
600 newCont = append(newCont, fmt.Sprintf(`<li><a href="%v">%v</a></li>`, doc.Identify, doc.DocumentName))
601 }
602 md = strings.Join(newMd, "\n")
603 cont = "<ul>" + strings.Join(newCont, "") + "</ul>"
604 return
605}
606
607//爬虫批量采集
608//@param html html

Callers 2

ContentMethod · 0.95
ReleaseContentMethod · 0.80

Calls 2

appendFunction · 0.50
AllMethod · 0.45

Tested by

no test coverage detected