doc: Use braces for names function arguments.
Use {} for all functions with take `args` as sole parameters instead of (). Also color them differently to highlight this isn't a typo.
This commit is contained in:
parent
8704b8d89a
commit
5de1e36007
|
@ -178,10 +178,24 @@ local function wrap_modname(str, item)
|
|||
.. str:sub(#item.module.name+2, 9999)
|
||||
end
|
||||
|
||||
local named_args = {
|
||||
[ "(args)" ] = true,
|
||||
[ "([args=nil])" ] = true,
|
||||
[ "([args={}])" ] = true
|
||||
}
|
||||
|
||||
-- Wrap the arguments for the CSS highlight.
|
||||
local function wrap_args(item)
|
||||
if not item.args then return "" end
|
||||
return "<span class='function_args'>"..item.args.."</span>"
|
||||
|
||||
-- Display named args with `{}` and ordered args with `()`
|
||||
if named_args[item.args] then
|
||||
return "<span class='function_named_args'><b>{</b>[args]<b>}</b></span>"
|
||||
end
|
||||
|
||||
local new_args = item.args:sub(2, item.args:len()-2)
|
||||
|
||||
return "<span class='function_args'> <b>(</b>"..new_args.."<b>)</b></span>"
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -315,6 +315,25 @@ table.function_list .function_args /*.function_modname*/ {
|
|||
text-decoration-color: #bbd3ff;
|
||||
}
|
||||
|
||||
table.function_list .function_args b {
|
||||
font-weight: 500;
|
||||
color: #95b1ff;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #bbd3ff;
|
||||
}
|
||||
|
||||
table.function_list .function_named_args b {
|
||||
color: #b37cff;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #bbd3ff;
|
||||
}
|
||||
|
||||
table.function_list .function_named_args {
|
||||
color: #ba97ff;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #bbd3ff;
|
||||
}
|
||||
|
||||
dl.function {
|
||||
margin-right: 15px;
|
||||
margin-left: 15px;
|
||||
|
|
Loading…
Reference in New Issue