From a793150e96506a3043d792e29627b633499aa6a3 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 2 Nov 2018 13:00:45 -0400 Subject: Methods can mark domain Added documentation settings that lets functions mark themselves as @domain client @domain shared @domain server --- config.ld | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'config.ld') diff --git a/config.ld b/config.ld index b6337c2..9fc7140 100644 --- a/config.ld +++ b/config.ld @@ -13,8 +13,8 @@ file = { } format = 'markdown' sort_modules = true -new_type("concommand","Console commands", true) -new_type("metamethod","Meta Methods", true) +--[[new_type("concommand","Console commands", true) +new_type("metamethod","Meta Methods", true)]] new_type("server","Server Modules", true) new_type("client","Client Modules", true) @@ -23,26 +23,31 @@ new_type("shared","Shared Modules", true) new_type("tutorial","Tutorials",true) custom_tags = { {'reqadmin', hidden=false}, + {"domain", hidden=false}, } -custom_display_name_handler = function(item,default_handeler) +custom_display_name_handler = function(item,default_handler) + local decorators = {} + local decorate = { + reqadmin = function(key,name) return string.format(" %s Requires Admin",name) end, + domain = function(key,name) return "[" .. key[1] .. "]" .. name end, + } if item.type == "concommand" then if item.tags.reqadmin then for k,v in pairs(item) do print(k,":",v) end - return item.name .. " Requires Admin " - end - elseif item.type == "domain" then - if item.tags.domain == "server" then - return "[Server]" - elseif item.tags.domain == "client" then - return "[Client]" - elseif item.tags.domain == "shared" then - return "[Shared]" + decorators["reqadmin"] = true end end - return default_handeler(item) + if item.tags.domain then + decorators.domain = item.tags.domain + end + local s = default_handler(item) + for k,v in pairs(decorators) do + s = decorate[k](v,s) + end + return s end style = "doc" readme = {"README.md"} -- cgit v1.2.3-70-g09d2