From: Andy Williams Date: Mon, 11 Dec 2017 16:43:47 +0000 (+0000) Subject: docs: Compact and lay out the header of API docs X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b6d3bb5384f9512d2fb51a9cd50035fb8f58a6a;p=platform%2Fupstream%2Fefl.git docs: Compact and lay out the header of API docs Add an inheritance summary (following the primary class heirarchy). Move the full heirarchy to a folded section. Put the description at the top where it belongs. --- diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 04c0764..2d8d9bb 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -375,19 +375,36 @@ build_inherits = function(cl, t, lvl) t = t or {} lvl = lvl or 0 local lbuf = writer.Buffer() - lbuf:write_link(cl:nspaces_get(true), cl:full_name_get()) - lbuf:write_raw(" ") - lbuf:write_i("(" .. cl:type_str_get() .. ")") - if lvl == 0 then - lbuf:write_b(lbuf:finish()) + if lvl > 0 then + lbuf:write_link(cl:nspaces_get(true), cl:full_name_get()) + lbuf:write_raw(" ") + lbuf:write_i("(" .. cl:type_str_get() .. ")") + + t[#t + 1] = { lvl - 1, lbuf:finish() } end - t[#t + 1] = { lvl, lbuf:finish() } + for i, acl in ipairs(cl:inherits_get()) do build_inherits(acl, t, lvl + 1) end return t end +local build_inherit_summary +build_inherit_summary = function(cl, buf) + buf = buf or writer.Buffer() + buf:write_raw(" => ") + + buf:write_link(cl:nspaces_get(true), cl:full_name_get()) + buf:write_raw(" ") + buf:write_i("(" .. cl:type_str_get() .. ")") + + local inherits = cl:inherits_get() + if #inherits ~= 0 then + build_inherit_summary(inherits[1], buf) + end + return buf +end + local default_theme_light = { classes = { regular = { @@ -968,6 +985,22 @@ local build_class = function(cl) local f = writer.Writer(cln, fulln) printgen("Generating class: " .. fulln) + f:write_h(cl:full_name_get() .. " (" .. cl:type_str_get() .. ")", 1) + + f:write_h("Description", 2) + f:write_raw(cl:doc_get():full_get(nil, true)) + f:write_nl(2) + + f:write_editable(cln, "description") + f:write_nl() + + f:write_h("Inheritance", 2) + local inherits = cl:inherits_get() + if #inherits ~= 0 then + f:write_raw(build_inherit_summary(inherits[1]):finish()) + end + f:write_nl() + f:write_folded("Inheritance graph", function() f:write_graph(build_igraph(cl)) end) @@ -975,15 +1008,9 @@ local build_class = function(cl) f:write_nl(2) end - f:write_h("Inheritance hierarchy", 2) - f:write_list(build_inherits(cl)) - f:write_nl() - - f:write_h("Description", 2) - f:write_raw(cl:doc_get():full_get(nil, true)) - f:write_nl(2) - - f:write_editable(cln, "description") + f:write_folded("Full hierarchy", function() + f:write_list(build_inherits(cl)) + end) f:write_nl() local written = {}