Add support for numpydoc
This commit is contained in:
@@ -113,10 +113,19 @@ return {
|
||||
use_default_comment = false, -- If you want to prefix the template with the default comment for the language, e.g for python: # (default_generator)
|
||||
google_docstrings = {
|
||||
{ nil, '"""' },
|
||||
{ "parameters", "\t%s: ", { before_first_item = "Args: " } },
|
||||
{ "attributes", "\t%s: ", { before_first_item = "Attributes: " } },
|
||||
{ "return_statement", "", { before_first_item = "Returns: " } },
|
||||
{ "parameters", "\t%s: ", { before_first_item = { "", "Args:" } } },
|
||||
{ "attributes", "\t%s: ", { before_first_item = { "", "Attributes: " } } },
|
||||
{ "return_statement", "", { before_first_item = { "", "Returns: " } } },
|
||||
{ nil, "" },
|
||||
{ nil, '"""' },
|
||||
},
|
||||
numpydoc = {
|
||||
{ nil, '"""' },
|
||||
{ "parameters", "%s: ", { before_first_item = { "", "Parameters", "----------" } } },
|
||||
{ "attributes", "%s: ", { before_first_item = { "", "Attributes", "----------" } } },
|
||||
{ "return_statement", "", { before_first_item = { "", "Returns", "-------" } } },
|
||||
{ nil, "" },
|
||||
{ nil, '"""' }
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ neogen.default_generator = function(parent, data, template)
|
||||
|
||||
-- Will append the item before all their nodes
|
||||
if opts.before_first_item and data[type] then
|
||||
table.insert(result, prefix .. opts.before_first_item)
|
||||
for _, value in pairs(opts.before_first_item) do
|
||||
table.insert(result, prefix .. value)
|
||||
end
|
||||
end
|
||||
|
||||
if not type then
|
||||
|
||||
Reference in New Issue
Block a user