Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
can now use package field in config.ld. tests/luadoc contains a suita…
Browse files Browse the repository at this point in the history
…ble setup for processing LuaDoc itself correctly
  • Loading branch information
stevedonovan committed Jun 20, 2011
1 parent 5387084 commit f2fc6f1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
27 changes: 16 additions & 11 deletions ldoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,21 @@ end
-- * 'NAME' explicitly give the base module package name
--

if args.package == '.' then
args.package = source_dir
elseif args.package == '..' then
args.package = path.splitpath(source_dir)
elseif not args.package:find '[\//]' then
local subdir,dir = path.splitpath(source_dir)
if dir == args.package then
args.package = subdir
elseif path.isdir(path.join(source_dir,args.package)) then
local function setup_package_base()
if ldoc.package then args.package = ldoc.package end
if args.package == '.' then
args.package = source_dir
else
quit("args.package is not the name of the source directory")
elseif args.package == '..' then
args.package = path.splitpath(source_dir)
elseif not args.package:find '[\//]' then
local subdir,dir = path.splitpath(source_dir)
if dir == args.package then
args.package = subdir
elseif path.isdir(path.join(source_dir,args.package)) then
args.package = source_dir
else
quit("args.package is not the name of the source directory")
end
end
end

Expand Down Expand Up @@ -417,6 +420,7 @@ if path.isdir(args.file) then
if #config_files > 0 and not config_dir then
config_dir = read_ldoc_config(config_files[1])
end
setup_package_base()

for f in files:iter() do
local ext = path.extension(f)
Expand All @@ -441,6 +445,7 @@ elseif path.isfile(args.file) then
read_ldoc_config(config)
end
end
setup_package_base()
local ext = path.extension(args.file)
local ftype = file_types[ext]
if not ftype then quit "unsupported extension" end
Expand Down
4 changes: 4 additions & 0 deletions tests/luadoc/config.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project = 'LuaDoc'
title = "LuaDoc with LDoc"
package = 'luadoc'
file = [[c:\users\steve\luadist\share\lua\lmod\luadoc]]
15 changes: 13 additions & 2 deletions tests/simple/problem.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
-- this module has a comment.
-- But it's not a doc comment!
--- this module has a comment.

local local_two

--- a local function
local function local_one ()
end

--- a local function, needing explicit tag.
-- @local here
function local_two ()

end

--- A problem function.
-- @param p a parameter
Expand Down

0 comments on commit f2fc6f1

Please sign in to comment.