fix implemented-by sections (no dead links)

This commit is contained in:
Daniel Kolesa 2020-02-13 14:54:46 +01:00
parent 1c68295114
commit dbc6585d4c
3 changed files with 19 additions and 10 deletions

View File

@ -716,6 +716,16 @@ find_callables = function(cl, omeths, events, written, no_overrides)
end
end
M.impl_has_doc = function(impl)
if impl:documentation_get(eolian.function_type.PROP_GET) or
impl:documentation_get(eolian.function_type.PROP_SET) or
impl:documentation_get(eolian.function_type.UNRESOLVED)
then
return true
end
return false
end
local has_custom_doc = function(impl, cl, no_overrides)
-- we don't care, let it pass
if not no_overrides then
@ -726,13 +736,7 @@ local has_custom_doc = function(impl, cl, no_overrides)
return true
end
-- otherwise check if this has *any* part of doc...
if impl:documentation_get(eolian.function_type.PROP_GET) or
impl:documentation_get(eolian.function_type.PROP_SET) or
impl:documentation_get(eolian.function_type.UNRESOLVED)
then
return true
end
return false
return M.impl_has_doc(impl)
end
M.callables_get = function(cl, no_overrides)
@ -877,7 +881,7 @@ get_all_impls_of = function(tbl, cl, fn, got)
for imp in cl:implements_get() do
local ofn = imp:function_get()
if ofn == fn then
tbl[#tbl + 1] = cl
tbl[#tbl + 1] = imp
break
end
end

View File

@ -566,7 +566,7 @@ end
local write_ilist = function(f, impl, cl)
f:write_raw(template.compile("templates/include/impls.txt")({
doc = docm, eoutils = eoutils, fn_obj = impl:function_get()
doc = docm, eoutils = eoutils, fn_obj = impl:function_get(), cl_obj = cl
}, true))
end

View File

@ -1,8 +1,13 @@
===== Implemented by =====
{% for i, icl in ipairs(eoutils.impls_of_get(fn_obj)) do %}
{% for i, imp in ipairs(eoutils.impls_of_get(fn_obj)) do %}
{% local icl = imp:implementing_class_get() %}
{% if icl == cl_obj then %}
* **{*icl:name_get()*}.{*fn_obj:name_get()*}**
{% elseif icl:is_beta() then %}
* <del>{*icl:name_get()*}.{*fn_obj:name_get()*}</del> //(beta object)//
{% elseif not eoutils.impl_has_doc(imp) then %}
* [[{*doc.link_target_get(eoutils.obj_nspaces_get(icl, true))*}|{*icl:name_get()*}]].{*fn_obj:name_get()*}
{% else %}
* [[{*doc.link_target_get(eoutils.func_nspaces_get(fn_obj, icl, true))*}|{*icl:name_get()*}.{*fn_obj:name_get()*}]]
{% end %}