1

The following code is not parsed correctly by doxygen, the "Module Docstring" is not shown in the resulting documentation:

# -*- coding: utf-8 -*-
"""
Module Docstring
"""

If I delete the first line, it's parsed correctly. But I NEED to set up the encoding, as I use non-ASCII characters on my code. Did anyone have the same problem? I tried using doxypy, but it fails as well. Also tried many different changes in the config file.

So far, the best shot was to use the INPUT_FILTER parameter to some sort of script that strips that first line, maybe using "tail -n +3" as a filter. The problem resides that not every file needs that "coding: utf-8", so placing it in every file will be a pain. Any better ideas? Am I overlooking something?

3
  • Can you put the actual error message that you get in the question? As the documentation pointed to by Raymond Hettinger shows, UTF-8 is the default encoding for doxygen. Commented Apr 1, 2013 at 16:23
  • @RolandSmith I don't get any errors, just that the "Module Docstring" is not shown in the documentation generated. Commented Apr 1, 2013 at 16:30
  • It seems you have to add a special string to the module docstring. See answer below. Commented Apr 1, 2013 at 16:48

3 Answers 3

1

You can specify the input encoding configuration variable:

http://www.doxygen.nl/manual/config.html#cfg_input_encoding

The variable should be set to UTF-8 (all caps, hyphen required, no spaces) as specified at http://www.gnu.org/software/libiconv/

Hope this helps. Happy documenting :-)

Sign up to request clarification or add additional context in comments.

Comments

0

Looking at this link, it seems you have to put @package <packagename> in the module docstring for doxygen to do something with it.

And below on the same page you can see that doxygen actually prefers you use comments instead of docstring, because doxygen special commands are not supported in docstrings.

Edit:

To avoid confusing doxygen, put the @package comment on a separate line from the coding comment.

To get doxygen to put a package "in its proper location", you should have a look at grouping, especially modules.

4 Comments

Yup, I tried using @package <packagename>, but all the packages created were inserted in the same level of the root package, and I have quite a big structure here. And I tried Sphinx, but the configuration was quite hard at the beggining, doxygen had a really easy setup. But the easy is now becoming hard :)
I tried using the comments like described, but as the first line is also a comment, the rest of the block is ignored by the parser. Here's an example: # -- coding: utf-8 -- ## Module Docstring # Continuation of docstring
Try putting a blank line (or a docstring) between the comments.
This worked partially, with the problem of creating a package in the root instead of in it's proper location: # -*- coding: utf-8 -*- <blank line> ## @package <modulename> # Module Docstring
0

I faintly remember the solution being the swap in position of coding and docstring:

#!/usr/bin/env python3
"""
Module Docstring
"""
# -*- coding: utf-8 -*-

I cannot test this right now

1 Comment

Actually this is a more general problem as addressed in github.com/doxygen/doxygen/issues/9672and fixed in github.com/doxygen/doxygen/pull/9673

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.