forked from enlightenment/efl
docs: disable graph writing from writer api when appropriate
This commit is contained in:
parent
fd54363a4d
commit
a3945c9986
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue