实现导出Markdown源文件

This commit is contained in:
Minho
2018-03-12 18:24:58 +08:00
parent 13b9e1a1cb
commit 34654ed4d4
5 changed files with 204 additions and 4 deletions

View File

@@ -860,7 +860,6 @@ func (c *DocumentController) Content() {
// 导出
func (c *DocumentController) Export() {
c.Prepare()
c.TplName = "document/export.tpl"
identify := c.Ctx.Input.Param(":key")
if identify == "" {
@@ -896,6 +895,21 @@ func (c *DocumentController) Export() {
bookResult.Cover = c.BaseUrl() + bookResult.Cover
}
if output == "markdown" {
if bookResult.Editor != "markdown"{
c.ShowErrorPage(500,"当前项目不支持Markdown编辑器")
}
p,err := bookResult.ExportMarkdown(c.CruSession.SessionID())
if err != nil {
c.ShowErrorPage(500,"导出文档失败")
}
c.Ctx.Output.Download(p, bookResult.BookName+".zip")
c.StopRun()
return
}
eBookResult, err := bookResult.Converter(c.CruSession.SessionID())
if err != nil {