Changeset 988


Ignore:
Timestamp:
Jul 2, 2012 12:10:31 PM (11 years ago)
Author:
jemian
Message:

refs #8, add variables to the index in two ways, add mac declarations to index in two ways

Location:
specdomain/trunk/src/specdomain
Files:
3 edited

Legend:

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

    r987 r988  
    134134        self.add_line(u'', '<autodoc>')
    135135        self.add_line(u'.. index:: SPEC macro file; %s' % macrofile, '<autodoc>')
     136        self.add_line(u'.. index:: !%s' % os.path.split(macrofile)[1], '<autodoc>')
    136137        self.add_line(u'', '<autodoc>')
    137138        line = 'source code:  :download:`%s <%s>`' % (macrofile, macrofile)
     
    204205
    205206    def handle_signature(self, sig, signode):
     207        '''return the name of this object from its signature'''
    206208        # Must be able to match these (without preceding def or rdef)
    207209        #     def macro_name
     
    240242    # TODO: array variables are not handled at all
    241243    # TODO: variables cited by *role* should link back to their *directive* declarations
    242     #       probably need to override handle_signature(), add_target_and_index(), and _get_index_text()
     244    #       probably need to override handle_signature() and add_target_and_index()
     245
     246    def handle_signature(self, sig, signode):
     247        '''return the name of this object from its signature'''
     248        # TODO: Should it match a regular expression?
     249        # TODO: What if global or local? 
     250        return sig
     251
     252    def add_target_and_index(self, name, sig, signode):
     253        targetname = '%s-%s' % (self.objtype, name)
     254        signode['ids'].append(targetname)
     255        # TODO: index entry here is at line before directive, now must get it right
     256        # TODO: role does not point back to it yet
     257        # http://sphinx.pocoo.org/markup/misc.html#directive-index
     258        text = u'! ' + sig      # TODO: How to use emphasized index entry in this context?
     259        text = sig              # FIXME: temporary override
     260        self.indexnode['entries'].append(('single', text, targetname, ''))
     261        text = u'SPEC %s variable; %s' % (self.objtype, sig)
     262        self.indexnode['entries'].append(('single', text, targetname, ''))
    243263
    244264class SpecXRefRole(XRefRole):
  • specdomain/trunk/src/specdomain/test/index.rst

    r963 r988  
    1414   test_doc
    1515
     16Example Python Source code documentation
     17=============================================
     18
     19.. toctree::
     20   :maxdepth: 2
     21
     22   python-example-source
     23
    1624Indices and tables
    1725==================
  • specdomain/trunk/src/specdomain/test/test_doc.rst

    r983 r988  
    144144
    145145   *.mac
    146    python-example-source
Note: See TracChangeset for help on using the changeset viewer.