1.1 --- a/EventAggregatorSupport/Formatting.py Tue Jan 14 14:51:01 2014 +0100
1.2 +++ b/EventAggregatorSupport/Formatting.py Tue Jan 14 16:37:38 2014 +0100
1.3 @@ -2,7 +2,7 @@
1.4 """
1.5 MoinMoin - EventAggregator event formatting
1.6
1.7 - @copyright: 2008, 2009, 2010, 2011, 2012, 2013 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2008, 2009, 2010, 2011, 2012, 2013, 2014 by Paul Boddie <paul@boddie.org.uk>
1.9 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
1.10 2005-2008 MoinMoin:ThomasWaldmann.
1.11 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.12 @@ -18,11 +18,15 @@
1.13
1.14 # Event-only formatting.
1.15
1.16 -def formatEvent(event, request, fmt, write=None):
1.17 +def formatEvent(event, request, fmt, write=None, parser_cls=None):
1.18
1.19 """
1.20 Format the given 'event' using the 'request' and formatter 'fmt'. If the
1.21 'write' parameter is specified, use it to write output.
1.22 +
1.23 + Where 'parser_cls' is specified, override the parser used to format text.
1.24 + This is essential when dealing with calendar format pages since the page
1.25 + parser will be unable to handle arbitrary fragments of text.
1.26 """
1.27
1.28 details = event.getDetails()
1.29 @@ -35,7 +39,7 @@
1.30 # Promote any title to a heading above the event details.
1.31
1.32 if raw_details.has_key("title"):
1.33 - write(formatText(raw_details["title"], request, fmt))
1.34 + write(formatText(raw_details["title"], request, fmt, parser_cls=parser_cls))
1.35 elif details.has_key("title"):
1.36 write(fmt.heading(on=1, depth=1))
1.37 write(fmt.text(details["title"]))
1.38 @@ -61,13 +65,13 @@
1.39 # Try and use the raw details, if available.
1.40
1.41 if raw_value:
1.42 - write(formatText(raw_value, request, fmt))
1.43 + write(formatText(raw_value, request, fmt, parser_cls=parser_cls))
1.44
1.45 # Otherwise, format the processed details.
1.46
1.47 else:
1.48 if term in event.list_terms:
1.49 - write(", ".join([formatText(unicode(v), request, fmt) for v in value]))
1.50 + write(", ".join([formatText(unicode(v), request, fmt, parser_cls=parser_cls) for v in value]))
1.51 else:
1.52 write(fmt.text(unicode(value)))
1.53