ajwillia-ms pushed a commit to branch master.

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

commit 5b6d3bb5384f9512d2fb51a9cd50035fb8f58a6a
Author: Andy Williams <a...@andywilliams.me>
Date:   Mon Dec 11 16:43:47 2017 +0000

    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.
---
 src/scripts/elua/apps/gendoc.lua | 57 +++++++++++++++++++++++++++++-----------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 04c0764475..2d8d9bbe45 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 = {}

-- 


Reply via email to