diff --git a/ldoc.lua b/ldoc.lua index a1febdc..08e4def 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -373,18 +373,21 @@ -- * '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 @@ -417,6 +420,7 @@ 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) @@ -441,6 +445,7 @@ 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 diff --git a/tests/luadoc/config.ld b/tests/luadoc/config.ld new file mode 100644 index 0000000..1e5cc5d --- /dev/null +++ b/tests/luadoc/config.ld @@ -0,0 +1,4 @@ +project = 'LuaDoc' +title = "LuaDoc with LDoc" +package = 'luadoc' +file = [[c:\users\steve\luadist\share\lua\lmod\luadoc]] diff --git a/tests/simple/problem.lua b/tests/simple/problem.lua index ad43b99..3848539 100644 --- a/tests/simple/problem.lua +++ b/tests/simple/problem.lua @@ -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