Changeset 992
- Timestamp:
- Jul 6, 2012 11:21:20 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
specdomain/trunk/src/specdomain/sphinxcontrib/specmacrofileparser.py
r991 r992 420 420 declarations.append(r) 421 421 422 s += self._report_table('Variable Declarations', declarations)423 s += self._report_table('Macro Declarations', macros, ('start_line', 'name', 'line',))424 s += self._report_table('Function Macro Declarations', functions)422 s += _report_table('Variable Declarations', declarations) 423 s += _report_table('Macro Declarations', macros, ('start_line', 'name', 'line',)) 424 s += _report_table('Function Macro Declarations', functions) 425 425 426 426 return '\n'.join(s) 427 428 def _report_table(self, title, itemlist, col_keys = ('start_line', 'line',)): 429 """ return the itemlist as a reST table """ 430 if len(itemlist) == 0: 431 return [] 432 rows = [] 433 last_line = None 434 for d in itemlist: 435 if d['start_line'] != last_line: 436 rows.append( tuple([str(d[key]).strip() for key in col_keys]) ) 437 last_line = d['start_line'] 438 return _make_table(title, col_keys, rows, '=') 427 428 429 def _report_table(self, title, itemlist, col_keys = ('start_line', 'line',)): 430 """ 431 return the itemlist as a reST table 432 433 :param str title: section heading above the table 434 :param {str,str} itemlist: database (keyed dictionary) to use for table 435 :param [str] col_keys: column labels (must be keys in the dictionary) 436 :returns [str]: the table (where each list item is a string of reST) 437 """ 438 if len(itemlist) == 0: 439 return [] 440 rows = [] 441 last_line = None 442 for d in itemlist: 443 if d['start_line'] != last_line: 444 rows.append( tuple([str(d[key]).strip() for key in col_keys]) ) 445 last_line = d['start_line'] 446 return _make_table(title, col_keys, rows, '=') 439 447 440 448
Note: See TracChangeset
for help on using the changeset viewer.