feat(py) Add reST annotation support (#46)
This commit is contained in:
32
README.md
32
README.md
@@ -187,22 +187,22 @@ require('neogen').setup {
|
|||||||
|
|
||||||
There is a list of supported languages and fields, with their annotation style
|
There is a list of supported languages and fields, with their annotation style
|
||||||
|
|
||||||
| Languages | Annotation Conventions | Supported annotation types |
|
| Languages | Annotation Conventions | Supported annotation types |
|
||||||
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
||||||
| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file` |
|
| 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` |
|
| 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` |
|
| cpp | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `class` |
|
||||||
| go | [GoDoc](https://go.dev/blog/godoc) (`"godoc"`) | `func`, `type` |
|
| go | [GoDoc](https://go.dev/blog/godoc) (`"godoc"`) | `func`, `type` |
|
||||||
| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class` |
|
| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class` |
|
||||||
| javascript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
| javascript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||||
| jsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
| 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` |
|
| 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` |
|
| 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` |
|
| 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` |
|
| typescript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||||
| tsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
| tsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||||
| vue | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
| vue | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` |
|
||||||
|
|
||||||
## Adding Languages
|
## Adding Languages
|
||||||
|
|
||||||
|
|||||||
@@ -57,12 +57,14 @@ return {
|
|||||||
retrieve = "all",
|
retrieve = "all",
|
||||||
node_type = "true|false|integer|binary_operator|expression_list",
|
node_type = "true|false|integer|binary_operator|expression_list",
|
||||||
as = "anonymous_return",
|
as = "anonymous_return",
|
||||||
|
recursive = true,
|
||||||
extract = true,
|
extract = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
retrieve = "all",
|
retrieve = "all",
|
||||||
node_type = "identifier",
|
node_type = "identifier",
|
||||||
as = "return_statement",
|
as = "return_statement",
|
||||||
|
recursive = true,
|
||||||
extract = true,
|
extract = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -73,6 +75,7 @@ return {
|
|||||||
retrieve = "all",
|
retrieve = "all",
|
||||||
node_type = "type",
|
node_type = "type",
|
||||||
as = "return_type",
|
as = "return_type",
|
||||||
|
recursive = true,
|
||||||
extract = true,
|
extract = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -270,5 +273,36 @@ return {
|
|||||||
},
|
},
|
||||||
{ nil, '"""' },
|
{ 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