Issue #96: was expecting a space after ## in markdown documents; better support for C types

This commit is contained in:
Steve Donovan 2013-09-27 15:37:46 +02:00
parent 7a7865f300
commit 7e2e6e975c
4 changed files with 21 additions and 22 deletions

View File

@ -1019,6 +1019,7 @@ local function reference (s, mod_ref, item_ref)
end end
function Module:process_see_reference (s,modules,istype) function Module:process_see_reference (s,modules,istype)
if s == nil then return nil end
local mod_ref,fun_ref,name,packmod local mod_ref,fun_ref,name,packmod
local ref = custom_see_references(s) local ref = custom_see_references(s)
if ref then return ref end if ref then return ref end

View File

@ -190,7 +190,6 @@ function html.generate_output(ldoc, args, project)
local types = {} local types = {}
for name in tp:gmatch("[^|]+") do for name in tp:gmatch("[^|]+") do
--local sym, rest = name:match('(%S+)%s*([%*%&])')
local sym = name:match '([%w%.%:]+)' local sym = name:match '([%w%.%:]+)'
local ref,err = markup.process_reference(sym,true) local ref,err = markup.process_reference(sym,true)
if ref then if ref then

View File

@ -285,28 +285,26 @@ function CC:item_follows (t,v,tok)
if v == self.extra.export then -- this is not part of the return type! if v == self.extra.export then -- this is not part of the return type!
t,v = tnext(tok) t,v = tnext(tok)
end end
-- TBD collecting types which are not single tokens (may contain '*') -- types may have multiple tokens: example, const char *bonzo(...)
local return_type = v local return_type, name = v
t,v = tnext(tok) t,v = tnext(tok)
if t == 'iden' or t=='keyword' then name = v
local name = v t,v = tnext(tok)
while t ~= '(' do
return_type = return_type .. ' ' .. name
name = v
t,v = tnext(tok) t,v = tnext(tok)
if t ~= '(' then end
return_type = return_type .. ' ' .. name --print ('got',name,t,v,return_type)
name = v return function(tags,tok)
t,v = tnext(tok) if not tags.name then
tags:add('name',name)
end end
--print ('got',name,t,v,return_type) tags:add('class','function')
return function(tags,tok) if t == '(' then
if not tags.name then tags.formal_args,t,v = tools.get_parameters(tok,')',',',self)
tags:add('name',name) if return_type ~= 'void' then
end tags.formal_args.return_type = return_type
tags:add('class','function')
if t == '(' then
tags.formal_args,t,v = tools.get_parameters(tok,')',',',self)
if return_type ~= 'void' then
tags.formal_args.return_type = return_type
end
end end
end end
end end

View File

@ -57,7 +57,7 @@ end
-- they can appear in the contents list as a ToC. -- they can appear in the contents list as a ToC.
function markup.add_sections(F, txt) function markup.add_sections(F, txt)
local sections, L, first = {}, 1, true local sections, L, first = {}, 1, true
local title_pat_end, title_pat = '[^#]%s*(.+)' local title_pat
for line in stringx.lines(txt) do for line in stringx.lines(txt) do
if first then if first then
local level,header = line:match '^(#+)%s*(.+)' local level,header = line:match '^(#+)%s*(.+)'
@ -66,7 +66,8 @@ function markup.add_sections(F, txt)
else else
level = '##' level = '##'
end end
title_pat = '^'..level..title_pat_end title_pat = '^'..level..'([^#]%s*.+)'
title_pat = stringx.lstrip(title_pat)
first = false first = false
end end
local title = line:match (title_pat) local title = line:match (title_pat)