lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2013/11/14 steve donovan <steve.j.donovan@gmail.com>:
> On Thu, Nov 14, 2013 at 9:58 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> ….$ ldoc ml.lua
>> reading configuration from /home/dirk/lua/Microlight/config.ld
>> format: using built-in markdown
>> format: using built-in markdown
>> format: markdown not found, falling back to text
>> output written to /home/dirk/lua/Microlight/doc
>
> That's weird - it should just fallback to the copy of markdown.lua
> that is included.

It isn't.

…/ldoc$ ls -r *
tools.lua     parse.lua   lexer.lua  html.lua
prettify.lua  markup.lua  lang.lua   doc.lua

html:
ldoc_one_css.lua  ldoc_ltp.lua  ldoc_css.lua

builtin:
table.lua   package.lua  math.lua  lfs.lua  globals.lua  debug.lua
string.lua  os.lua       lpeg.lua  io.lua   global.lua   coroutine.lua

It is in the zipfile that Luarocks receives, but it does not reach
the ldoc directory. So I copied it over manually. It does not load,
for precisely the same reason that the markdown rock (which seems
to be 99% the same code) does not load: there are a couple of stray
setfenv's in it. I replaced them by the usual workaround and now
have a working copy of ldoc 1.4.0-1.

> Let me track this one down...

Just apply the workaround to the copy on your repository.
Instead of `setfenv(1, M)` put:

if _VERSION:match"^Lua 5.2" then _ENV=M
elseif  _VERSION:match"^Lua 5.1" then setfenv(1, M)
else error ("This program does not work with ".._VERSION)
end

and similarly later for `setfenv(1, _G)`