Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.macro.PageSize Namespace Reference

Functions

def macro_PageSize

Variables

list Dependencies = ["pages"]

Function Documentation

Definition at line 11 of file PageSize.py.

00011 
00012 def macro_PageSize(macro):
00013     if macro.request.isSpiderAgent: # reduce bot cpu usage
00014         return ''
00015 
00016     # get list of pages and their objects
00017     pages = macro.request.rootpage.getPageDict()
00018 
00019     # get sizes and sort them
00020     sizes = []
00021     for name, page in pages.items():
00022         sizes.append((page.size(), page))
00023     sizes.sort()
00024     sizes.reverse()
00025 
00026     # format list
00027     result = []
00028     result.append(macro.formatter.number_list(1))
00029     for size, page in sizes:
00030         result.append(macro.formatter.listitem(1))
00031         result.append(macro.formatter.code(1))
00032         result.append(("%6d" % size).replace(" ", " ") + " ")
00033         result.append(macro.formatter.code(0))
00034         result.append(macro.formatter.pagelink(1, page.page_name, generated=1))
00035         result.append(macro.formatter.text(page.page_name))
00036         result.append(macro.formatter.pagelink(0, page.page_name))
00037         result.append(macro.formatter.listitem(0))
00038     result.append(macro.formatter.number_list(0))
00039 
00040     return ''.join(result)
00041 

Variable Documentation

Definition at line 9 of file PageSize.py.