diff --git a/ldoc.lua b/ldoc.lua index 9542d16..96f3e1b 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -232,7 +232,7 @@ local function process_file (f, file_list) local ftype = file_types[ext] if ftype then if args.verbose then print(path.basename(f)) end - local F,err = parse.file(f,ftype) + local F,err = parse.file(f,ftype,args) if err then quit(err) end file_list:append(F) end @@ -240,6 +240,9 @@ end local process_file_list = tools.process_file_list +setup_package_base() + + if type(args.file) == 'table' then -- this can only be set from config file so we can assume it's already read process_file_list(args.file,'*.*',process_file, file_list) @@ -280,8 +283,6 @@ else quit ("file or directory does not exist: "..quote(args.file)) end -setup_package_base() - local multiple_files = #file_list > 1 local first_module diff --git a/ldoc/parse.lua b/ldoc/parse.lua index f5e92c3..c52e1df 100644 --- a/ldoc/parse.lua +++ b/ldoc/parse.lua @@ -68,7 +68,7 @@ end -- encountered, then ldoc looks for a call to module() to find the name of the -- module if there isn't an explicit module name specified. -local function parse_file(fname,lang) +local function parse_file(fname,lang, package) local line,f = 1 local F = File(fname) local module_found, first_comment = false,true @@ -157,7 +157,7 @@ local function parse_file(fname,lang) if not module_found or module_found == '...' then if not t then return nil, fname..": end of file" end -- run out of file! -- we have to guess the module name - module_found = tools.this_module_name(args.package,fname) + module_found = tools.this_module_name(package,fname) end if not tags then tags = extract_tags(comment) end add_module(tags,module_found,old_style) @@ -191,8 +191,8 @@ local function parse_file(fname,lang) return F end -function parse.file(name,lang) - local F,err = parse_file(name,lang) +function parse.file(name,lang, args) + local F,err = parse_file(name,lang, args.package) if err then return nil,err end F:finish() return F