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

View File

@ -121,10 +121,14 @@ function ldoc.new_type (tag,header,project_level)
end
end
function ldoc.manual_url (url)
global.set_manual_url(url)
end
local ldoc_contents = {
'alias','add_language_extension','new_type','add_section',
'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)