can now use package field in config.ld. tests/luadoc contains a suitable setup for processing LuaDoc itself correctly

This commit is contained in:
steve donovan 2011-06-20 19:04:21 +02:00
parent 5387084565
commit f2fc6f1604
3 changed files with 33 additions and 13 deletions

View File

@ -373,11 +373,13 @@ end
-- * 'NAME' explicitly give the base module package name
--
if 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
elseif args.package == '..' then
elseif args.package == '..' then
args.package = path.splitpath(source_dir)
elseif not args.package:find '[\//]' then
elseif not args.package:find '[\//]' then
local subdir,dir = path.splitpath(source_dir)
if dir == args.package then
args.package = subdir
@ -386,6 +388,7 @@ elseif not args.package:find '[\//]' then
else
quit("args.package is not the name of the source directory")
end
end
end
local lua, cc = lang.lua, lang.cc
@ -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)
@ -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

4
tests/luadoc/config.ld Normal file
View File

@ -0,0 +1,4 @@
project = 'LuaDoc'
title = "LuaDoc with LDoc"
package = 'luadoc'
file = [[c:\users\steve\luadist\share\lua\lmod\luadoc]]

View File

@ -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