没有生成输出以通过sphinx在fortran代码上生成自动文档

时间:2015-01-15 13:18:43

标签: fortran python-sphinx documentation-generation autodoc

我们希望使用autodoc工具Sphinx来制作fortran程序的文档。 通过使用由vacumm "vacumm.sphinxext.fortran_domain""vacumm.sphinxext.fortran_autodoc"开发的两个扩展,我们应该能够解析Sphinx的fortran代码。

我们可以成功运行make html来生成html文档文件,但输出为空。我的意思是,似乎fortran程序尚未被解析和记录,但没有错误。

我的程序树是这样的:

├── doc
│   ├── _build
│   ├── conf.py
│   ├── index.rst
│   ├── make.bat
│   ├── Makefile
│   ├── _static
│   └── _templates
└── project
    └── caf10.f

conf.py包括:

sys.path.insert(0, os.path.abspath("../project/caf10.f"))

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'vacumm.sphinxext.fortran_domain',
    'vacumm.sphinxext.fortran_autodoc'
]

fortran_src = [
    '/home/Documents/fortran-sphinx/project/caf10.f'
]

index.rst包含:

Documentation for the Code
**************************

.. f:autoprogram:: caf10

Contents:

.. toctree::
:maxdepth: 2 

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

Fortran程序类似于:

C Handling system components

      PROGRAM caf10
      IMPLICIT NONE

      INTEGER NOERR, NSCOM, I
      CHARACTER FNAME*12, SCNAME*24

C Initialise program 
      CALL TQINI(NOERR)

      FNAME = 'cosi.dat'

C Open cosi.dat (system C-O-Si)
C for reading
      CALL TQOPNA(FNAME, 10, NOERR)

C Read data-file 
      CALL TQRFIL(NOERR)

C Close data-file 
      CALL TQCLOS(10, NOERR)


C Print the names of all system components
      WRITE(*,FMT='(A)') 'Names of system components:'

      DO I=1, NSCOM
         CALL TQGNSC(I, SCNAME, NOERR)
         WRITE(*,FMT='(I2,A)') I, ': ' // SCNAME
      ENDDO

      END

我们在这些fortran程序中没有模块或函数定义。我们想要突出显示代码和注释,使用交叉引用,并将每种方法的输出打印到文档中。

生成的文档的输出只是程序名称,文档中不包含任何其他内容:

program caf10

通过运行make html,它不会记录错误:

$ make html    

sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.2.3
loading pickled environment... not yet created
loading intersphinx inventory from http://docs.python.org/objects.inv...
parsing fortran sources... done
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
test1ng sources... [100%] index                                                                                                                        

/home/masood/Documents/fortran-sphinx-2/doc/index.rst:4: WARNING: test2
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                         
writing additional files... genindex search
copying static files... done
copying extra files... done
dumping search index... done
dumping object inventory... done
build succeeded, 1 warning.

您是否知道如何制作解析程序的文档,突出显示的命令,包含的注释以及添加的交叉引用?

0 个答案:

没有答案