Skip to content

Commit

Permalink
more general method of controlling visibility of local functions or i…
Browse files Browse the repository at this point in the history
…tems marked with @Local
  • Loading branch information
stevedonovan committed Jan 2, 2014
1 parent b3f6fc2 commit f507e36
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
7 changes: 1 addition & 6 deletions ldoc.lua
Expand Up @@ -553,12 +553,7 @@ for mod in module_list:iter() do
project:add(mod,module_list)
end

-- the default is not to show local functions in the documentation.
if not args.all and not ldoc.all then
for mod in module_list:iter() do
mod:mask_locals()
end
end
override 'all'

if ldoc.sort_modules then
table.sort(module_list,function(m1,m2)
Expand Down
13 changes: 4 additions & 9 deletions ldoc/doc.lua
Expand Up @@ -230,7 +230,10 @@ function File:finish()
end
end
item:finish()
if doc.project_level(item.type) then
-- the default is not to show local functions in the documentation.
if not self.args.all and (item.type=='lfunction' or (item.tags and item.tags['local'])) then
-- don't add to the module --
elseif doc.project_level(item.type) then
this_mod = item
local package,mname,submodule
if item.type == 'module' then
Expand Down Expand Up @@ -1187,14 +1190,6 @@ function Module:resolve_references(modules)
end
end

-- suppress the display of local functions and annotations.
-- This is just a placeholder hack until we have a more general scheme
-- for indicating 'private' content of a module.
function Module:mask_locals ()
self.kinds['Local Functions'] = nil
self.kinds['Annotations'] = nil
end

function Item:dump_tags (taglist)
for tag, value in pairs(self.tags) do
if not taglist or taglist[tag] then
Expand Down
9 changes: 9 additions & 0 deletions tests/styles/type.lua
Expand Up @@ -25,6 +25,15 @@ function Bonzo:dog ()

end

----
-- Private method.
-- You need -a flag or 'all=true' to see these
-- @local
function Bonzo:cat ()

end


----
-- A subtable with fields.
-- @table Details
Expand Down

0 comments on commit f507e36

Please sign in to comment.