q66 pushed a commit to branch master.

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

commit a3945c9986c114de12d89513694031e25f598ceb
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Wed Aug 10 15:50:19 2016 +0100

    docs: disable graph writing from writer api when appropriate
---
 src/scripts/elua/apps/docgen/writer.lua | 13 +++++++++++--
 src/scripts/elua/apps/gendoc.lua        | 19 ++++++++++---------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/scripts/elua/apps/docgen/writer.lua 
b/src/scripts/elua/apps/docgen/writer.lua
index 06b6563..42f31b1 100644
--- a/src/scripts/elua/apps/docgen/writer.lua
+++ b/src/scripts/elua/apps/docgen/writer.lua
@@ -5,7 +5,7 @@ local dutil = require("docgen.util")
 
 local M = {}
 
-local root_nspace, use_notes, use_folds
+local root_nspace, use_notes, use_folds, use_dot
 
 M.Writer = util.Object:clone {
     __ctor = function(self, path)
@@ -125,6 +125,9 @@ M.Writer = util.Object:clone {
     end,
 
     write_graph = function(self, tbl)
+        if not use_dot then
+            return self
+        end
         self:write_raw("<graphviz>\n")
         self:write_raw("digraph ", tbl.type, " {\n")
 
@@ -317,6 +320,7 @@ M.Writer = util.Object:clone {
         if use_folds then
             self:write_raw("\n\n++++")
         end
+        return self
     end,
 
     finish = function(self)
@@ -343,10 +347,15 @@ M.Buffer = M.Writer:clone {
     end
 }
 
-M.init = function(root_ns, notes, folds)
+M.init = function(root_ns, notes, folds, dot)
     root_nspace = root_ns
     use_notes = notes
     use_folds = folds
+    use_dot = dot
+end
+
+M.has_dot = function()
+    return use_dot
 end
 
 return M
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 06ec97d..1d128d7 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -11,8 +11,6 @@ local keyref = require("docgen.keyref")
 local ser = require("docgen.serializers")
 local dtree = require("docgen.doctree")
 
-local use_dot
-
 -- eolian to various doc elements conversions
 
 local get_fallback_fdoc = function(f, ftype)
@@ -743,10 +741,10 @@ local build_class = function(cl)
     f:write_h(cl:full_name_get(), 2)
     keyref.add(cl:full_name_get():gsub("%.", "_"), "c")
 
-    if use_dot then
-        f:write_folded("Inheritance graph", function()
-            f:write_graph(build_igraph(cl))
-        end)
+    f:write_folded("Inheritance graph", function()
+        f:write_graph(build_igraph(cl))
+    end)
+    if writer.has_dot() then
         f:write_nl(2)
     end
 
@@ -1128,8 +1126,6 @@ getopt.parse {
         if opts["graph-theme"] then
             set_theme(opts["graph-theme"])
         end
-        use_dot = not opts["disable-graphviz"]
-        use_folded = not opts["disable-folded"]
         local rootns = (not opts["n"] or opts["n"] == "")
             and "efl" or opts["n"]
         local dr
@@ -1158,7 +1154,12 @@ getopt.parse {
             error("failed parsing eo files")
         end
         stats.init(not not opts["v"])
-        writer.init(rootns, not opts["disable-notes"], not 
opts["disable-folded"])
+        writer.init(
+            rootns,
+            not opts["disable-notes"],
+            not opts["disable-folded"],
+            not opts["disable-graphviz"]
+        )
         dutil.rm_root()
         dutil.mkdir_r(nil)
         build_ref()

-- 


Reply via email to