From 02c291bd6526e2e0a7b886ea7f9a1c465e326bf0 Mon Sep 17 00:00:00 2001 From: lxsang Date: Tue, 1 Sep 2020 17:37:44 +0200 Subject: [PATCH 1/2] use backend markdown renderer --- doc/controllers/doccontroller.lua | 7 ++++++- doc/views/default/index/index.ls | 20 ++++---------------- doc/views/default/layout.ls | 4 ++-- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/doc/controllers/doccontroller.lua b/doc/controllers/doccontroller.lua index a97cd78..a9841a7 100644 --- a/doc/controllers/doccontroller.lua +++ b/doc/controllers/doccontroller.lua @@ -105,7 +105,12 @@ function DocController:index(...) end if path and ulib.exists(path) then local file = io.open(path, "r") - local content = file:read("*a") + local content = = "" + local md = require("md") + local callback = function(s) + content = content..s + end + md.to_html(file:read("*a"), callback) file.close() self.template:setView("index", "index") self.template:set("data", content) diff --git a/doc/views/default/index/index.ls b/doc/views/default/index/index.ls index 8c54fef..de42c6a 100644 --- a/doc/views/default/index/index.ls +++ b/doc/views/default/index/index.ls @@ -88,7 +88,9 @@ ?>
- +
- \ No newline at end of file + \ No newline at end of file diff --git a/doc/views/default/layout.ls b/doc/views/default/layout.ls index b41d96f..4f14b2c 100644 --- a/doc/views/default/layout.ls +++ b/doc/views/default/layout.ls @@ -13,10 +13,10 @@ local elinks = __main__:get("elinks") rel="stylesheet" type="text/css" href="/rst/katex/katex.min.css" /> - + > From 86453ce7c0bb336b26ff61c17545417030d656e5 Mon Sep 17 00:00:00 2001 From: lxsang Date: Tue, 1 Sep 2020 17:38:55 +0200 Subject: [PATCH 2/2] fix bug --- doc/controllers/doccontroller.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/controllers/doccontroller.lua b/doc/controllers/doccontroller.lua index a9841a7..0d4ddae 100644 --- a/doc/controllers/doccontroller.lua +++ b/doc/controllers/doccontroller.lua @@ -105,7 +105,7 @@ function DocController:index(...) end if path and ulib.exists(path) then local file = io.open(path, "r") - local content = = "" + local content = "" local md = require("md") local callback = function(s) content = content..s