Changeset 1065


Ignore:
Timestamp:
Aug 12, 2012 2:10:26 PM (10 years ago)
Author:
jemian
Message:

refs #13, show a bullet list at the top of the page (alternative to separate pages for each macro file)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • specdomain/trunk/src/specdomain/sphinxcontrib/specdomain.py

    r1012 r1065  
    195195#        self.add_line(u'', '<autodoc>')
    196196#        self.add_line(u'directory:\n   ``%s``' % specdir, '<autodoc>')
     197        macrofiles = []
    197198        if os.path.exists(specdir):
    198199            for f in sorted(os.listdir(specdir)):
     
    202203                    # TODO: support the option to include subdirectories (include_subdirs)
    203204                    # TODO: do not add the same SPEC macro file more than once
    204                     self.add_line(u'', '<autodoc>')
    205                     self.add_line(u'.. autospecmacro:: %s' % filename, '<autodoc>')
    206                     # TODO: any options?
    207                     self.add_line(u'', '<autodoc>')
    208                     # TODO: suppress delimiter after last file
    209                     self.add_line(u'-'*15, '<autodoc>')         # delimiter between files
     205                    macrofiles.append(filename)
    210206        else:
    211207            self.add_line(u'', '<autodoc>')
    212208            self.add_line(u'Could not find directory: ``%s``' % specdir, '<autodoc>')
    213 
     209        if len(macrofiles) > 0:
     210            self.add_line(u'', '<autodoc>')
     211            self.add_line(u'.. rubric:: List of SPEC Macro Files in *%s*' % specdir, '<autodoc>')
     212            for filename in macrofiles:
     213                self.add_line(u'* :ref:`%s <%s>`' % (filename, filename), '<autodoc>')
     214            self.add_line(u'-'*15, '<autodoc>')         # delimiter
     215            for filename in macrofiles:
     216                self.add_line(u'', '<autodoc>')
     217                self.add_line(u'.. _%s:' % filename, '<autodoc>')
     218                self.add_line(u'.. autospecmacro:: %s' % filename, '<autodoc>')
     219                # TODO: any options?
     220                self.add_line(u'', '<autodoc>')
     221                # TODO: suppress delimiter after last file
     222                self.add_line(u'-'*15, '<autodoc>')         # delimiter between files
    214223
    215224
Note: See TracChangeset for help on using the changeset viewer.