Skip to content

Commit

Permalink
Add doxygen format support (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipNelson5 authored Apr 1, 2024
1 parent f7bc9f4 commit 9c6ed72
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Added doxygen format support ([#120](https://github.com/NilsJPWerner/autoDocstring/issues/120)) (@daluar @PhilipNelson5)

[All Changes](https://github.com/NilsJPWerner/autoDocstring/compare/v0.6.1...master)

## [0.6.1](https://github.com/NilsJPWerner/autoDocstring/tree/v0.6.1) - 2022-02-15
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ Visual Studio Code extension to quickly generate docstrings for python functions

To turn off type generation in docstrings use the `-notypes` template of the desired format. The docBlockr format is a typed version of PEP0257.

- [docBlockr](docs/docblockr.md)
- [doxygen](docs/doxygen.md)
- [google](docs/google.md)
- [sphinx](docs/sphinx.md)
- [numpy](docs/numpy.md)
- [docBlockr](docs/docblockr.md)
- [one-line-sphinx](docs/one-line-sphinx.md)
- [pep257](docs/pep257.md)
- [sphinx](docs/sphinx.md)

## Usage

Expand Down
19 changes: 19 additions & 0 deletions docs/doxygen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Doxygen Docstring Format

```python
def abc(a: int, c = [1,2]):
"""!
@brief _summary_
@param a (int): _description_
@param c (list, optional): _description_. Defaults to [1,2].
@return (_type_): _description_
@exception AssertionError: _description_
"""
if a > 10:
raise AssertionError("a is more than 10")

return c
```
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
"keywords": [
"python",
"docstring",
"google",
"numpy",
"sphinx",
"generator",
"autodocstring",
"docblockr",
"documentation",
"pydocstring"
"pydocstring",
"docblockr",
"doxygen",
"google",
"numpy",
"sphinx"
],
"galleryBanner": {},
"engines": {
Expand Down Expand Up @@ -75,14 +76,16 @@
"default": "google",
"enum": [
"docblockr",
"pep257",
"doxygen",
"doxygen-notypes",
"google",
"google-notypes",
"sphinx",
"sphinx-notypes",
"numpy",
"numpy-notypes",
"one-line-sphinx"
"one-line-sphinx",
"pep257",
"sphinx",
"sphinx-notypes"
],
"description": "Which docstring format to use."
},
Expand Down
32 changes: 32 additions & 0 deletions src/docstring/templates/doxygen-notypes.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{! Doxygen Docstring Template }}
!
@brief {{summaryPlaceholder}}

{{extendedSummaryPlaceholder}}
{{#parametersExist}}

{{#args}}
@param {{var}}: {{descriptionPlaceholder}}
{{/args}}
{{#kwargs}}
@param {{var}}: {{descriptionPlaceholder}}. Defaults to {{&default}}.
{{/kwargs}}
{{/parametersExist}}
{{#returnsExist}}

{{#returns}}
@return: {{descriptionPlaceholder}}
{{/returns}}
{{/returnsExist}}
{{#exceptionsExist}}

{{#exceptions}}
@exception: {{descriptionPlaceholder}}
{{/exceptions}}
{{/exceptionsExist}}
{{#yieldsExist}}

{{#yields}}
@returns: {{descriptionPlaceholder}}
{{/yields}}
{{/yieldsExist}}
32 changes: 32 additions & 0 deletions src/docstring/templates/doxygen.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{! Doxygen Docstring Template }}
!
@brief {{summaryPlaceholder}}

{{extendedSummaryPlaceholder}}
{{#parametersExist}}

{{#args}}
@param {{var}} ({{typePlaceholder}}): {{descriptionPlaceholder}}
{{/args}}
{{#kwargs}}
@param {{var}} ({{typePlaceholder}}, optional): {{descriptionPlaceholder}}. Defaults to {{&default}}.
{{/kwargs}}
{{/parametersExist}}
{{#returnsExist}}

{{#returns}}
@return ({{typePlaceholder}}): {{descriptionPlaceholder}}
{{/returns}}
{{/returnsExist}}
{{#exceptionsExist}}

{{#exceptions}}
@exception {{type}}: {{descriptionPlaceholder}}
{{/exceptions}}
{{/exceptionsExist}}
{{#yieldsExist}}

{{#yields}}
@returns {{typePlaceholder}}: {{descriptionPlaceholder}}
{{/yields}}
{{/yieldsExist}}

0 comments on commit 9c6ed72

Please sign in to comment.