From 7bb95e5e7dffdc7e537cab7d65e239009a2558ba Mon Sep 17 00:00:00 2001 From: Steve Donovan Date: Thu, 22 Aug 2013 10:12:04 +0200 Subject: [PATCH] issue #78 default parm value now in documentation --- ldoc/doc.lua | 16 ++++++++++++++-- ldoc/html/ldoc_ltp.lua | 10 +++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 220f210..4038c4f 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -752,13 +752,25 @@ function build_arg_list (names,pmods) return '('..table.concat(buffer)..')' end -function Item:type_of_param(p) +function Item:param_modifiers (p) local mods = self.modifiers[self.parameter] if not mods then return '' end - local mparam = rawget(mods,p) + return rawget(mods,p) +end + +function Item:type_of_param(p) + local mparam = self:param_modifiers(p) return mparam and mparam.type or '' end +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 + function Item:type_of_ret(idx) local rparam = self.modifiers['return'][idx] return rparam and rparam.type or '' diff --git a/ldoc/html/ldoc_ltp.lua b/ldoc/html/ldoc_ltp.lua index 0943f3c..08e03d6 100644 --- a/ldoc/html/ldoc_ltp.lua +++ b/ldoc/html/ldoc_ltp.lua @@ -165,12 +165,16 @@ return [==[