Synopsis - Cross-Reference
File: Synopsis/Formatters/HTML/XRefPager.py1# 2# Copyright (C) 2008 Stefan Seefeld 3# All rights reserved. 4# Licensed to the public under the terms of the GNU LGPL (>= 2), 5# see the file COPYING for details. 6# 7 8class XRefPager: 9 """Generates pages of cross-references.""" 10 11 def __init__(self, ir): 12 13 self.page_map = {} 14 self.page_info = [] 15 16 # Split the data into multiple files based on size 17 page = 0 18 count = 0 19 self.page_info.append([]) 20 names = ir.sxr.keys() 21 names.sort() 22 for name in names: 23 if count > 200: 24 count = 0 25 page += 1 26 self.page_info.append([]) 27 self.page_info[page].append(name) 28 self.page_map[name] = page 29 entry = ir.sxr[name] 30 d, c, r = len(entry.definitions), len(entry.calls), len(entry.references) 31 count += 1 + d + c + r 32 if d: count += 1 33 if c: count += 1 34 if r: count += 1 35 36 def get(self, name): 37 """Returns the number of the page that the xref info for the given 38 name is on, or None if not found.""" 39 40 return self.page_map.get(name) 41 42 def pages(self): 43 """Returns a list of pages, each consisting of a list of names on that 44 page. This method is intended to be used by whatever generates the 45 files...""" 46 47 return self.page_info 48
Generated on Tue May 13 02:39:28 2008 by
synopsis (version 0.10)
synopsis (version 0.10)