feat(py) Add reST annotation support (#46)
This commit is contained in:
@@ -188,7 +188,7 @@ require('neogen').setup {
|
||||
There is a list of supported languages and fields, with their annotation style
|
||||
|
||||
| Languages | Annotation Conventions | Supported annotation types |
|
||||
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
||||
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
||||
| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file` |
|
||||
| csharp | [Xmldoc](https://docs.microsoft.com/fr-fr/dotnet/csharp/language-reference/xmldoc/) (`"xmldoc"`) <br> [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `class` |
|
||||
| cpp | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `class` |
|
||||
@@ -198,7 +198,7 @@ There is a list of supported languages and fields, with their annotation style
|
||||
| jsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||
| lua | [Emmylua](https://emmylua.github.io/) (`"emmylua"`)<br> [Ldoc](https://stevedonovan.github.io/ldoc/manual/doc.md.html) (`"ldoc"`) | `func`, `class`, `type`, `file` |
|
||||
| php | [Php-doc](https://docs.phpdoc.org/3.0/guide/references/phpdoc/index.html) (`"phpdoc"`) | `func`, `type`, `class` |
|
||||
| python | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`) <br> [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`) | `func`, `class`, `type`, `file` |
|
||||
| python | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`) <br> [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`) <br> [reST](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html) (`"reST"`) | `func`, `class`, `type`, `file` |
|
||||
| rust | [RustDoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) (`"rustdoc"`) <br> [Alternative](https://stackoverflow.com/questions/30009650/how-do-you-document-function-arguments) (`"alternative"`) | `func`, `file`, `class` |
|
||||
| typescript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||
| tsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||
|
||||
@@ -57,12 +57,14 @@ return {
|
||||
retrieve = "all",
|
||||
node_type = "true|false|integer|binary_operator|expression_list",
|
||||
as = "anonymous_return",
|
||||
recursive = true,
|
||||
extract = true,
|
||||
},
|
||||
{
|
||||
retrieve = "all",
|
||||
node_type = "identifier",
|
||||
as = "return_statement",
|
||||
recursive = true,
|
||||
extract = true,
|
||||
},
|
||||
},
|
||||
@@ -73,6 +75,7 @@ return {
|
||||
retrieve = "all",
|
||||
node_type = "type",
|
||||
as = "return_type",
|
||||
recursive = true,
|
||||
extract = true,
|
||||
},
|
||||
}
|
||||
@@ -270,5 +273,36 @@ return {
|
||||
},
|
||||
{ nil, '"""' },
|
||||
},
|
||||
reST = {
|
||||
{ nil, '""" $1 """', { no_results = true, type = { "class", "func" } } },
|
||||
{ nil, '"""$1', { no_results = true, type = { "file" } } },
|
||||
{ nil, "", { no_results = true, type = { "file" } } },
|
||||
{ nil, "$1", { no_results = true, type = { "file" } } },
|
||||
{ nil, '"""', { no_results = true, type = { "file" } } },
|
||||
{ nil, "", { no_results = true, type = { "file" } } },
|
||||
|
||||
{ nil, "# $1", { no_results = true, type = { "type" } } },
|
||||
|
||||
{ nil, '"""$1' },
|
||||
{ nil, "" },
|
||||
{
|
||||
"parameters",
|
||||
":param %s: $1",
|
||||
{ after_each = ":type %s: $1", type = { "func" } },
|
||||
},
|
||||
{
|
||||
{ "identifier", "type" },
|
||||
":param %s: $1",
|
||||
{
|
||||
after_each = { ":type %s: $1", index_types = { 2 } },
|
||||
required = "typed_parameters",
|
||||
type = { "func" },
|
||||
},
|
||||
},
|
||||
{ "attributes", ":param %s: $1" },
|
||||
{ "has_return", ":return: $1", { type = { "func" } } },
|
||||
{ "has_return", ":rtype: $1", { type = { "func" } } },
|
||||
{ nil, '"""' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user