Changeset 989
- Timestamp:
- Jul 2, 2012 3:13:44 PM (11 years ago)
- Location:
- specdomain/trunk/src/specdomain
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
specdomain/trunk/src/specdomain/sphinxcontrib/specdomain.py
r988 r989 190 190 indextext = self._get_index_text(name) 191 191 if indextext: 192 self.indexnode['entries'].append(('single', indextext, 193 192 self.indexnode['entries'].append(('single', indextext, targetname, '')) 193 self.indexnode['entries'].append(('single', sig, targetname, '')) 194 194 195 195 def _get_index_text(self, name): … … 242 242 # TODO: array variables are not handled at all 243 243 # TODO: variables cited by *role* should link back to their *directive* declarations 244 # probably need to override handle_signature() and add_target_and_index()245 244 246 245 def handle_signature(self, sig, signode): … … 248 247 # TODO: Should it match a regular expression? 249 248 # TODO: What if global or local? 249 signode += addnodes.desc_name(sig, sig) 250 250 return sig 251 251 … … 253 253 targetname = '%s-%s' % (self.objtype, name) 254 254 signode['ids'].append(targetname) 255 # TODO: index entry here is at line before directive, now must get it right256 255 # TODO: role does not point back to it yet 257 256 # http://sphinx.pocoo.org/markup/misc.html#directive-index -
specdomain/trunk/src/specdomain/sphinxcontrib/specmacrofileparser.py
r987 r989 49 49 Assume all extended comments contain ReST formatted comments, 50 50 *including initial section titles or transitions*. 51 The first and simplest thing to do is to read the .mac file and only extract52 all the extended comments and add them as nodes to the current document.53 51 54 52 Assume macro definitions are not nested (but test for this). 53 54 Assume macro files are small enough to load completely in memory. 55 55 56 56 An additional step would be to parse for: 57 * def 58 * cdef 59 * rdef 57 * def (done) 58 * cdef (done) 59 * rdef (done) 60 60 * global (done) 61 61 * local (done) … … 379 379 macros = [] # def, cdef, and rdef macros 380 380 functions = [] # def and rdef function macros 381 title = 'Extended Comments' 382 s = ['', title, '='*len(title), ] 381 #title = 'Extended Comments' 382 #s = ['', title, '='*len(title), ] 383 s = [] 383 384 for r in self.findings: 384 385 if r['objtype'] == 'extended comment': … … 390 391 s.append( '' ) 391 392 s.append(r['text']) 392 elif r['objtype'] in ('def', 'rdef', 'cdef' ):393 elif r['objtype'] in ('def', 'rdef', 'cdef', ): 393 394 macros.append(r) 395 s.append( '' ) 396 s.append( '.. %s %s %s %d %d' % (self.filename, 397 r['objtype'], 398 r['name'], 399 r['start_line'], 400 r['end_line']) ) 401 s.append( '' ) 402 s.append( '.. rubric:: %s macro declaration' % r['objtype'] ) 403 s.append( '' ) 404 #s.append( '.. spec:%s:: %s %s' % ( r['objtype'], r['name'], r['args'],) ) 405 s.append( '.. spec:%s:: %s' % ( r['objtype'], r['name'],) ) 394 406 elif r['objtype'] in ('function def', 'function rdef',): 407 # FIXME: not getting here, such as for kohzuE_cmd() 395 408 functions.append(r) 409 s.append( '' ) 410 s.append( '.. %s %s %s %d %d' % (self.filename, 411 r['objtype'], 412 r['name'], 413 r['start_line'], 414 r['end_line']) ) 415 s.append( '' ) 416 s.append( '.. rubric:: %s macro function declaration' % r['objtype'] ) 417 s.append( '' ) 418 s.append( '.. spec:%s:: %s(%s)' % ( r['objtype'], r['name'], r['args']) ) 396 419 elif r['objtype'] in ('local', 'global', 'constant'): 397 420 declarations.append(r) -
specdomain/trunk/src/specdomain/test/test_doc.rst
r988 r989 94 94 ``i`` is a local loop counter 95 95 96 constant declaration: 97 98 .. spec:local:: TWO_PI 99 100 ``TWO_PI`` is the ratio of a circle's circumference to its diameter. 101 96 102 array variable declaration: 97 103 … … 106 112 * local variable declaration: :spec:local:`i` 107 113 * array variable declaration: *--tba--* 108 * constant declaration: *--tba--*114 * constant declaration: :spec:constant:`TWO_PI` 109 115 110 116 … … 134 140 * local variable, such as: :spec:local:`i` 135 141 * array variable declaration: *--tba--* 136 * constant declaration: *--tba--*142 * constant declaration: :spec:constant:`TWO_PI` 137 143 138 144 Source code documentation
Note: See TracChangeset
for help on using the changeset viewer.