dont_escape_underscore defaults to true if markdown.lua is not used; global_lookup defaults to true if parse_extra.C

This commit is contained in:
steve donovan 2014-06-22 17:14:08 +02:00
parent acc6ed2ad3
commit 9bd5dd0ec7
2 changed files with 22 additions and 10 deletions

View File

@ -1100,6 +1100,11 @@ function Module:process_see_reference (s,modules,istype)
else
lua_manual_ref = global.lua_manual_ref
end
-- pure C projects use global lookup (no namespaces)
if ldoc.global_lookup == nil then
local using_c = ldoc.parse_extra and ldoc.parse_extra.C
ldoc.global_lookup = using_c or false
end
-- is this a fully qualified module name?
local mod_ref = modules.by_name[s]

View File

@ -243,16 +243,19 @@ local formatters =
local function get_formatter(format)
local used_format = format
local formatter = (formatters[format] or generic_formatter)(format)
if formatter then return formatter end
for name, f in pairs(formatters) do
formatter = f(name)
if formatter then
print('format: '..format..' not found, using '..name)
return formatter
end
end
if not formatter then -- try another equivalent processor
for name, f in pairs(formatters) do
formatter = f(name)
if formatter then
print('format: '..format..' not found, using '..name)
used_format = name
break
end
end
end
return formatter, used_format
end
local function text_processor(ldoc)
@ -299,9 +302,13 @@ end
local function get_processor(ldoc, format)
if format == 'plain' then return text_processor(ldoc) end
local formatter = get_formatter(format)
local formatter,actual_format = get_formatter(format)
if formatter then
markup.plain = false
-- AFAIK only markdown.lua has underscore-in-identifier problem...
if ldoc.dont_escape_underscore ~= nil then
ldoc.dont_escape_underscore = actual_format ~= 'markdown'
end
return markdown_processor(ldoc, formatter)
end