summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-21 16:48:16 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-21 16:48:52 +0100
commitd8a0daaf5832de85b90ed1133c3c43bcac00045d (patch)
tree89184575f1ec3df4cb897ea30f521ae6392d86c7
parentd6e8ae62e7e243c546a1919a61fa50f7193bca34 (diff)
docgen: inherit overridden method/property brief descriptions on class pages
-rw-r--r--src/scripts/elua/apps/gendoc.lua61
1 files changed, 40 insertions, 21 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 9100f73892..7f6a397cd0 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -665,6 +665,37 @@ local build_igraph = function(cl)
665 return graph 665 return graph
666end 666end
667 667
668local find_parent_impl
669find_parent_impl = function(fulln, cl)
670 for i, inh in ipairs(cl:inherits_get()) do
671 local pcl = dtree.Class.by_name_get(inh)
672 for j, impl in ipairs(pcl:implements_get()) do
673 if impl:full_name_get() == fulln then
674 return impl, pcl
675 end
676 end
677 local pimpl, pcl = find_parent_impl(fulln, pcl)
678 if pimpl then
679 return pimpl, pcl
680 end
681 end
682 return nil, cl
683end
684
685local find_parent_briefdoc
686find_parent_briefdoc = function(fulln, cl)
687 local pimpl, pcl = find_parent_impl(fulln, cl)
688 if not pimpl then
689 return dtree.Doc():brief_get()
690 end
691 local pdoc = pimpl:doc_get(dtree.Function.METHOD, true)
692 local pdocf = pimpl:fallback_doc_get(true)
693 if not pdoc:exists() and (not pdocf or not pdocf:exists()) then
694 return find_parent_briefdoc(fulln, pcl)
695 end
696 return pdoc:brief_get(pdocf)
697end
698
668local build_functable = function(f, title, ctitle, cl, tbl, over) 699local build_functable = function(f, title, ctitle, cl, tbl, over)
669 if #tbl == 0 then 700 if #tbl == 0 then
670 return 701 return
@@ -703,10 +734,15 @@ local build_functable = function(f, title, ctitle, cl, tbl, over)
703 lbuf:write_i(llbuf:finish()) 734 lbuf:write_i(llbuf:finish())
704 end 735 end
705 736
706 nt[#nt + 1] = { 737 local doc = impl:doc_get(func.METHOD, true)
707 lbuf:finish(), 738 local docf = impl:fallback_doc_get(true)
708 impl:doc_get(func.METHOD, true):brief_get(impl:fallback_doc_get(true)) 739 local bdoc
709 } 740 if over and (not doc:exists() and (not docf or not docf:exists())) then
741 bdoc = find_parent_briefdoc(impl:full_name_get(), cl)
742 else
743 bdoc = doc:brief_get(docf)
744 end
745 nt[#nt + 1] = { lbuf:finish(), bdoc }
710 if impl:is_prop_get() or impl:is_prop_set() then 746 if impl:is_prop_get() or impl:is_prop_set() then
711 build_property(impl, cl) 747 build_property(impl, cl)
712 else 748 else
@@ -984,23 +1020,6 @@ local build_vallist = function(f, pg, ps, title)
984 end 1020 end
985end 1021end
986 1022
987local find_parent_impl
988find_parent_impl = function(fulln, cl)
989 for i, inh in ipairs(cl:inherits_get()) do
990 local pcl = dtree.Class.by_name_get(inh)
991 for j, impl in ipairs(pcl:implements_get()) do
992 if impl:full_name_get() == fulln then
993 return impl, pcl
994 end
995 end
996 local pimpl, pcl = find_parent_impl(fulln, pcl)
997 if pimpl then
998 return pimpl, pcl
999 end
1000 end
1001 return nil, cl
1002end
1003
1004local find_parent_doc 1023local find_parent_doc
1005find_parent_doc = function(fulln, cl, ftype) 1024find_parent_doc = function(fulln, cl, ftype)
1006 local pimpl, pcl = find_parent_impl(fulln, cl) 1025 local pimpl, pcl = find_parent_impl(fulln, cl)