q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=dbf48bf9f572908d39ca30c0f3975926ab1efeb8

commit dbf48bf9f572908d39ca30c0f3975926ab1efeb8
Author: Daniel Kolesa <[email protected]>
Date:   Fri Oct 20 14:17:10 2017 +0200

    docs: prepare for markdown gendoc backend
---
 src/scripts/elua/apps/docgen/writer.lua | 47 +++++++++++++++++++--------------
 src/scripts/elua/apps/gendoc.lua        |  3 +++
 2 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/scripts/elua/apps/docgen/writer.lua 
b/src/scripts/elua/apps/docgen/writer.lua
index 17238eea35..6dc47c1e39 100644
--- a/src/scripts/elua/apps/docgen/writer.lua
+++ b/src/scripts/elua/apps/docgen/writer.lua
@@ -42,7 +42,33 @@ local allowed_incflags = {
     aftereach = ""
 }
 
-M.Writer = util.Object:clone {
+local writers = {}
+
+local Buffer = {
+    __ctor = function(self)
+        self.buf = {}
+    end,
+
+    write_raw = function(self, ...)
+        for i, v in ipairs({ ... }) do
+            self.buf[#self.buf + 1] = v
+        end
+        return self
+    end,
+
+    finish = function(self)
+        self.result = table.concat(self.buf)
+        self.buf = {}
+        return self.result
+    end
+}
+
+M.set_backend = function(bend)
+    M.Writer = assert(writers[bend], "invalid generation backend")
+    M.Buffer = M.Writer:clone(Buffer)
+end
+
+writers["dokuwiki"] = util.Object:clone {
     INCLUDE_PAGE = 0,
     INCLUDE_SECTION = 1,
     INCLUDE_NAMESPACE = 2,
@@ -432,25 +458,6 @@ M.Writer = util.Object:clone {
     end
 }
 
-M.Buffer = M.Writer:clone {
-    __ctor = function(self)
-        self.buf = {}
-    end,
-
-    write_raw = function(self, ...)
-        for i, v in ipairs({ ... }) do
-            self.buf[#self.buf + 1] = v
-        end
-        return self
-    end,
-
-    finish = function(self)
-        self.result = table.concat(self.buf)
-        self.buf = {}
-        return self.result
-    end
-}
-
 M.init = function(root_ns, ftrs)
     root_nspace = root_ns
     features = ftrs
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 3ecf3dd061..a715a8d591 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -1578,6 +1578,8 @@ getopt.parse {
         { nil, "disable-notes", false, help = "Disable notes plugin usage." },
         { nil, "disable-folded", false, help = "Disable folded plugin usage." 
},
         { nil, "disable-title", false, help = "Disable title plugin usage." },
+        { "m", "use-markdown", false,
+            help = "Generate Markdown instead of DokuWiki syntax." },
         { nil, "pass", true, help = "The pass to run (optional) "
             .. "(rm, ref, clist, classes, types, vars, stats or class name)." }
     },
@@ -1608,6 +1610,7 @@ getopt.parse {
         end
         dr = dutil.path_join(dr, dutil.nspace_to_path(rootns))
         dutil.init(dr, rootns)
+        writer.set_backend("dokuwiki")
         if #args == 0 then
             dtree.scan_directory()
         else

-- 


Reply via email to