VACUMM / sphinx-fortran

Fortran domain and autodoc extensions to Sphinx
Other
45 stars 29 forks source link

In-line comments not working #3

Open nravicha opened 8 years ago

nravicha commented 8 years ago

Hi everyone,

I am trying to use sphinx-fortran to autodoc my fortran code. I am able to get it autodoc comments under programs, modules, functions, subroutines and types but I am unable to get the in-line comments for variables into the documentation. For eg.,

integer, parameter :: dp=kind(1.0d0) ! real*8 type

doesn't produce the comment "real*8 type" under the variable "dp" in the documentation. Am I doing something wrong? Or is this a bug with sphinx-fortran extension?

Thanks, -Navaneeth

tgastine commented 8 years ago

Hi,

This is indeed an issue I also found. It works fine as long as there's no digit in the declaration of the parameter. I suppose it should be easy to fix the regexp...

Thomas

mwilmer commented 8 years ago

Hey,

I did some runs on the regexp used to grab the comment and on your line. The "." used in the kind declaration seems to be causing the problem. Adding it to the regexp should solve the problem. I used the following:

r'[\W\(\),\b\*=\-\&]*?:?:[ \t\&]*(?P<varname>%s)\b[\w\s\(\)\*,_=\.]*!\s*(?P<vardesc>.*)'%'|'.join(block['sortvars'])

the addition of the "." in the []-block makes your declaration valid.