1.1 --- a/EventAggregatorSupport.py Sun Nov 18 21:16:00 2012 +0100
1.2 +++ b/EventAggregatorSupport.py Thu Nov 22 23:04:30 2012 +0100
1.3 @@ -141,6 +141,9 @@
1.4 Parse events in the given 'text', returning a list of event objects for the
1.5 given 'event_page'. An optional 'fragment' can be specified to indicate a
1.6 specific region of the event page.
1.7 +
1.8 + If the optional 'fragment' identifier is provided, the first heading may
1.9 + also be used to provide an event summary/title.
1.10 """
1.11
1.12 template_details = {}
1.13 @@ -150,6 +153,17 @@
1.14 details = {}
1.15 details.update(template_details)
1.16 raw_details = {}
1.17 +
1.18 + # Obtain a heading, if requested.
1.19 +
1.20 + if fragment:
1.21 + for level, title, (start, end) in getHeadings(text):
1.22 + raw_details["title"] = text[start:end]
1.23 + details["title"] = getSimpleWikiText(title.strip())
1.24 + break
1.25 +
1.26 + # Start populating events.
1.27 +
1.28 events = [Event(event_page, details, raw_details)]
1.29
1.30 for match in definition_list_regexp.finditer(text):
1.31 @@ -3266,9 +3280,22 @@
1.32 if details.has_key("fragment"):
1.33 write(fmt.anchordef(details["fragment"]))
1.34
1.35 + # Promote any title to a heading above the event details.
1.36 +
1.37 + if raw_details.has_key("title"):
1.38 + write(formatText(raw_details["title"], request, fmt))
1.39 + elif details.has_key("title"):
1.40 + write(fmt.heading(on=1, depth=1))
1.41 + write(fmt.text(details["title"]))
1.42 + write(fmt.heading(on=0, depth=1))
1.43 +
1.44 + # Produce a definition list for the rest of the details.
1.45 +
1.46 write(fmt.definition_list(on=1))
1.47
1.48 for term in event.all_terms:
1.49 + if term == "title":
1.50 + continue
1.51
1.52 raw_value = raw_details.get(term)
1.53 value = details.get(term)