issue #172 spurious space; still cleaning out tab infestation

This commit is contained in:
steve donovan 2014-10-13 19:38:11 +02:00
parent 31ee8f5cbc
commit 2639ddec9f
2 changed files with 13 additions and 14 deletions

View File

@ -58,7 +58,7 @@ local function resolve_inline_references (ldoc, txt, item, plain)
if name and do_escape then if name and do_escape then
name = name:gsub('_', '\\_') name = name:gsub('_', '\\_')
end end
return ('<a href="%s">%s</a> '):format(ldoc.href(ref),name) return ('<a href="%s">%s</a>'):format(ldoc.href(ref),name)
else else
return '<code>'..name..'</code>' return '<code>'..name..'</code>'
end end
@ -246,16 +246,16 @@ local function get_formatter(format)
local used_format = format local used_format = format
local formatter = (formatters[format] or generic_formatter)(format) local formatter = (formatters[format] or generic_formatter)(format)
if not formatter then -- try another equivalent processor if not formatter then -- try another equivalent processor
for name, f in pairs(formatters) do for name, f in pairs(formatters) do
formatter = f(name) formatter = f(name)
if formatter then if formatter then
print('format: '..format..' not found, using '..name) print('format: '..format..' not found, using '..name)
used_format = name used_format = name
break break
end end
end end
end end
return formatter, used_format return formatter, used_format
end end
local function text_processor(ldoc) local function text_processor(ldoc)
@ -368,5 +368,4 @@ function markup.create (ldoc, format, pretty)
return processor return processor
end end
return markup return markup

View File

@ -29,7 +29,7 @@ local cpp_lang = {c = true, cpp = true, cxx = true, h = true}
function prettify.lua (lang, fname, code, initial_lineno, pre, linenos) function prettify.lua (lang, fname, code, initial_lineno, pre, linenos)
local res, lexer, tokenizer = List(), require 'ldoc.lexer' local res, lexer, tokenizer = List(), require 'ldoc.lexer'
local tnext = lexer.skipws local tnext = lexer.skipws
local ik = 1 local ik = 1
if not cpp_lang[lang] then if not cpp_lang[lang] then
tokenizer = lexer.lua tokenizer = lexer.lua
else else
@ -52,7 +52,7 @@ function prettify.lua (lang, fname, code, initial_lineno, pre, linenos)
while t do while t do
val = escape(val) val = escape(val)
if linenos and tok:lineno() == linenos[ik] then if linenos and tok:lineno() == linenos[ik] then
res:append('<a id="'..linenos[ik]..'"></a>') res:append('<a id="'..linenos[ik]..'"></a>')
ik = ik + 1 ik = ik + 1
end end
if globals.functions[val] or globals.tables[val] then if globals.functions[val] or globals.tables[val] then