docgen: generate brief func/property descriptions correctly

This commit is contained in:
Daniel Kolesa 2016-03-31 15:58:15 +01:00
parent 90f2f0bb65
commit c57ad6e0d9
1 changed files with 11 additions and 8 deletions

View File

@ -162,15 +162,18 @@ local Buffer = Writer:clone {
-- eolian to various doc elements conversions -- eolian to various doc elements conversions
local get_fallback_ftype = function(f, ftype) local get_fallback_fdoc = function(f, ftype)
if not ftype then if not ftype then
local ft = f:get_type() local ft = f:type_get()
local ftt = eolian.function_type local ftt = eolian.function_type
if ft == ftt.PROP_GET or ft == ftt.PROP_SET then if ft == ftt.PROP_GET or ft == ftt.PROP_SET then
return ftt ftype = ft
end end
end end
return ftype if ftype then
return f:documentation_get(ftype)
end
return nil
end end
local get_brief_doc = function(doc1, doc2) local get_brief_doc = function(doc1, doc2)
@ -185,7 +188,7 @@ end
local get_brief_fdoc = function(f, ftype) local get_brief_fdoc = function(f, ftype)
return get_brief_doc(f:documentation_get(eolian.function_type.METHOD), return get_brief_doc(f:documentation_get(eolian.function_type.METHOD),
f:documentation_get(get_fallback_ftype(ftype))) get_fallback_fdoc(f, ftype))
end end
local get_full_doc = function(doc1, doc2) local get_full_doc = function(doc1, doc2)
@ -215,7 +218,7 @@ end
local get_full_fdoc = function(f, ftype) local get_full_fdoc = function(f, ftype)
return get_full_doc(f:documentation_get(eolian.function_type.METHOD), return get_full_doc(f:documentation_get(eolian.function_type.METHOD),
f:documentation_get(get_fallback_ftype(ftype))) get_fallback_fdoc(f, ftype))
end end
local gen_namespaces = function(v, subnspace, root) local gen_namespaces = function(v, subnspace, root)
@ -285,7 +288,7 @@ local build_functable = function(f, title, ctitle, cl, tp)
local ftype = funct_to_str[v:type_get()] local ftype = funct_to_str[v:type_get()]
lbuf:write_link(gen_func_link(cns, v), v:name_get()) lbuf:write_link(gen_func_link(cns, v), v:name_get())
nt[#nt + 1] = { nt[#nt + 1] = {
lbuf:finish(), get_brief_doc(v:documentation_get(eolian.function_type.METHOD)) lbuf:finish(), get_brief_fdoc(v)
} }
end end
table.sort(nt, function(v1, v2) return v1[1] < v2[1] end) table.sort(nt, function(v1, v2) return v1[1] < v2[1] end)
@ -356,7 +359,7 @@ end
local write_full_fdoc = function(f, fn, ftype) local write_full_fdoc = function(f, fn, ftype)
write_full_doc(f, fn:documentation_get(eolian.function_type.METHOD), write_full_doc(f, fn:documentation_get(eolian.function_type.METHOD),
fn:documentation_get(get_fallback_ftype(ftype))) get_fallback_fdoc(fn, ftype))
end end
local build_inherits local build_inherits