Skip to content
Open
1 change: 1 addition & 0 deletions docgenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function M.generatedocforfiles(filenames, cssname,noheuristic)
local wrongfiles = {}
for _, filename in pairs( filenames ) do
-- Load file content
print(filename)
local file, error = io.open(filename, 'r')
if not file then return nil, 'Unable to read "'..filename..'"\n'..err end
local code = file:read('*all')
Expand Down
2 changes: 1 addition & 1 deletion models/apimodel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function M._item(name)
if not file then
if self.parent and self.parent.tag == 'recordtypedef' then
file = self.parent.parent
elseif self.parent.tag == 'file' then
elseif self.parent and self.parent.tag == 'file' then
file = self.parent
end
end
Expand Down
12 changes: 7 additions & 5 deletions template/index/recordtypedef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ return [[#
# local file = modules[modulename]
# if file then
# local itypedef = file.types[typedef.supertype.typename]
# itypedef.originalname = itypedef.name
# itypedef.name = name
# inherittype( itypedef, name, itypedef.originalname )
# itypedef.name = itypedef.originalname
# itypedef.inheritedname = nil
# if itypedef then
# itypedef.originalname = itypedef.name
# itypedef.name = name
# inherittype( itypedef, name, itypedef.originalname )
# itypedef.name = itypedef.originalname
# itypedef.inheritedname = nil
# end
# end
# end
# end
Expand Down
18 changes: 10 additions & 8 deletions template/recordtypedef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ return [[#
# end
# if typedef.supertype then
# local modulename = typedef.supertype.modulename
# if modulename then
# if modulename and modules then
# local file = modules[modulename]
# if file then
# local supertypedef = file.types[typedef.supertype.typename]
# supertypedef.originalname = supertypedef.name
# supertypedef.name = name
# supertypedef.originallink = fulllinkto( typedef.supertype )
# inherittype( supertypedef, name, supertypedef.originallink )
# supertypedef.name = supertypedef.originalname
# supertypedef.originalname = nil
# supertypedef.originallink = nil
# if supertypedef then
# supertypedef.originalname = supertypedef.name
# supertypedef.name = name
# supertypedef.originallink = fulllinkto( typedef.supertype )
# inherittype( supertypedef, name, supertypedef.originallink )
# supertypedef.name = supertypedef.originalname
# supertypedef.originalname = nil
# supertypedef.originallink = nil
# end
# end
# end
# end
Expand Down
7 changes: 5 additions & 2 deletions templateengine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function M.applytemplate(elem, ident, templatetype,...)

-- apply template
local str, err = pltemplate.substitute(template, env)

--print(string.format("Template = %s",template))
--manage errors
if not str then
local templateerror = templatetype and string.format(' parsing "%s" template ', templatetype) or ''
Expand All @@ -48,6 +48,7 @@ function M.getenv(elem, ident,...)
local currentenv ={}
for k,v in pairs(M.env) do currentenv[k] = v end
if elem and elem.tag then
--print(elem.tag)
currentenv['_'..elem.tag]= elem
end
currentenv['i']= ident or 1
Expand Down Expand Up @@ -123,9 +124,11 @@ local defaultenv = {
purelinkto = purelinkto,
fulllinkto = fulllinkto,
prettyname = function(s) return s end,
getelement = function(s) return nil end
getelement = function(s) return nil end,
_debug = true,
}


-- this is the global env accessible in the templates
-- env should be redefine by docgenerator user to add functions or redefine it.
M.env = defaultenv
Expand Down