Ticket #3263: wiki_timeline_event_diff_link-r3412.patch
| File wiki_timeline_event_diff_link-r3412.patch, 2.3 KB (added by cboos, 6 years ago) |
|---|
-
trac/wiki/web_ui.py
28 28 from trac.util import get_reporter_id 29 29 from trac.util.datefmt import format_datetime, pretty_timedelta 30 30 from trac.util.text import shorten_line 31 from trac.util.markup import html, Markup 31 from trac.util.markup import html, Markup, Fragment 32 32 from trac.versioncontrol.diff import get_diff_options, hdf_diff 33 33 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 34 34 from trac.web import HTTPNotFound, IRequestHandler … … 148 148 href = format == 'rss' and req.abs_href or req.href 149 149 db = self.env.get_db_cnx() 150 150 cursor = db.cursor() 151 cursor.execute("SELECT time,name,comment,author "151 cursor.execute("SELECT time,name,comment,author,version " 152 152 "FROM wiki WHERE time>=%s AND time<=%s", 153 153 (start, stop)) 154 for t,name,comment,author in cursor:154 for t,name,comment,author,version in cursor: 155 155 title = Markup('<em>%s</em> edited by %s', 156 156 wiki.format_page_name(name), author) 157 157 if format == 'rss': … … 160 160 else: 161 161 comment = wiki_to_oneliner(comment, self.env, db, 162 162 shorten=True) 163 if version > 1: 164 diff_link = html.A('diff', href=href.wiki( 165 name, action='diff', version=version, 166 old_version=version-1)) 167 comment = Fragment(comment, ' (', diff_link, ')') 163 168 yield 'wiki', href.wiki(name), title, t, author, comment 164 169 165 170 # Attachments -
trac/util/markup.py
278 278 class Fragment(object): 279 279 __slots__ = ['children'] 280 280 281 def __init__(self ):281 def __init__(self, *args): 282 282 self.children = [] 283 for arg in args: 284 self.append(arg) 283 285 284 286 def append(self, node): 285 287 """Append an element or string as child node."""
