Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Support for exporting MediaWiki Fix https://github.com/siyuan-note/siyuan/issues/8135

Liang Dingce942280d225
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index 0df413b5e5..5dd348180b 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -689,6 +689,17 @@ export const exportMd = (id: string) => {
openByMobile(response.data.zip);
});
}
+ }, {
+ label: "MediaWiki",
+ click: () => {
+ const msgId = showMessage(window.siyuan.languages.exporting, -1);
+ fetchPost("/api/export/exportMediaWiki", {
+ id,
+ }, response => {
+ hideMessage(msgId);
+ openByMobile(response.data.zip);
+ });
+ }
},
]
}
diff --git a/kernel/api/export.go b/kernel/api/export.go
index b511ff5c42..1b0f8df618 100644
--- a/kernel/api/export.go
+++ b/kernel/api/export.go
@@ -31,6 +31,23 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
+func exportMediaWiki(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
+
+ id := arg["id"].(string)
+ name, zipPath := model.ExportPandocConvertZip(id, "mediawiki", ".wiki")
+ ret.Data = map[string]interface{}{
+ "name": name,
+ "zip": zipPath,
+ }
+}
+
func exportOrgMode(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 574212c354..0977dfc316 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -250,6 +250,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/export/exportTextile", model.CheckAuth, exportTextile)
ginServer.Handle("POST", "/api/export/exportOPML", model.CheckAuth, exportOPML)
ginServer.Handle("POST", "/api/export/exportOrgMode", model.CheckAuth, exportOrgMode)
+ ginServer.Handle("POST", "/api/export/exportMediaWiki", model.CheckAuth, exportMediaWiki)
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)