ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=33a40500488f0a4be602901cbb58895ea6ddbbd6

commit 33a40500488f0a4be602901cbb58895ea6ddbbd6
Author: Andy Williams <a...@andywilliams.me>
Date:   Tue Dec 12 16:31:09 2017 +0000

    docs: Keep description at the top and code snippets at the bottom
---
 src/scripts/elua/apps/gendoc.lua | 83 ++++++++++++++++++++--------------------
 1 file changed, 42 insertions(+), 41 deletions(-)

diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 2f2f4cad9c..e4c0be8b35 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -1063,8 +1063,6 @@ local build_alias = function(tp)
     local f = writer.Writer(ns, fulln)
     printgen("Generating alias: " .. fulln)
 
-    write_tsigs(f, tp, ns)
-
     f:write_h("Description", 2)
     f:write_raw(tp:doc_get():full_get(nil, true))
     f:write_nl(2)
@@ -1072,6 +1070,8 @@ local build_alias = function(tp)
     f:write_editable(ns, "description")
     f:write_nl()
 
+    write_tsigs(f, tp, ns)
+
     f:finish()
 end
 
@@ -1081,8 +1081,6 @@ local build_struct = function(tp)
     local f = writer.Writer(ns, fulln)
     printgen("Generating struct: " .. fulln)
 
-    write_tsigs(f, tp, ns)
-
     f:write_h("Description", 2)
     f:write_raw(tp:doc_get():full_get(nil, true))
     f:write_nl(2)
@@ -1105,6 +1103,8 @@ local build_struct = function(tp)
     f:write_list(arr)
     f:write_nl()
 
+    write_tsigs(f, tp, ns)
+
     f:finish()
 end
 
@@ -1114,8 +1114,6 @@ local build_enum = function(tp)
     local f = writer.Writer(ns, fulln)
     printgen("Generating enum: " .. fulln)
 
-    write_tsigs(f, tp, ns)
-
     f:write_h("Description", 2)
     f:write_raw(tp:doc_get():full_get(nil, true))
     f:write_nl(2)
@@ -1138,6 +1136,8 @@ local build_enum = function(tp)
     f:write_list(arr)
     f:write_nl()
 
+    write_tsigs(f, tp, ns)
+
     f:finish()
 end
 
@@ -1147,8 +1147,6 @@ local build_variable = function(v, constant)
     local f = writer.Writer(ns, fulln)
     printgen("Generating variable: " .. fulln)
 
-    write_tsigs(f, v, ns)
-
     f:write_h("Description", 2)
     f:write_raw(v:doc_get():full_get(nil, true))
     f:write_nl(2)
@@ -1156,6 +1154,8 @@ local build_variable = function(v, constant)
     f:write_editable(ns, "description")
     f:write_nl()
 
+    write_tsigs(f, v, ns)
+
     f:finish()
 end
 
@@ -1325,13 +1325,20 @@ build_method = function(impl, cl)
     local f = writer.Writer(mns, methn)
     printgen("Generating method: " .. methn)
 
-    write_inherited_from(f, impl, cl, over, false)
-
     local doc = impl:doc_get(fn.METHOD)
     if over and not doc:exists() then
         doc = find_parent_doc(impl:full_name_get(), cl, fn.METHOD)
     end
 
+    f:write_h("Description", 2)
+    f:write_raw(doc:full_get(nil, true))
+    f:write_nl()
+
+    f:write_editable(mns, "description")
+    f:write_nl()
+
+    write_inherited_from(f, impl, cl, over, false)
+
     f:write_h("Signature", 2)
     f:write_code(gen_method_sig(fn, cl))
     f:write_nl()
@@ -1347,13 +1354,6 @@ build_method = function(impl, cl)
         f:write_nl()
     end
 
-    f:write_h("Description", 2)
-    f:write_raw(doc:full_get(nil, true))
-    f:write_nl()
-
-    f:write_editable(mns, "description")
-    f:write_nl()
-
     write_ilist(f, impl, cl)
     f:write_nl()
 
@@ -1368,8 +1368,6 @@ build_property = function(impl, cl)
     local f = writer.Writer(pns, propn)
     printgen("Generating property: " .. propn)
 
-    write_inherited_from(f, impl, cl, over, true)
-
     local pimp = fn:implement_get()
 
     local isget = pimp:is_prop_get()
@@ -1391,21 +1389,6 @@ build_property = function(impl, cl)
         end
     end
 
-    f:write_h("Signature", 2)
-    f:write_code(gen_prop_sig(fn, cl))
-    f:write_nl()
-
-    f:write_h("C signature", 2)
-    local codes = {}
-    if isget then
-        codes[#codes + 1] = gen_func_csig(fn, fn.PROP_GET)
-    end
-    if isset then
-        codes[#codes + 1] = gen_func_csig(fn, fn.PROP_SET)
-    end
-    f:write_code(table.concat(codes, "\n"), "c")
-    f:write_nl()
-
     local pgkeys = isget and fn:property_keys_get(fn.PROP_GET) or {}
     local pskeys = isset and fn:property_keys_get(fn.PROP_SET) or {}
     build_vallist(f, pgkeys, pskeys, "Keys")
@@ -1461,10 +1444,28 @@ build_property = function(impl, cl)
     f:write_nl()
     if not isget or not isset then
         f:write_nl()
+        f:write_br()
         f:write_editable(pns, "description")
         f:write_nl()
     end
 
+    write_inherited_from(f, impl, cl, over, true)
+
+    f:write_h("Signature", 2)
+    f:write_code(gen_prop_sig(fn, cl))
+    f:write_nl()
+
+    f:write_h("C signature", 2)
+    local codes = {}
+    if isget then
+        codes[#codes + 1] = gen_func_csig(fn, fn.PROP_GET)
+    end
+    if isset then
+        codes[#codes + 1] = gen_func_csig(fn, fn.PROP_SET)
+    end
+    f:write_code(table.concat(codes, "\n"), "c")
+    f:write_nl()
+
     write_ilist(f, impl, cl)
     f:write_nl()
 
@@ -1503,6 +1504,13 @@ build_event = function(ev, cl)
     local f = writer.Writer(evn, evnm)
     printgen("Generating event: " .. evnm)
 
+    f:write_h("Description", 2)
+    f:write_raw(ev:doc_get():full_get(nil, true))
+    f:write_nl()
+
+    f:write_editable(evn, "description")
+    f:write_nl()
+
     f:write_h("Signature", 2)
     local buf = { ev:name_get() }
 
@@ -1540,13 +1548,6 @@ build_event = function(ev, cl)
     f:write_code(build_event_example(ev), "c")
     f:write_nl()
 
-    f:write_h("Description", 2)
-    f:write_raw(ev:doc_get():full_get(nil, true))
-    f:write_nl()
-
-    f:write_editable(evn, "description")
-    f:write_nl()
-
     f:finish()
 end
 

-- 


Reply via email to