(identify interface{}, defaultTitle ...string)
| 700 | } |
| 701 | |
| 702 | func (m *Document) AutoTitle(identify interface{}, defaultTitle ...string) (title string) { |
| 703 | if len(defaultTitle) > 0 { |
| 704 | title = defaultTitle[0] |
| 705 | } |
| 706 | d := NewDocument() |
| 707 | sqlQuery := "select document_id from md_documents where identify = ? or document_id = ? limit 1" |
| 708 | orm.NewOrm().Raw(sqlQuery, identify, identify).QueryRow(&d) |
| 709 | if d.DocumentId > 0 { |
| 710 | tmpTitle := strings.TrimSpace(utils.ParseTitleFromMdHtml(mdtil.Md2html(NewDocumentStore().GetFiledById(d.DocumentId, "markdown")))) |
| 711 | if tmpTitle != "" { |
| 712 | title = tmpTitle |
| 713 | } |
| 714 | } |
| 715 | return |
| 716 | } |
| 717 | |
| 718 | // markdown 文档拆分 |
| 719 | func (m *Document) SplitMarkdownAndStore(seg string, markdown string, docId int) (err error) { |
no test coverage detected