doc: Fix the @property handling for @classmod.

Previously, things like `awful.screenshot` would print a false
positive warning because the `item.name` was fixed after the
linting rather than before it.
This commit is contained in:
Emmanuel Lepage Vallee 2023-08-22 04:15:37 -07:00
parent cb72c0a8b1
commit 8e099cfda5
1 changed files with 12 additions and 14 deletions

View File

@ -1739,6 +1739,13 @@ local summarize = {
readonly = {index = 8, title = "read only" , count = false}, readonly = {index = 8, title = "read only" , count = false},
} }
local no_prefix = {
property = true,
signal = true,
clientruleproperty = true,
deprecatedproperty = true,
}
local delimiter_for_tag = { local delimiter_for_tag = {
usebeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}}, usebeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}},
propbeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}}, propbeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}},
@ -2126,7 +2133,11 @@ local function global_init(_ldoc)
-- Decorate the item with our customizations. -- Decorate the item with our customizations.
init_custom_types(item) init_custom_types(item)
-- print(item.description) -- Remove the "namespace" from the signals and properties
if no_prefix[item.type] then
local name = item.name:match("%.([^.]+)$")
item.name = name ~= "" and name or item.name
end
if item.summary and not detect_markdown_footguns(item.summary) then if item.summary and not detect_markdown_footguns(item.summary) then
print( print(
@ -2247,13 +2258,6 @@ local function compare_module_name(input, module)
return false return false
end end
local no_prefix = {
property = true,
signal = true,
clientruleproperty = true,
deprecatedproperty = true,
}
-- These modules merge the doc of their `awful` siblings. -- These modules merge the doc of their `awful` siblings.
local coreclassmap = { local coreclassmap = {
tag = "tag<span class='listplusign'> and awful.tag</span>", tag = "tag<span class='listplusign'> and awful.tag</span>",
@ -2366,12 +2370,6 @@ custom_display_name_handler = function(item, default_handler)
item:build_return_groups() item:build_return_groups()
end end
-- Remove the "namespace" from the signals and properties
if no_prefix[item.type] then
local name = item.name:match("%.([^.]+)$")
return name ~= "" and name or item.name
end
-- Handle the left sidebar modules. -- Handle the left sidebar modules.
if item.type == "coreclassmod" and coreclassmap[item.name] then if item.type == "coreclassmod" and coreclassmap[item.name] then
return coreclassmap[item.name] return coreclassmap[item.name]