From b6214af364fac07e2ac0ad4227b15dcbe3d7c516 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 8 Dec 2021 12:24:46 -0800 Subject: [PATCH] doc: Add a `deprecatedmethod` tag. Like all the others, but for a method. --- docs/config.ld | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/config.ld b/docs/config.ld index 2e51ce765..dffe3ecf2 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -102,6 +102,8 @@ new_type("staticfct", "Static module functions", false, "Parameters") new_type("property", "Object properties", false, "Type constraints") -- Documentation for objects deprecated properties 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. -- (yes, the space after Methods *is* on purpose to avoid clashing with ldoc -- internal "methods" concept) @@ -911,25 +913,28 @@ local display_type = { -- Add the `-> ret_type` annotation. local display_return_type = { - method = true, - staticfct = true, + method = true, + deprecatedmethod = true, + staticfct = true, } -- Show return values. local show_return = { - ["function"] = true, - constructorfct = true, - constructorfct2 = true, - legacylayout = true, - staticfct = true, - method = true, - deprecated = true, + ["function"] = true, + constructorfct = true, + constructorfct2 = true, + legacylayout = true, + staticfct = true, + method = true, + deprecated = true, + deprecatedmethod = true, } -- The different type of deprecation. local is_deprecated = { deprecated = true, deprecatedproperty = true, + deprecatedmethod = true, deprecatedsignal = true, } @@ -975,12 +980,12 @@ custom_display_name_handler = function(item, default_handler) end end - if is_deprecated[item.type] then - return ret .. " [deprecated]" + if item.type:match("method") then + ret = render_methods(item) end - if item.type == "method" then - ret = render_methods(item) + if is_deprecated[item.type] then + return ret .. " [deprecated]" end -- Get rid of the "module:" in front of method names. It is either wrong or