>
> Hello, I am also trying to generate auto documents by Sphinx on fortran 
> codes. I could add fortran extensions to Sphinx and successfully run $ make 
> html. But the output is only the program name in document.


 I have used f:autoprogram directive in index.rst. Further details are in 
the following:

My program tree is like this:

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

    └── caf10.f 

conf.py includes:

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 contains:

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

.. f:autoprogram:: caf10

Contents:

.. toctree::
:maxdepth: 2 

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

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

Fortran program is something like:

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

I don't have module or function definition in these fortran programs. I 
want to highlight the codes and comments, use cross references, and print 
the output of each method into the documentation.

The output of generated document is just the program name, and nothing else 
is included in the documentation:

program caf10

By running make html, it logs no error:

$ 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.


Do you have any idea how can I make a document which parsed the program, 
highlighted commands, included comments, and added cross references?

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to