@@ -141,17 +141,20 @@ function Doc(body, metadata, variables)
141141    add (renderToc (vim_doc_title ))
142142  end 
143143  add (body )
144-   local  left  =  header_count  ..  " . Links" 
145-   local  right  =  " links" 
146-   local  right_link  =  string.format (" |%s-%s|" stringify (meta .project ), right )
147-   right  =  string.format (" *%s-%s*" stringify (meta .project ), right )
148-   local  padding  =  string.rep ("  " 78  -  # left  -  # right )
149-   table.insert (toc , { 1 , left , right_link  })
150-   add (string.rep (" =" 78 ) ..  " \n "  ..  string.format (" %s%s%s" left , padding , right ))
151-   add (" " 
152-   for  i , v  in  ipairs (links ) do 
153-     add (i  ..  " . *"  ..  v [1 ] ..  " *"  ..  " : "  ..  v [2 ])
144+   if  # links  >  0  then 
145+     local  left  =  header_count  ..  " . Links" 
146+     local  right  =  " links" 
147+     local  right_link  =  string.format (" |%s-%s|" stringify (meta .project ), right )
148+     right  =  string.format (" *%s-%s*" stringify (meta .project ), right )
149+     local  padding  =  string.rep ("  " 78  -  # left  -  # right )
150+     table.insert (toc , { 1 , left , right_link  })
151+     add (string.rep (" =" 78 ) ..  " \n "  ..  string.format (" %s%s%s" left , padding , right ))
152+     add (" " 
153+     for  i , v  in  ipairs (links ) do 
154+       add (i  ..  " . *"  ..  v [1 ] ..  " *"  ..  " : "  ..  v [2 ])
155+     end 
154156  end 
157+   add (" Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>" 
155158  add (" " 
156159  add (" vim:tw=78:ts=8:noet:ft=help:norl:" 
157160  return  table.concat (buffer , " \n " ..  " \n " 
0 commit comments