manual_url _function_ in config.ld can specify another location for the Lua manual file:///D:/dev/lua/projects/lua-5.1.4/doc/manual.html

This commit is contained in:
steve donovan 2011-09-19 14:42:54 +02:00
parent 1a2e61a1f9
commit 8ad081317e
2 changed files with 19 additions and 12 deletions

View File

@ -1,10 +1,10 @@
------- -------
-- global functions and tables -- global functions and tables
local tools = require 'ldoc.tools' local tools = require 'ldoc.tools'
local globals = {}
globals.functions = {
local functions = {
assert = true, assert = true,
collectgarbage = true, collectgarbage = true,
dofile = true, dofile = true,
@ -32,8 +32,9 @@ local functions = {
module = true, module = true,
require = true, require = true,
} }
local functions = globals.functions
local tables = { globals.tables = {
io = '5.7', io = '5.7',
package = '5.3', package = '5.3',
math = '5.6', math = '5.6',
@ -43,9 +44,15 @@ local tables = {
coroutine = '5.2', coroutine = '5.2',
debug = '5.9' debug = '5.9'
} }
local tables = globals.tables
local manual = 'http://www.lua.org/manual/5.1/manual.html#' local manual, fun_ref
local fun_ref = manual..'pdf-'
function globals.set_manual_url(url)
manual = url .. '#'
fun_ref = manual..'pdf-'
end
globals.set_manual_url 'http://www.lua.org/manual/5.1/manual.html'
local function function_ref (name) local function function_ref (name)
return {href = fun_ref..name, label = name} return {href = fun_ref..name, label = name}
@ -55,7 +62,7 @@ local function module_ref (name)
return {href = manual..tables[name], label = name} return {href = manual..tables[name], label = name}
end end
local function lua_manual_ref (name) function globals.lua_manual_ref (name)
local tbl,fname = tools.split_dotted_name(name) local tbl,fname = tools.split_dotted_name(name)
if not tbl then -- plain symbol if not tbl then -- plain symbol
if functions[name] then if functions[name] then
@ -72,8 +79,4 @@ local function lua_manual_ref (name)
return nil return nil
end end
return { return globals
functions = functions,
tables = tables,
lua_manual_ref = lua_manual_ref
}

View File

@ -121,10 +121,14 @@ function ldoc.new_type (tag,header,project_level)
end end
end end
function ldoc.manual_url (url)
global.set_manual_url(url)
end
local ldoc_contents = { local ldoc_contents = {
'alias','add_language_extension','new_type','add_section', 'alias','add_language_extension','new_type','add_section',
'file','project','title','package','format','output','dir','ext', 'file','project','title','package','format','output','dir','ext',
'one','style','template','description','examples','readme','all','extended_markdown' 'one','style','template','description','examples','readme','all','manual_url'
} }
ldoc_contents = tablex.makeset(ldoc_contents) ldoc_contents = tablex.makeset(ldoc_contents)