summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-03-31 14:22:13 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-12 11:58:55 +0100
commitada2474acffcb377eff70475a28eee451b7cc118 (patch)
tree81d6e32944fd99f793ef20085dbfff8af7b19011
parent017fa5a07885a1e7018dc5be2b8e81fba82bb7d6 (diff)
downloadefl-ada2474acffcb377eff70475a28eee451b7cc118.tar.gz
docgen: add inheritance hierarchy generation
-rw-r--r--gendoc.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/gendoc.lua b/gendoc.lua
index 4285e1cf4b..fd257654c2 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -5,6 +5,7 @@ local util = require("util")
local doc_root
local root_nspace
+local verbose = false
-- utils
@@ -310,11 +311,34 @@ local write_full_doc = function(f, doc)
end
end
+local build_inherits
+build_inherits = function(cl, t, lvl)
+ t = t or {}
+ lvl = lvl or 0
+ local lbuf = Buffer()
+ local cltp = classt_to_str[cl:type_get()]
+ lbuf:write_link(gen_namespaces(cl, cltp, true), cl:full_name_get())
+ lbuf:write_raw(" ")
+ lbuf:write_i("(" .. cltp .. ")")
+ t[#t + 1] = { lvl, lbuf:finish() }
+ for cln in cl:inherits_get() do
+ local acl = eolian.class_get_by_name(cln)
+ if not acl then
+ error("error retrieving inherited class " .. cln)
+ end
+ build_inherits(acl, t, lvl + 1)
+ end
+ return t
+end
+
local build_class = function(cl)
local f = Writer(gen_namespaces(cl, classt_to_str[cl:type_get()], false))
f:write_h(cl:full_name_get(), 2)
+ f:write_h("Inheritance hierarchy", 3)
+ f:write_list(build_inherits(cl))
+
f:write_h("Description", 3)
write_full_doc(f, cl:documentation_get())
@@ -368,6 +392,9 @@ getopt.parse {
getopt.help(parser, io.stderr)
end,
done_cb = function(parser, opts, args)
+ if opts["v"] then
+ verbose = true
+ end
root_nspace = opts["n"] or "efl"
if not opts["r"] then
error("no documentation root supplied")