1 # -*- coding: iso-8859-1 -*- 2 """ 3 MoinMoin - table (ImprovedTableParser) 4 5 @copyright: 2012 by Paul Boddie <paul@boddie.org.uk> 6 @license: GNU GPL (v2 or later), see COPYING.txt for details. 7 """ 8 9 from ImprovedTableParser import * 10 11 Dependencies = ["pages"] 12 13 # Parser support. 14 15 class Parser: 16 17 "Support a more flexible table syntax." 18 19 Dependencies = Dependencies 20 extensions = [] 21 22 def __init__(self, raw, request, **kw): 23 24 """ 25 Initialise the parser with the given 'raw' data, 'request' and any 26 keyword arguments that may have been supplied. 27 """ 28 29 self.raw = raw 30 self.request = request 31 self.attrs = parseAttributes(kw.get("format_args", ""), False) 32 33 def format(self, fmt): 34 35 "Format a table using the given formatter 'fmt'." 36 37 request = self.request 38 page = request.page 39 _ = request.getText 40 41 formatTable(self.raw, request, fmt, self.attrs) 42 43 # vim: tabstop=4 expandtab shiftwidth=4