doc: Fix the item summary rendering.
* Correctly count the elements * Use singular and plural tense properly
This commit is contained in:
parent
74ba84b299
commit
31e0a3e67b
|
@ -514,11 +514,11 @@ local named_args = {
|
||||||
|
|
||||||
-- Sections which are hidden by default, but visible when clicked.
|
-- Sections which are hidden by default, but visible when clicked.
|
||||||
local summarize = {
|
local summarize = {
|
||||||
emits = {index = 1, title = "signals" , count = true },
|
emits = {index = 1, title = "signal" , count = true },
|
||||||
propemits = {index = 2, title = "signals" , count = true },
|
propemits = {index = 2, title = "signal" , count = true },
|
||||||
usebeautiful = {index = 3, title = "theme variables" , count = true },
|
usebeautiful = {index = 3, title = "theme variable" , count = true },
|
||||||
propbeautiful = {index = 4, title = "theme variables" , count = true },
|
propbeautiful = {index = 4, title = "theme variable" , count = true },
|
||||||
request = {index = 5, title = "permissions" , count = true },
|
request = {index = 5, title = "permission" , count = true },
|
||||||
classsignal = {index = 6, title = "Class level only", count = false},
|
classsignal = {index = 6, title = "Class level only", count = false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ local function generate_summary(item)
|
||||||
|
|
||||||
for tag, value in pairs(item.tags) do
|
for tag, value in pairs(item.tags) do
|
||||||
if summarize[tag] then
|
if summarize[tag] then
|
||||||
tgs[summarize[tag].index].count = tgs[summarize[tag].index].count + 1
|
tgs[summarize[tag].index].count = #value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -559,6 +559,11 @@ local function generate_summary(item)
|
||||||
|
|
||||||
for k, v in ipairs(tgs) do
|
for k, v in ipairs(tgs) do
|
||||||
if v.count > 0 then
|
if v.count > 0 then
|
||||||
|
|
||||||
|
if v.count > 1 then
|
||||||
|
v.title = v.title .. "s"
|
||||||
|
end
|
||||||
|
|
||||||
ret[#ret+1] = v
|
ret[#ret+1] = v
|
||||||
has_show_more = v.showcount or has_show_more
|
has_show_more = v.showcount or has_show_more
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue