mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
commit
ac8efeef68
@ -272,7 +272,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
|
||||
//先将转换的文件储存到临时目录
|
||||
tempOutputPath := filepath.Join(os.TempDir(), sessionId, m.Identify, "source") //filepath.Abs(filepath.Join("cache", sessionId))
|
||||
|
||||
sourceDir := strings.TrimSuffix(tempOutputPath, "source");
|
||||
sourceDir := strings.TrimSuffix(tempOutputPath, "source")
|
||||
if filetil.FileExists(sourceDir) {
|
||||
if err := os.RemoveAll(sourceDir); err != nil {
|
||||
beego.Error("删除临时目录失败 ->", sourceDir, err)
|
||||
@ -485,7 +485,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
|
||||
}
|
||||
beego.Info("文档转换完成:" + m.BookName)
|
||||
|
||||
if err := filetil.CopyFile(filepath.Join(eBookConverter.OutputPath, "output", "book.mobi"), mobipath, ); err != nil {
|
||||
if err := filetil.CopyFile(filepath.Join(eBookConverter.OutputPath, "output", "book.mobi"), mobipath); err != nil {
|
||||
beego.Error("复制文档失败 -> ", filepath.Join(eBookConverter.OutputPath, "output", "book.mobi"), err)
|
||||
}
|
||||
if err := filetil.CopyFile(filepath.Join(eBookConverter.OutputPath, "output", "book.pdf"), pdfpath); err != nil {
|
||||
|
@ -285,7 +285,7 @@ func (item *Document) Processor() *Document {
|
||||
}
|
||||
content.WriteString("</ul></div>")
|
||||
if docQuery == nil {
|
||||
docQuery, err = goquery.NewDocumentFromReader(content);
|
||||
docQuery, err = goquery.NewDocumentFromReader(content)
|
||||
} else {
|
||||
if selector := docQuery.Find("div.wiki-bottom").First(); selector.Size() > 0 {
|
||||
selector.BeforeHtml(content.String())
|
||||
@ -303,17 +303,8 @@ func (item *Document) Processor() *Document {
|
||||
//处理文档结尾信息
|
||||
docCreator, err := NewMember().Find(item.MemberId, "real_name", "account")
|
||||
release := "<div class=\"wiki-bottom\">"
|
||||
if item.ModifyAt > 0 {
|
||||
docModify, err := NewMember().Find(item.ModifyAt, "real_name", "account")
|
||||
if err == nil {
|
||||
if docModify.RealName != "" {
|
||||
release += "最后编辑: " + docModify.RealName + " "
|
||||
} else {
|
||||
release += "最后编辑: " + docModify.Account + " "
|
||||
}
|
||||
}
|
||||
}
|
||||
release += "文档更新时间: " + item.ModifyTime.Local().Format("2006-01-02 15:04") + " 作者:"
|
||||
|
||||
release += "作者:"
|
||||
if err == nil && docCreator != nil {
|
||||
if docCreator.RealName != "" {
|
||||
release += docCreator.RealName
|
||||
@ -321,6 +312,19 @@ func (item *Document) Processor() *Document {
|
||||
release += docCreator.Account
|
||||
}
|
||||
}
|
||||
release += " 创建时间:" + item.CreateTime.Local().Format("2006-01-02 15:04") + "<br>"
|
||||
|
||||
if item.ModifyAt > 0 {
|
||||
docModify, err := NewMember().Find(item.ModifyAt, "real_name", "account")
|
||||
if err == nil {
|
||||
if docModify.RealName != "" {
|
||||
release += "最后编辑:" + docModify.RealName
|
||||
} else {
|
||||
release += "最后编辑:" + docModify.Account
|
||||
}
|
||||
}
|
||||
}
|
||||
release += " 更新时间:" + item.ModifyTime.Local().Format("2006-01-02 15:04") + "<br>"
|
||||
release += "</div>"
|
||||
|
||||
if selector := docQuery.Find("div.markdown-article").First(); selector.Size() > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user