docs: support for foldable inheritance graphs

This commit is contained in:
Daniel Kolesa 2016-08-02 15:46:03 +01:00
parent 3c34a53cb8
commit ad358a80e9
1 changed files with 10 additions and 2 deletions

View File

@ -10,7 +10,7 @@ local writer = require("docgen.writer")
local keyref = require("docgen.keyref") local keyref = require("docgen.keyref")
local ser = require("docgen.serializers") local ser = require("docgen.serializers")
local use_dot local use_dot, use_folded
-- eolian to various doc elements conversions -- eolian to various doc elements conversions
@ -724,7 +724,13 @@ local build_class = function(cl)
f:write_list(build_inherits(cl)) f:write_list(build_inherits(cl))
f:write_nl() f:write_nl()
if use_dot then if use_dot then
if use_folded then
f:write_raw("++++ Inheritance graph |\n\n")
end
f:write_graph(build_igraph(cl)) f:write_graph(build_igraph(cl))
if use_folded then
f:write_raw("\n\n++++")
end
f:write_nl(2) f:write_nl(2)
end end
@ -1084,7 +1090,8 @@ getopt.parse {
{ "n", "namespace", true, help = "Root namespace of the docs." }, { "n", "namespace", true, help = "Root namespace of the docs." },
{ nil, "graph-theme", true, help = "Optional graph theme." }, { nil, "graph-theme", true, help = "Optional graph theme." },
{ nil, "disable-graphviz", false, help = "Disable graphviz usage." }, { nil, "disable-graphviz", false, help = "Disable graphviz usage." },
{ nil, "disable-notes", false, help = "Disable notes plugin usage." } { nil, "disable-notes", false, help = "Disable notes plugin usage." },
{ nil, "disable-folded", false, help = "Disable folded plugin usage." }
}, },
error_cb = function(parser, msg) error_cb = function(parser, msg)
io.stderr:write(msg, "\n") io.stderr:write(msg, "\n")
@ -1098,6 +1105,7 @@ getopt.parse {
set_theme(opts["graph-theme"]) set_theme(opts["graph-theme"])
end end
use_dot = not opts["disable-graphviz"] use_dot = not opts["disable-graphviz"]
use_folded = not opts["disable-folded"]
local rootns = (not opts["n"] or opts["n"] == "") local rootns = (not opts["n"] or opts["n"] == "")
and "efl" or opts["n"] and "efl" or opts["n"]
local dr local dr