creating an alias for a tparam TYPE tags

This commit is contained in:
steve donovan 2012-03-04 18:57:17 +02:00
parent 3ed4e1f942
commit de7fef1c45
3 changed files with 32 additions and 1 deletions

View File

@ -123,6 +123,11 @@ ldoc.alias('tparam',{'param',modifiers={type="$1"}})
ldoc.alias('treturn',{'return',modifiers={type="$1"}})
ldoc.alias('tfield',{'field',modifiers={type="$1"}})
function ldoc.tparam_alias (name,type)
type = type or name
ldoc.alias(name,{'param',modifiers={type=type}})
end
function ldoc.add_language_extension(ext,lang)
lang = (lang=='c' and cc) or (lang=='lua' and lua) or quit('unknown language')
if ext:sub(1,1) ~= '.' then ext = '.'..ext end
@ -148,7 +153,7 @@ function ldoc.manual_url (url)
end
local ldoc_contents = {
'alias','add_language_extension','new_type','add_section',
'alias','add_language_extension','new_type','add_section', 'tparam_alias',
'file','project','title','package','format','output','dir','ext',
'one','style','template','description','examples','readme','all','manual_url',
'no_return_or_parms','no_summary','full_description'

4
tests/config.ld Normal file
View File

@ -0,0 +1,4 @@
format='markdown'
file = 'types.lua'
tparam_alias 'string'
tparam_alias ('int','number')

22
tests/types.lua Normal file
View File

@ -0,0 +1,22 @@
-----------------------
-- Module using tparam for typed parameters.
--
-- @module types
--- has typed parameters, `string` and `int`.
-- And never forget `E = m*c^2`.
--
-- A reference to `mydata`.
-- @string name
-- @int age
-- @treturn mydata result
function _M.first (name,age)
end
--- a table of this module.
-- @table mydata
_M.mydata = {
one = 1, -- alpha
two = 2, -- beta
}