mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-19 19:57:09 +08:00
实现导出Markdown源文件
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user