From 8ad081317e9276a8d6e555afaf8c97def0e77906 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Mon, 19 Sep 2011 14:42:54 +0200 Subject: [PATCH] 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 --- builtin/globals.lua | 25 ++++++++++++++----------- ldoc.lua | 6 +++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/builtin/globals.lua b/builtin/globals.lua index 29597c4..7ccdf0e 100644 --- a/builtin/globals.lua +++ b/builtin/globals.lua @@ -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 diff --git a/ldoc.lua b/ldoc.lua index acd9fe7..f9bb7ac 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -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)