doc: Add a `deprecatedmethod` tag.

Like all the others, but for a method.
This commit is contained in:
Emmanuel Lepage Vallee 2021-12-08 12:24:46 -08:00
parent 8f71ef6dff
commit b6214af364
1 changed files with 18 additions and 13 deletions

View File

@ -102,6 +102,8 @@ new_type("staticfct", "Static module functions", false, "Parameters")
new_type("property", "Object properties", false, "Type constraints") new_type("property", "Object properties", false, "Type constraints")
-- Documentation for objects deprecated properties -- Documentation for objects deprecated properties
new_type("deprecatedproperty", "Deprecated object properties", false, "Type constraints") new_type("deprecatedproperty", "Deprecated object properties", false, "Type constraints")
-- Documentation for objects deprecated methods
new_type("deprecatedmethod", "Deprecated object methods", false, "Parameters")
-- Use a custom type for the methods to bypass the faulty ldoc built-in detection. -- Use a custom type for the methods to bypass the faulty ldoc built-in detection.
-- (yes, the space after Methods *is* on purpose to avoid clashing with ldoc -- (yes, the space after Methods *is* on purpose to avoid clashing with ldoc
-- internal "methods" concept) -- internal "methods" concept)
@ -911,25 +913,28 @@ local display_type = {
-- Add the `-> ret_type` annotation. -- Add the `-> ret_type` annotation.
local display_return_type = { local display_return_type = {
method = true, method = true,
staticfct = true, deprecatedmethod = true,
staticfct = true,
} }
-- Show return values. -- Show return values.
local show_return = { local show_return = {
["function"] = true, ["function"] = true,
constructorfct = true, constructorfct = true,
constructorfct2 = true, constructorfct2 = true,
legacylayout = true, legacylayout = true,
staticfct = true, staticfct = true,
method = true, method = true,
deprecated = true, deprecated = true,
deprecatedmethod = true,
} }
-- The different type of deprecation. -- The different type of deprecation.
local is_deprecated = { local is_deprecated = {
deprecated = true, deprecated = true,
deprecatedproperty = true, deprecatedproperty = true,
deprecatedmethod = true,
deprecatedsignal = true, deprecatedsignal = true,
} }
@ -975,12 +980,12 @@ custom_display_name_handler = function(item, default_handler)
end end
end end
if is_deprecated[item.type] then if item.type:match("method") then
return ret .. "<i class=\"deprecated_label\"> [deprecated]</i>" ret = render_methods(item)
end end
if item.type == "method" then if is_deprecated[item.type] then
ret = render_methods(item) return ret .. "<i class=\"deprecated_label\"> [deprecated]</i>"
end end
-- Get rid of the "module:" in front of method names. It is either wrong or -- Get rid of the "module:" in front of method names. It is either wrong or