diff --git a/docgenerator.lua b/docgenerator.lua index efa10ee..2bd323f 100644 --- a/docgenerator.lua +++ b/docgenerator.lua @@ -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') diff --git a/models/apimodel.lua b/models/apimodel.lua index f661c85..2a367ad 100644 --- a/models/apimodel.lua +++ b/models/apimodel.lua @@ -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 diff --git a/template/index/recordtypedef.lua b/template/index/recordtypedef.lua index 33796bd..79159ee 100644 --- a/template/index/recordtypedef.lua +++ b/template/index/recordtypedef.lua @@ -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 diff --git a/template/recordtypedef.lua b/template/recordtypedef.lua index cdef337..29c0067 100644 --- a/template/recordtypedef.lua +++ b/template/recordtypedef.lua @@ -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 diff --git a/templateengine.lua b/templateengine.lua index 0f1bd00..c794815 100644 --- a/templateengine.lua +++ b/templateengine.lua @@ -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 '' @@ -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 @@ -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