accept examples written in any language supported by LDoc
This commit is contained in:
parent
194a1a2fbe
commit
7b496aa05b
22
ldoc.lua
22
ldoc.lua
|
@ -108,6 +108,7 @@ local file_types = {
|
||||||
['.ldoc'] = lua,
|
['.ldoc'] = lua,
|
||||||
['.luadoc'] = lua,
|
['.luadoc'] = lua,
|
||||||
['.c'] = cc,
|
['.c'] = cc,
|
||||||
|
['.h'] = cc,
|
||||||
['.cpp'] = cc,
|
['.cpp'] = cc,
|
||||||
['.cxx'] = cc,
|
['.cxx'] = cc,
|
||||||
['.C'] = cc,
|
['.C'] = cc,
|
||||||
|
@ -231,6 +232,7 @@ local ldoc_contents = {
|
||||||
'no_return_or_parms','no_summary','full_description','backtick_references', 'custom_see_handler',
|
'no_return_or_parms','no_summary','full_description','backtick_references', 'custom_see_handler',
|
||||||
'no_space_before_args','parse_extra','no_lua_ref','sort_modules','use_markdown_titles',
|
'no_space_before_args','parse_extra','no_lua_ref','sort_modules','use_markdown_titles',
|
||||||
'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references',
|
'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references',
|
||||||
|
'dont_escape_underscore','global_lookup',
|
||||||
}
|
}
|
||||||
ldoc_contents = tablex.makeset(ldoc_contents)
|
ldoc_contents = tablex.makeset(ldoc_contents)
|
||||||
|
|
||||||
|
@ -530,14 +532,18 @@ end
|
||||||
if type(ldoc.examples) == 'table' then
|
if type(ldoc.examples) == 'table' then
|
||||||
local prettify = require 'ldoc.prettify'
|
local prettify = require 'ldoc.prettify'
|
||||||
|
|
||||||
process_file_list (ldoc.examples, '*.lua', function(f)
|
process_file_list (ldoc.examples, '*.*', function(f)
|
||||||
local item = add_special_project_entity(f,{
|
local ext = path.extension(f)
|
||||||
class = 'example',
|
local ftype = file_types[ext]
|
||||||
})
|
if ftype then
|
||||||
-- wrap prettify for this example so it knows which file to blame
|
local item = add_special_project_entity(f,{
|
||||||
-- if there's a problem
|
class = 'example',
|
||||||
local ext = path.extension(f):sub(2)
|
})
|
||||||
item.postprocess = function(code) return prettify.lua(ext,f,code,0,true) end
|
-- wrap prettify for this example so it knows which file to blame
|
||||||
|
-- if there's a problem
|
||||||
|
local lang = ext:sub(2)
|
||||||
|
item.postprocess = function(code) return prettify.lua(lang,f,code,0,true) end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue