diff --git a/ldoc.lua b/ldoc.lua index 769573d..2f2df9a 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -233,7 +233,7 @@ local ldoc_contents = { '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', 'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references', - 'dont_escape_underscore','global_lookup','prettify_files' + 'dont_escape_underscore','global_lookup','prettify_files','convert_opt' } ldoc_contents = tablex.makeset(ldoc_contents) diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 3b48d24..a72470d 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -382,7 +382,7 @@ function File:finish() item.section = item.type end elseif item.tags.within then -- ad-hoc section... - item.section = item.tags.within + item.section = item.tags.within else -- otherwise, just goes into the default sections (Functions,Tables,etc) item.section = item.type; end @@ -807,8 +807,9 @@ function build_arg_list (names,pmods) -- with @param[opt] b local buffer, npending = { }, 0 local function acc(x) table.insert(buffer, x) end - -- a number of trailing [opt]s can be safely converted to [opt],[optchain],... - if pmods then + -- a number of trailing [opt]s will be usually converted to [opt],[optchain],... + -- *unless* a person uses convert_opt. + if pmods and not doc.ldoc.convert_opt then local m = pmods[#names] if m and m.opt then m.optchain = m.opt @@ -855,11 +856,11 @@ function Item:type_of_param(p) return mparam and mparam.type or '' end +-- default value for param; if optional but no default, it's just `true`. function Item:default_of_param(p) local m = self:param_modifiers(p) if not m then return nil end local opt = m.optchain or m.opt - if opt == true then return nil end return opt end diff --git a/ldoc/html/ldoc_ltp.lua b/ldoc/html/ldoc_ltp.lua index 92a39bd..b424ef3 100644 --- a/ldoc/html/ldoc_ltp.lua +++ b/ldoc/html/ldoc_ltp.lua @@ -186,7 +186,9 @@ return [==[ $(tp) # end $(M(item.params.map[p],item)) -# if def then +# if def == true then + (optional) +# elseif def then (default $(def)) # end # if item:readonly(p) then