ChristianBoos: wiki2x_in_templates.diff
| File wiki2x_in_templates.diff, 55.5 KB (added by cboos, 5 years ago) |
|---|
-
trac/attachment.py
34 34 from trac.web import HTTPBadRequest, IRequestHandler 35 35 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 36 36 from trac.wiki.api import IWikiSyntaxProvider 37 from trac.wiki.formatter import wiki_to_html, wiki_to_oneliner38 37 39 38 40 39 class InvalidAttachment(TracError): … … 254 253 return fd 255 254 256 255 257 # Templating utilities258 259 def attachments_data(env, req, db, parent_type, parent_id):260 return [attachment_data(env, req, db, attachment) for attachment261 in Attachment.select(env, parent_type, parent_id, db)]262 263 def attachment_data(env, req, db, attachment):264 # FIXME: pretty close to the attachment itself... so pass directly265 # the attachment266 if not db:267 db = env.get_db_cnx()268 description = wiki_to_oneliner(attachment.description, env, db)269 return {270 'filename': attachment.filename,271 'description': Markup(description.strip()),272 'author': attachment.author,273 'ipnr': attachment.ipnr,274 'size': attachment.size,275 'date': attachment.time,276 'href': attachment.href(req)277 }278 279 280 256 class AttachmentModule(Component): 281 257 282 258 implements(IEnvironmentSetupParticipant, IRequestHandler, … … 363 339 data = { 364 340 'mode': 'list', 365 341 'parent': parent_data(parent_type, last_segment), 366 'attachments': attachments_data(self.env, req, None,367 parent_type, last_segment),342 'attachments': Attachment.select(self.env, 343 parent_type, last_segment) 368 344 } 369 345 return 'attachment.html', data, None 370 346 if not last_segment: … … 426 402 self.get_history(start, stop, type): 427 403 title = html(html.EM(os.path.basename(filename)), 428 404 ' attached to ', display(id)) 429 if format == 'rss': 430 descr = wiki_to_html(descr or '--', self.env, req, db, 431 absurls=True) 432 href = req.abs_href 433 else: 434 descr = wiki_to_oneliner(descr, self.env, db, shorten=True) 435 title += Markup(' by %s', author) 436 href = req.href 437 yield('attachment', href.attachment(type, id, filename), title, 405 yield('attachment', req.href.attachment(type, id, filename), title, 438 406 time, author, descr) 439 407 440 408 # Internal methods … … 533 501 534 502 req.check_modified(attachment.time) 535 503 536 # Render HTML view537 att_data = attachment_data(self.env, req, None, attachment)538 # Override the 'oneliner'539 att_data['description'] = wiki_to_html(attachment.description,540 self.env, req)541 542 504 data = {'mode': 'view', 'title': attachment.title, 543 'attachment': att _data}505 'attachment': attachment} 544 506 545 507 perm_map = {'ticket': 'TICKET_ADMIN', 'wiki': 'WIKI_DELETE'} 546 508 if req.perm.has_permission(perm_map[attachment.parent_type]): -
trac/ticket/web_ui.py
19 19 from StringIO import StringIO 20 20 import time 21 21 22 from trac.attachment import attachments_data,Attachment, AttachmentModule22 from trac.attachment import Attachment, AttachmentModule 23 23 from trac.config import BoolOption, Option 24 24 from trac.core import * 25 25 from trac.ticket import Milestone, Ticket, TicketSystem, ITicketManipulator … … 31 31 from trac.web import IRequestHandler 32 32 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor, \ 33 33 Chrome 34 from trac.wiki import wiki_to_html, wiki_to_oneliner35 34 from trac.mimeview.api import Mimeview, IContentConverter 35 from trac.wiki import wiki_to_html, wiki_to_oneliner 36 36 37 37 38 38 class InvalidTicket(TracError): … … 107 107 ticket.values['reporter'] = get_reporter_id(req, 'reporter') 108 108 data['ticket'] = ticket 109 109 110 if 'description' in ticket.values:111 description = wiki_to_html(ticket['description'], self.env, req, db)112 data['preview'] = description113 114 110 field_names = [field['name'] for field in ticket.fields 115 111 if not field.get('custom')] 116 112 if 'owner' in field_names: … … 265 261 comment = req.args.get('comment') 266 262 if comment: 267 263 data['comment'] = comment 268 # Wiki format a preview of comment 269 data['preview'] = wiki_to_html(comment, self.env, req, db) 264 data['preview'] = True 270 265 else: 271 266 data['reassign_owner'] = req.authname 272 267 # Store a timestamp in order to detect "mid air collisions" … … 445 440 change_summary = {} 446 441 # wikify comment 447 442 if 'comment' in change: 448 comment = change['comment']449 change['comment'] = unicode(wiki_to_html(450 comment, self.env, req, db, absurls=True))451 443 change_summary['added'] = ['comment'] 452 444 for field, values in change['fields'].iteritems(): 453 445 if field == 'description': … … 462 454 change['title'] = '; '.join(['%s %s' % (', '.join(v), k) for k, v \ 463 455 in change_summary.iteritems()]) 464 456 465 data = { 466 'id': ticket.id, 467 'description': wiki_to_html(ticket['description'], self.env, req, 468 db, absurls=True), 469 'changes': changes, 470 } 457 data = {'ticket': ticket, 'changes': changes} 471 458 472 459 template = Chrome(self.env).load_template('ticket.rss', req, data) 473 460 return template.generate(**data).render('xml'), 'application/rss+xml' … … 558 545 data['fields'].append(field) 559 546 560 547 data['reporter_id'] = reporter_id 561 data['description'] = wiki_to_html(ticket['description'], self.env, req,562 db)563 548 564 549 # FIXME: get rid of this once datetime branch is merged 565 550 data['opened'] = ticket.time_created … … 587 572 comment = '' 588 573 if 'comment' in change: 589 574 comment = change['comment'] 590 change['comment'] = wiki_to_html(comment, self.env, req, db)591 575 if change['permanent']: 592 576 cnum = change['cnum'] 593 577 # keep track of replies threading … … 611 595 612 596 # -- Ticket Attachments 613 597 614 data['attachments'] = attachments_data(self.env, req, db, 'ticket',615 ticket.id)598 data['attachments'] = Attachment.select(self.env, 'ticket', ticket.id, 599 db) 616 600 if req.perm.has_permission('TICKET_APPEND'): 617 601 data['attach_href'] = req.href.attachment('ticket', ticket.id) 618 602 -
trac/ticket/report.py
27 27 from trac.util.html import html 28 28 from trac.web.api import IRequestHandler, RequestDone 29 29 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 30 from trac.wiki import wiki_to_html,IWikiSyntaxProvider, Formatter30 from trac.wiki import IWikiSyntaxProvider, Formatter 31 31 32 32 33 33 class ReportModule(Component): … … 232 232 title = '{%i} %s' % (id, title) 233 233 234 234 data = {'action': 'view', 'title': title, 235 'report': 236 {'id': id, 'title': title, 237 'description': wiki_to_html(description, self.env, req, db, 238 absurls=(format == 'rss')), 239 'can': perms}} 240 235 'report': {'id': id, 'title': title, 236 'description': description, 'can': perms}} 241 237 try: 242 238 cols, results = self.execute_report(req, db, id, sql, args) 243 239 except Exception, e: … … 318 314 row['id'] = value 319 315 # Special casing based on column name 320 316 col = col.strip('_') 321 if col == 'description': 322 cell['parsed'] = wiki_to_html(value, self.env, req, db, 323 absurls=(format == 'rss')) 324 elif col == 'reporter': 317 if col == 'reporter': 325 318 if '@' in value: 326 319 cell['author'] = value 327 320 elif value in email_map: -
trac/ticket/roadmap.py
29 29 from trac.Timeline import ITimelineEventProvider 30 30 from trac.web import IRequestHandler 31 31 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 32 from trac.wiki import wiki_to_html, wiki_to_oneliner,IWikiSyntaxProvider32 from trac.wiki import IWikiSyntaxProvider 33 33 34 34 35 35 def get_tickets_for_milestone(env, db, milestone, field='component'): … … 87 87 } 88 88 89 89 def milestone_to_hdf(env, db, req, milestone): 90 ### FIXME: should use the Milestone object directly 90 91 safe_name = None 91 92 if milestone.exists: 92 93 safe_name = milestone.name.replace('/', '%2F') 93 94 hdf = {'name': milestone.name, 'exists': milestone.exists, 94 95 'href': req.href.milestone(safe_name)} 95 96 if milestone.description: 96 hdf['description_source'] = milestone.description 97 hdf['description'] = wiki_to_html(milestone.description, env, req, db) 97 hdf['description'] = milestone.description 98 98 if milestone.due: 99 99 hdf['due'] = milestone.due 100 100 hdf['due_date'] = format_date(milestone.due) … … 317 317 (start, stop,)) 318 318 for completed, name, description in cursor: 319 319 title = Markup('Milestone <em>%s</em> completed', name) 320 if format == 'rss': 321 href = req.abs_href.milestone(name) 322 message = wiki_to_html(description, self.env, req, db, 323 absurls=True) 324 else: 325 href = req.href.milestone(name) 326 message = wiki_to_oneliner(description, self.env, db, 327 shorten=True) 328 yield 'milestone', href, title, completed, None, message or '--' 320 yield 'milestone', href, title, completed, None, description 329 321 330 322 # IRequestHandler methods 331 323 -
trac/ticket/query.py
29 29 from trac.web.chrome import add_link, add_script, add_stylesheet, \ 30 30 INavigationContributor, Chrome 31 31 from trac.wiki.api import IWikiSyntaxProvider, parse_args 32 from trac.wiki.formatter import wiki_to_html, wiki_to_oneliner33 32 from trac.wiki.macros import WikiMacroBase # TODO: should be moved in .api 34 33 from trac.mimeview.api import Mimeview, IContentConverter 35 34 … … 405 404 groups.setdefault(value, []).append(ticket) 406 405 if not groupsequence or groupsequence[-1] != value: 407 406 groupsequence.append(value) 408 if field == 'time': 409 ticket[field] = value 410 elif field == 'description': 411 ticket[field] = \ 412 wiki_to_html(value or '', self.env, req, db) 413 else: 414 ticket[field] = value 407 ticket[field] = value 415 408 groupsequence = [(value, groups[value]) for value in groupsequence] 416 409 417 410 return {'query': self, … … 639 632 for result in results: 640 633 if result['reporter'].find('@') == -1: 641 634 result['reporter'] = '' 642 if result['description']:643 result['description'] = wiki_to_html(result['description'],644 self.env, req, db,645 absurls=True)646 635 query_href = req.abs_href.query(group=query.group, 647 636 groupdesc=query.groupdesc and 1 or None, 648 637 verbose=query.verbose and 1 or None, -
trac/versioncontrol/web_ui/util.py
24 24 from trac.util.html import escape, html, Markup 25 25 from trac.util.text import shorten_line 26 26 from trac.versioncontrol.api import NoSuchNode, NoSuchChangeset 27 from trac.wiki import wiki_to_html, wiki_to_oneliner28 27 29 28 __all__ = ['get_changes', 'get_path_links', 'get_path_rev_line', 30 29 'get_existing_node', 'render_node_property'] … … 41 40 42 41 wiki_format = env.config['changeset'].getbool('wiki_format_messages') 43 42 message = changeset.message or '--' 44 absurls = (format == 'rss') 45 if wiki_format: 46 shortlog = wiki_to_oneliner(message, env, db, 47 shorten=True, absurls=absurls) 48 else: 43 if not wiki_format: 49 44 shortlog = Markup.escape(shorten_line(message)) 45 else: 46 shortlog = message 50 47 51 48 if full: 52 if wiki_format: 53 message = wiki_to_html(message, env, req, db, 54 absurls=absurls, escape_newlines=True) 55 else: 49 if not wiki_format: 56 50 message = html.PRE(message) 57 51 else: 58 52 message = shortlog 59 53 60 if format == 'rss':61 if isinstance(shortlog, Markup):62 shortlog = u' '.join(shortlog.striptags().splitlines())63 message = unicode(message)64 65 54 changes[rev] = { 66 55 'date_seconds': changeset.date, 67 56 'date': format_datetime(changeset.date), 68 57 'age': pretty_timedelta(changeset.date), 69 58 'author': changeset.author or 'anonymous', 70 'message': message, 'shortlog': shortlog, 59 'message': message, 60 'shortlog': shortlog, 71 61 } 72 62 return changes 73 63 -
trac/versioncontrol/web_ui/changeset.py
39 39 from trac.versioncontrol.web_ui.util import render_node_property 40 40 from trac.web import IRequestHandler, RequestDone 41 41 from trac.web.chrome import INavigationContributor, add_link, add_stylesheet 42 from trac.wiki import wiki_to_html, wiki_to_oneliner, IWikiSyntaxProvider, \ 43 Formatter 42 from trac.wiki import IWikiSyntaxProvider, Formatter 44 43 45 44 46 45 class ChangesetModule(Component): … … 202 201 if chgset: 203 202 chgset = repos.get_changeset(new) 204 203 message = chgset.message or '--' 205 if self.wiki_format_messages: 206 message = wiki_to_html(message, self.env, req, 207 escape_newlines=True) 208 else: 204 if not self.wiki_format_messages: 209 205 message = html.PRE(message) 210 206 req.check_modified(chgset.date, [ 211 207 style, ''.join(options), repos.name, … … 293 289 title = _changeset_title(rev) 294 290 properties = [] 295 291 for name, value, wikiflag, htmlclass in chgset.get_properties(): 296 if wikiflag:297 value = wiki_to_html(value or '', self.env, req)298 292 properties.append({'name': name, 'value': value, 299 'htmlclass': htmlclass}) 293 'htmlclass': htmlclass, 294 'wiki_formatting': wikiflag}) 300 295 301 296 data['changeset'] = { 302 297 'revision': chgset.rev, … … 619 614 repos = self.env.get_repository(req.authname) 620 615 for chgset in repos.get_changesets(start, stop): 621 616 message = chgset.message or '--' 622 if wiki_format: 623 shortlog = wiki_to_oneliner(message, self.env, db, 624 shorten=True) 625 else: 617 if not wiki_format: 626 618 shortlog = shorten_line(message) 627 619 628 620 if format == 'rss': 629 621 title = Markup('Changeset [%s]: %s', chgset.rev, shortlog) 630 622 href = req.abs_href.changeset(chgset.rev) 631 if wiki_format: 632 message = wiki_to_html(message, self.env, req, db, 633 absurls=True) 634 else: 623 if not wiki_format: 635 624 message = html.PRE(message) 636 625 else: 637 626 title = Markup('Changeset <em>[%s]</em> by %s', chgset.rev, … … 639 628 href = req.href.changeset(chgset.rev) 640 629 641 630 if wiki_format: 631 # FIXME: 642 632 if self.timeline_long_messages: 643 message = wiki_to_html(message, self.env, req, db, 644 absurls=True) 645 else: 646 message = wiki_to_oneliner(message, self.env, db, 647 shorten=True) 633 pass 634 # FIXME: should set the shorten flag on the event, 635 # see timeline.html 648 636 else: 649 message = shortlog637 message = Markup.escape(shortlog) 650 638 651 639 if show_files and req.perm.has_permission('BROWSER_VIEW'): 652 640 files = [] -
trac/versioncontrol/web_ui/browser.py
27 27 from trac.util import sorted, embedded_numbers 28 28 from trac.util.datefmt import http_date 29 29 from trac.util.html import escape, html, Markup 30 from trac.web import IRequestHandler, RequestDone31 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor32 from trac.wiki import wiki_to_html, IWikiSyntaxProvider33 30 from trac.versioncontrol.api import NoSuchChangeset 34 31 from trac.versioncontrol.web_ui.util import * 32 from trac.web.api import IRequestHandler, RequestDone 33 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 34 from trac.wiki.api import IWikiSyntaxProvider 35 35 36 36 37 37 CHUNK_SIZE = 4096 … … 204 204 changeset = repos.get_changeset(node.rev) 205 205 206 206 message = changeset.message or '--' 207 if self.config['changeset'].getbool('wiki_format_messages'): 208 message = wiki_to_html(message, self.env, req, 209 escape_newlines=True) 210 else: 207 if not self.config['changeset'].getbool('wiki_format_messages'): 211 208 message = html.PRE(message) 212 209 213 210 # add ''Plain Text'' alternate link if needed -
trac/About.py
95 95 96 96 def _render_plugins(self, req): 97 97 try: 98 from trac.wiki.formatter import wiki_to_html99 98 import inspect 100 99 def getdoc(obj): 101 return wiki_to_html(inspect.getdoc(obj), self.env, req)100 return inspect.getdoc(obj) 102 101 except: 103 102 def getdoc(obj): 104 103 return obj.__doc__ … … 112 111 continue 113 112 plugin = {'name': component.__name__} 114 113 if component.__doc__: 115 plugin['description'] = Markup(getdoc(component))114 plugin['description'] = getdoc(component) 116 115 117 116 module = sys.modules[component.__module__] 118 117 plugin['module'] = module.__name__ … … 128 127 'interface': xtnpt.interface.__name__, 129 128 'module': xtnpt.interface.__module__}) 130 129 if xtnpt.interface.__doc__: 131 xtnpts[-1]['description'] = Markup(getdoc(xtnpt.interface))130 xtnpts[-1]['description'] = getdoc(xtnpt.interface) 132 131 extensions = [] 133 132 for extension in ComponentMeta._registry.get(xtnpt.interface, []): 134 133 if self.env.is_component_enabled(extension): -
trac/wiki/web_ui.py
20 20 import re 21 21 import StringIO 22 22 23 from trac.attachment import attachments_data,Attachment, AttachmentModule23 from trac.attachment import Attachment, AttachmentModule 24 24 from trac.core import * 25 25 from trac.perm import IPermissionRequestor 26 26 from trac.Search import ISearchSource, search_to_sql, shorten_result … … 33 33 from trac.web import HTTPNotFound, IRequestHandler 34 34 from trac.wiki.api import IWikiPageManipulator, WikiSystem 35 35 from trac.wiki.model import WikiPage 36 from trac.wiki.formatter import wiki_to_html, wiki_to_oneliner37 36 from trac.mimeview.api import Mimeview, IContentConverter 38 37 39 38 … … 243 242 if version == new_version: 244 243 date = t 245 244 author = a or 'anonymous' 246 comment = wiki_to_html(c or '--', self.env, req, db)245 comment = c 247 246 ipnr = i or '' 248 247 else: 249 248 if version < new_version: … … 335 334 'edit_rows': editrows, 336 335 'scroll_bar_pos': req.args.get('scroll_bar_pos', '') 337 336 }) 338 if action == 'preview':339 data.update({340 'page_html': wiki_to_html(page.text, self.env, req, db),341 'comment_html': wiki_to_oneliner(comment, self.env, db)342 })343 337 return 'wiki_edit.html', data, None 344 338 345 339 def _render_history(self, req, db, page): … … 361 355 'version': version, 362 356 'date': date, 363 357 'author': author, 364 'comment': wiki_to_oneliner(comment or '', self.env, db),358 'comment': comment, 365 359 'ipnr': ipnr 366 360 }) 367 361 data['history'] = history … … 384 378 if page.name == 'WikiStart': 385 379 data['title'] = '' 386 380 387 page_html = comment_html =attach_href = ''381 attach_href = '' 388 382 latest_page = WikiPage(self.env, page.name) 389 383 390 if page.exists: 391 page_html = wiki_to_html(page.text, self.env, req, db) 392 if version: 393 comment_html = wiki_to_oneliner(page.comment or '--', 394 self.env, db) 395 else: 384 if not page.exists: 396 385 if not req.perm.has_permission('WIKI_CREATE'): 397 386 raise HTTPNotFound('Page %s not found', page.name) 398 page _html = html.P('Describe "%s" here' % data['page_name'])387 page.text = 'Describe "`%s`" here' % data['page_name'] 399 388 400 389 # Show attachments 401 attachments = attachments_data(self.env, req, db, 'wiki', page.name)390 attachments = Attachment.select(self.env, 'wiki', page.name, db) 402 391 if req.perm.has_permission('WIKI_MODIFY'): 403 392 attach_href = req.href.attachment('wiki', page.name) 404 393 405 394 data.update({'action': 'view', 406 'page_html': page_html, 407 'comment_html': comment_html, 395 'version': version, 408 396 'latest_version': latest_page.version, 409 397 'attachments': attachments, 410 398 'attach_href': attach_href, … … 432 420 for t,name,comment,author,version in cursor: 433 421 title = Markup('<em>%s</em> edited by %s', 434 422 wiki.format_page_name(name), author) 435 diff_link = html.A('diff', href=href.wiki(name, action='diff',436 version=version))437 if format == 'rss':438 comment = wiki_to_html(comment or '--', self.env, req, db,439 absurls=True)440 else:441 comment = wiki_to_oneliner(comment, self.env, db,442 shorten=True)443 423 if version > 1: 444 comment = html(comment, ' (', diff_link, ')') 445 yield 'wiki', href.wiki(name), title, t, author, comment 424 link = href.wiki(name, action='diff', version=version) 425 else: 426 link = href.wiki(name) 427 yield 'wiki', link, title, t, author, comment 446 428 447 429 # Attachments 448 430 def display(id): -
trac/wiki/tests/formatter.py
129 129 130 130 class OneLinerTestCase(WikiTestCase): 131 131 def formatter(self): 132 return OneLinerFormatter(self.env ) # TODO: self.req132 return OneLinerFormatter(self.env, self.req) 133 133 134 134 135 135 def suite(data=None, setup=None, file=__file__): -
trac/wiki/formatter.py
861 861 """ 862 862 flavor = 'oneliner' 863 863 864 def __init__(self, env, absurls=False, db=None):865 Formatter.__init__(self, env, None, absurls, db)864 def __init__(self, env, req, absurls=False, db=None): 865 Formatter.__init__(self, env, req, absurls, db) 866 866 867 867 # Override a few formatters to disable some wiki syntax in "oneliner"-mode 868 868 def _list_formatter(self, match, fullmatch): return match … … 1009 1009 if not wikitext: 1010 1010 return Markup() 1011 1011 out = StringIO() 1012 OneLinerFormatter(env, absurls, db).format(wikitext, out, shorten)1012 OneLinerFormatter(env, None, absurls, db).format(wikitext, out, shorten) 1013 1013 return Markup(out.getvalue()) 1014 1014 1015 1015 def wiki_to_outline(wikitext, env, db=None, -
trac/web/chrome.py
17 17 import __builtin__ 18 18 import os 19 19 import re 20 from StringIO import StringIO 20 21 21 22 from genshi import Markup 22 from genshi.builder import tag 23 from genshi.builder import tag, Fragment 23 24 from genshi.output import DocType 24 25 from genshi.template import TemplateLoader, MarkupTemplate, TextTemplate 25 26 … … 32 33 format_time, http_date 33 34 from trac.web.api import IRequestHandler, HTTPNotFound 34 35 from trac.web.href import Href 35 from trac.wiki import IWikiSyntaxProvider 36 from trac.wiki.api import IWikiSyntaxProvider 37 from trac.wiki.formatter import Formatter, OneLinerFormatter 36 38 37 39 def add_link(req, rel, href, title=None, mimetype=None, classname=None): 38 40 """Add a link to the HDF data set that will be inserted as <link> element in … … 419 421 data['format_date'] = format_date 420 422 data['format_time'] = format_time 421 423 data['http_date'] = http_date 422 424 425 def wiki_to_html(text, absurls=False, escape_newlines=False): 426 if not text: 427 return Markup() 428 if isinstance(text, (Fragment, Markup)): 429 return text 430 out = StringIO() 431 Formatter(self.env, req, absurls).format(text, out, 432 escape_newlines) 433 return Markup(out.getvalue()) 434 435 def wiki_to_oneliner(text, absurls=False, shorten=False): 436 if not text: 437 return Markup() 438 if isinstance(text, (Fragment, Markup)): 439 return text 440 out = StringIO() 441 OneLinerFormatter(self.env, req, absurls).format(text, out, 442 shorten) 443 return Markup(out.getvalue()) 444 445 data['wiki_to_html'] = wiki_to_html 446 data['wiki_to_oneliner'] = wiki_to_oneliner 447 423 448 ## debugging tools 424 449 from pprint import pformat 425 450 data['pprint'] = pformat -
templates/ticket_view.html
69 69 (last modified by ${description_author}) 70 70 </span> 71 71 </h3> 72 ${ description}72 ${wiki_to_html(ticket.description)} 73 73 </div> 74 74 </form> 75 75 </div> … … 122 122 </py:choose> 123 123 </li> 124 124 </ul> 125 <div py:if="change.comment" class="comment">${ change.comment}</div>125 <div py:if="change.comment" class="comment">${wiki_to_html(change.comment)}</div> 126 126 </div> 127 127 </form> 128 128 </div> … … 149 149 </fieldset> 150 150 <fieldset py:if="preview" id="preview"> 151 151 <legend>Comment Preview</legend> 152 ${ preview}152 ${wiki_to_html(comment)} 153 153 </fieldset> 154 154 </div> 155 155 -
templates/report.rss
28 28 <title>#$row.id: $cell.value</title> 29 29 </py:when> 30 30 <py:when test="col == 'description'"> 31 <description> unicode($cell.parsed)</description>31 <description>${unicode(wiki_to_html($cell.value, absurls=True))}</description> 32 32 </py:when> 33 33 </py:choose> 34 34 </py:with> -
templates/browser.html
78 78 in trac.versioncontrol.web_ui.util.get_changes --> 79 79 <td class="change"> 80 80 <span class="author">$change.author:</span> 81 <span class="change">$ change.message</span>81 <span class="change">${wiki_to_oneliner(change.message)}</span> 82 82 </td> 83 83 </tr> 84 84 </py:with> … … 95 95 </th> 96 96 </tr> 97 97 <tr py:if="file"> 98 <td class="message">$ file.message</td>98 <td class="message">${wiki_to_html(file.message)}</td> 99 99 </tr> 100 100 <tr py:if="props"> 101 101 <td colspan="2"> -
templates/macros.html
22 22 - 'selector' is a boolean variable 23 23 - 'name is the name of the option 24 24 - 'text' is the displayed text, defaults to 'name' 25 - 'id' optional id for the checkbox, if different from 'name' 25 - 'id' optional id for the checkbox, if different from 'name' 26 26 --> 27 27 <py:def function="checkbox(selector, name, text=None, id=None)"> 28 28 <py:with vars="id = id or name"> … … 43 43 <py:def function="radiobuttons(selector, name, buttons)"> 44 44 <label py:for="button in buttons" 45 45 py:with="value = button[0]; text = button[1] or button[0]; default = button[3]"> 46 <input type="radio" id="$value" name="$name" value="$value" 46 <input type="radio" id="$value" name="$name" value="$value" 47 47 checked="${selector == value or (default and selector not in values) and 'checked' or None}" /> 48 48 $text 49 49 </label> … … 57 57 - 58 58 - We take care to not insert any extra space. 59 59 --> 60 61 <py:def function="plural(cnt,noun,keepzero=False)"><py:if 60 61 <py:def function="plural(cnt,noun,keepzero=False)"><py:if 62 62 test="cnt != 0 or keepzero" 63 63 >${cnt == 1 and ('1 '+noun) or '%d %ss' % (cnt, noun)}</py:if></py:def> 64 64 … … 69 69 <py:def function="sizeinfo(size)"><span title="$size bytes">${ 70 70 pretty_size(size) 71 71 }</span></py:def> 72 72 73 73 <!--! Display how many time elapsed since the given date. 74 74 - 75 75 - Typically used in sentences like "changed ${dateinfo(date)} ago" … … 79 79 <py:def function="dateinfo(date)"><span title="${format_datetime(date)}">${ 80 80 pretty_timedelta(date) 81 81 }</span></py:def> 82 82 83 83 <!--! Display a sequence of path components. 84 84 - 85 85 - Each component is a link to the corresponding location in the browser. … … 87 87 <py:def function="browser_path_links(path_links)"> 88 88 <py:for each="idx, part in enumerate(path_links)"> 89 89 <py:with vars="first = idx == 0; last = idx == len(path_links) - 1"> 90 <a class="${first and 'first' or None}" 90 <a class="${first and 'first' or None}" 91 91 title="${first and 'Go to root directory' or 'View ' + part.name}" 92 92 href="$part.href">$part.name</a> 93 93 <py:if test="not last"><span class="sep">/</span></py:if> … … 105 105 --> 106 106 <py:def function="changeset_navigation(change, others=[])"> 107 107 <li class="first" py:choose=""> 108 <py:when test="chrome.links.prev"> 108 <py:when test="chrome.links.prev"> 109 109 ← <a class="prev" py:attrs="chrome.links.prev[0]">Previous $change</a> 110 110 </py:when> 111 111 <py:otherwise> … … 115 115 <li py:for="label, url in others"><a href="$url">$label</a></li> 116 116 <li class="last" py:choose=""> 117 117 <py:when test="chrome.links.next"> 118 <a class="next" py:attrs="chrome.links.next[0]">Next $change</a> → 118 <a class="next" py:attrs="chrome.links.next[0]">Next $change</a> → 119 119 </py:when> 120 120 <py:otherwise> 121 121 <span class="missing">Next $change →</span> … … 167 167 Try <a href="$preview.raw_href">downloading</a> the file instead. 168 168 </py:when> 169 169 <py:when test="not preview.rendered"> 170 <strong>HTML preview not available</strong>. 170 <strong>HTML preview not available</strong>. 171 171 To view, <a href="$preview.raw_href">download</a> the file. 172 172 </py:when> 173 173 </py:choose> … … 182 182 --> 183 183 <py:def function="list_of_attachments(attachments, attach_href, compact=False)"> 184 184 <py:def function="show_one_attachment(attachment)"> 185 <a href="$ attachment.href" title="View attachment">$attachment.filename</a>186 (${sizeinfo(attachment.size)}) - added by <em>$attachment.author</em> 187 ${dateinfo(attachment. date)} ago.185 <a href="${attachment.href(req)}" title="View attachment">$attachment.filename</a> 186 (${sizeinfo(attachment.size)}) - added by <em>$attachment.author</em> 187 ${dateinfo(attachment.time)} ago. 188 188 </py:def> 189 189 <py:choose test=""> 190 190 <py:when test="compact and attachments"> … … 192 192 <ul> 193 193 <li py:for="attachment in attachments"> 194 194 ${show_one_attachment(attachment)} 195 <q py:if="compact and attachment.description">$ attachment.description</q>195 <q py:if="compact and attachment.description">${wiki_to_oneliner(attachment.description)}</q> 196 196 </li> 197 197 </ul> 198 198 </py:when> … … 202 202 <dl py:if="attachments" class="attachments"> 203 203 <py:for each="attachment in attachments"> 204 204 <dt>${show_one_attachment(attachment)}</dt> 205 <dd py:if="attachment.description">$ attachment.description</dd>205 <dd py:if="attachment.description">${wiki_to_oneliner(attachment.description)}</dd> 206 206 </py:for> 207 207 </dl> 208 208 <form py:if="attach_href" method="get" action="$attach_href"> -
templates/wiki_history.html
47 47 </td> 48 48 <td class="date">${format_datetime(item.date)}</td> 49 49 <td class="author" title="IP-Address: $item.ipnr">$item.author</td> 50 <td class="comment">$ item.comment</td>50 <td class="comment">${wiki_to_oneliner(item.comment, shorten=True)}</td> 51 51 </tr> 52 52 </tbody> 53 53 </table> -
templates/milestone_view.html
87 87 </fieldset> 88 88 </form> 89 89 90 <div class="description">${ milestone.description}</div>90 <div class="description">${wiki_to_html(milestone.description)}</div> 91 91 92 92 <div py:if="perm.has_permission('MILESTONE_MODIFY') or perm.has_permission('MILESTONE_DELETE')" class="buttons"> 93 93 <form py:if="perm.has_permission('MILESTONE_MODIFY')" method="get" action=""> -
templates/ticket_new.html
8 8 <head> 9 9 <title>New Ticket</title> 10 10 <script type="text/javascript"> 11 addEvent(window, 'load', function() { document.getElementById('summary').focus()}); 11 addEvent(window, 'load', function() { document.getElementById('summary').focus()}); 12 12 </script> 13 13 </head> 14 14 … … 34 34 <div class="field"> 35 35 <label for="description">Full description (you may use <a tabindex="42" 36 36 href="${href.wiki('WikiFormatting')}">WikiFormatting</a> here):</label><br /> 37 <textarea id="description" name="description" class="wikitext" rows="10" 38 cols="78">${ticket.description}</textarea>39 <fieldset py:if=" preview" id="preview">37 <textarea id="description" name="description" class="wikitext" rows="10" cols="78"> 38 ${ticket.description}</textarea> 39 <fieldset py:if="ticket.description" id="preview"> 40 40 <legend>Description Preview</legend> 41 ${ preview}41 ${wiki_to_html(ticket.description)} 42 42 </fieldset> 43 43 </div> 44 44 … … 85 85 86 86 </fieldset> 87 87 88 88 89 89 <p py:if="can_attach"> 90 90 <label> 91 91 <input type="checkbox" name="attachment" checked="${attachment or None}" /> … … 99 99 </div> 100 100 101 101 </form> 102 102 103 103 <script type="text/javascript" src="${chrome.htdocs_location}js/wikitoolbar.js"></script> 104 104 105 105 <div id="help"> -
templates/revisionlog.html
116 116 </td> 117 117 <td class="date">$change.date</td> 118 118 <td class="author">$change.author</td> 119 <td class="summary">${not verbose and change.messageor ''}</td>119 <td class="summary">${not verbose and wiki_to_oneliner(change.message, shorten=True) or ''}</td> 120 120 </tr> 121 121 122 122 <tr py:if="verbose"> 123 <td class="summary" colspan="7">$ change.message</td>123 <td class="summary" colspan="7">${wiki_to_html(change.message)}</td> 124 124 </tr> 125 125 </py:with> 126 126 </py:for> -
templates/revisionlog.rss
16 16 <item py:for="item in items" py:with="change = changes[item.rev]"> 17 17 <author py:if="change.author">$change.author</author> 18 18 <pubDate>${format_datetime(change.date_seconds)}</pubDate> <!--! FIXME: use 'change.date' later on --> 19 <title>Revision $item.rev: $ change.shortlog</title>19 <title>Revision $item.rev: ${u' '.join(change.shortlog.striptags().splitlines())})</title> 20 20 <link>${abs_href.changeset(rev, path)}</link> 21 21 <guid isPermaLink="false">${abs_href.changeset(item.rev, item.path)}</guid> 22 <description>$ change.message</description>22 <description>${unicode(wiki_to_html(change.message, absurls=True))}</description> 23 23 <category>Log</category> 24 24 </item> 25 25 -
templates/report_view.html
5 5 <span py:if="numrows and report.id != -1" class="numrows">($numrows matches)</span> 6 6 </h1> 7 7 8 <div py:if="report.description" id="description">$ report.description</div>8 <div py:if="report.description" id="description">${wiki_to_html(report.description)}</div> 9 9 10 10 <div py:if="report.id != -1 and (report.can.create or report.can.modify or report.can.delete)" class="buttons"> 11 11 <form py:if="report.can.modify" action="" method="get"> … … 108 108 109 109 <py:when test="col == 'description'"> 110 110 <py:def function="cellclass"></py:def> 111 <py:def function="content">$ cell.parsed</py:def>111 <py:def function="content">${wiki_to_html(cell.value)}</py:def> 112 112 </py:when> 113 113 114 114 <py:otherwise> -
templates/timeline.html
36 36 <h2>$day:</h2> 37 37 <dl> 38 38 <py:for each="event in events"> 39 <dt class="${event.kind}"><a href="${event.href}"> 40 <span class="time">${event.time}</span> ${event.title} 41 </a></dt> 42 <dd class="${event.kind}">${event.message}</dd> 39 <dt class="${event.kind}"> 40 <a href="${event.href}"><span class="time">${event.time}</span> ${event.title}</a> 41 </dt> 42 <dd class="${event.kind}" py:with="shorten = event.shorten_message is None and True or event.shorten_message"> 43 ${wiki_to_oneliner(event.message, shorten)} 44 </dd> 43 45 </py:for> 44 46 </dl> 45 47 </py:for> -
templates/wiki_edit.html
33 33 <table id="info" summary="Revision info"> 34 34 <tbody> 35 35 <tr><th scope="col">Preview of future version ${page.version+1} (modified by $author)</th></tr> 36 <tr><td class="message">$ comment_html</td></tr>36 <tr><td class="message">${wiki_to_html(comment)}</td></tr> 37 37 </tbody> 38 38 </table> 39 39 <fieldset id="preview"> 40 40 <legend>Preview (<a href="#edit">skip</a>)</legend> 41 <div class="wikipage">$ page_html</div>41 <div class="wikipage">${wiki_to_html(page.text)}</div> 42 42 </fieldset> 43 43 </py:when> 44 44 <py:when test="'collision'"> … … 63 63 </select> 64 64 </div> 65 65 <p><textarea id="text" class="wikitext" name="text" cols="80" rows="$edit_rows"> 66 $page.text 67 </textarea> 66 $page.text</textarea> 68 67 </p> 69 68 <script type="text/javascript"> 70 69 var scrollBarPos = document.getElementById("scroll_bar_pos"); -
templates/timeline.rss
17 17 <title>${event.title}</title> 18 18 <author py:if="event.author">${event.author}</author> 19 19 <pubDate>${event.date}</pubDate> 20 <link>${ event.href}</link>21 <guid isPermaLink="false">${ event.href}/${event.dateuid}</guid>22 <description>${ event.message}</description>20 <link>${abs_href()}/${event.href}</link> 21 <guid isPermaLink="false">${abs_href()}/${event.href}/${event.dateuid}</guid> 22 <description>${unicode(wiki_to_html(event.message, absurls=True))}</description> 23 23 </item> 24 24 25 25 </channel> -
templates/about.html
69 69 </tr> 70 70 <tr py:if="plugin.description"> 71 71 <th class="description" scope="row">Description</th> 72 <td class="description">${ plugin.description}</td>72 <td class="description">${wiki_to_html(plugin.description)}</td> 73 73 </tr> 74 74 <tr py:for="idx,extension_point in enumerate(plugin.extension_points)"> 75 75 <th py:if="idx == 0" class="xtnpts" 76 76 rowspan="${len(plugin.extension_points)}"> 77 77 Extension points: 78 78 </th> 79 <td class="xtnpts"> 79 <td class="xtnpts"> 80 80 <code>${extension_point.module}.${extension_point.interface}</code> 81 81 <div py:if="extension_point.extensions" py:strip=""> 82 82 (${len(extension_point.extensions)} extensions) … … 86 86 </li> 87 87 </ul> 88 88 </div> 89 <div class="description">${ extension_point.description}</div>89 <div class="description">${wiki_to_html(extension_point.description)}</div> 90 90 </td> 91 91 </tr> 92 92 </table> … … 102 102 </a> 103 103 <h1>About Trac ${trac.version}</h1> 104 104 <p>Trac is a web-based software project management and bug/issue 105 tracking system emphasizing ease of use and low ceremony. 106 It provides an integrated Wiki, an interface to version control 105 tracking system emphasizing ease of use and low ceremony. 106 It provides an integrated Wiki, an interface to version control 107 107 systems, and a number convenient ways to stay on top of events 108 108 and changes within a project. 109 109 </p> 110 110 <p>Trac is distributed under the modified BSD License.<br /> 111 The complete text of the license can be found 111 The complete text of the license can be found 112 112 <a href="http://trac.edgewall.org/wiki/TracLicense">online</a> 113 113 as well as in the <tt>COPYING</tt> file included in the distribution.</p> 114 114 <a href="http://www.python.org/" style="border: none; float: right"> 115 115 <img style="display: block" src="${chrome.htdocs_location}python.png" 116 116 alt="python powered" width="140" height="56" /> 117 117 </a> 118 <p>Please visit the Trac open source project: 118 <p>Please visit the Trac open source project: 119 119 <a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a></p> 120 120 <p>Copyright © 2003-2006 121 121 <a href="http://www.edgewall.org/">Edgewall Software</a></p> -
templates/roadmap.html
16 16 17 17 <div id="content" class="roadmap"> 18 18 <h1>Roadmap</h1> 19 19 20 20 <form id="prefs" method="get" action=""> 21 21 <div> 22 22 <input type="checkbox" id="showall" name="show" value="all" … … 62 62 </py:if> 63 63 </div> 64 64 65 <div class="description">${ milestone.description}</div>65 <div class="description">${wiki_to_html(milestone.description)}</div> 66 66 67 67 </li> 68 68 </ul> -
templates/ticket.rss
4 4 5 5 <title>${project.name}: Ticket $title</title> 6 6 <link>${abs_href.ticket(id)}</link> 7 <description>${unicode( description)}</description>7 <description>${unicode(wiki_to_html(ticket.description, absurls=True))}</description> 8 8 <language>en-us</language> 9 9 <image py:if="chrome.logo.src"> 10 10 <title>$project.name</title> … … 18 18 <pubDate>${http_date(change.date)}</pubDate> 19 19 <title>$change.title</title> 20 20 <link>${abs_href.ticket(id)}<py:if test="change.cnum">#comment:$change.cnum</py:if></link> 21 <guid isPermaLink="false">${abs_href.ticket(id)}<py:if test="change.cnum">#comment:$change.cnum</py:if></guid >21 <guid isPermaLink="false">${abs_href.ticket(id)}<py:if test="change.cnum">#comment:$change.cnum</py:if></guid > 22 22 <description> 23 23 <py:if test="change.fields"> 24 24 <ul> 25 25 <py:for each="field, value in change.fields.iteritems()"> 26 <li><strong>$field</strong> 26 <li><strong>$field</strong> 27 27 <py:choose> 28 28 <py:when test="not value.old"> 29 29 set to <em>$value.new</em> … … 39 39 </py:for> 40 40 </ul> 41 41 </py:if> 42 $ change.comment42 ${unicode(wiki_to_html(change.comment, absurls=True))} 43 43 </description> 44 44 <category>Ticket</category> 45 45 </item> -
templates/attachment.html
77 77 <tbody> 78 78 <tr> 79 79 <th scope="col"> 80 File $attachment.filename, ${sizeinfo(attachment.size)} 81 (added by $attachment.author, ${dateinfo(attachment. date)} ago)80 File $attachment.filename, ${sizeinfo(attachment.size)} 81 (added by $attachment.author, ${dateinfo(attachment.time)} ago) 82 82 </th> 83 83 </tr> 84 84 <tr> 85 <td class="message">$ attachment.description</td>85 <td class="message">${wiki_to_html(attachment.description)}</td> 86 86 </tr> 87 87 </tbody> 88 88 </table> -
templates/wiki_diff.html
52 52 <dt class="property message">Comment:</dt> 53 53 <dd class="message" py:choose=""> 54 54 <em py:when="multi" class="multi">(multiple changes)</em> 55 <py:otherwise>$ comment</py:otherwise>55 <py:otherwise>${wiki_to_html(comment)}</py:otherwise> 56 56 </dd> 57 57 </dl> 58 58 <div class="diff"> -
templates/wiki_view.html
20 20 <li><a href="${href.wiki('RecentChanges')}">Index by Date</a></li> 21 21 <li class="last"> 22 22 <a href="${req.href.wiki(page.name, action='diff', version=page.version)}">Last Change</a> 23 </li> 23 </li> 24 24 </ul> 25 25 <hr /> 26 26 </div> 27 27 28 28 <div id="content" class="wiki"> 29 30 <py:if test=" comment_html">29 30 <py:if test="version"> 31 31 <table id="info" summary="Revision info"> 32 32 <tbody> 33 33 <tr><th scope="col">Version $page.version (modified by $page.author, ${dateinfo(page.time)} ago)</th></tr> 34 <tr><td class="message">$ comment_html</td></tr>34 <tr><td class="message">${wiki_to_html(comment or '--')}</td></tr> 35 35 </tbody> 36 36 </table> 37 37 </py:if> 38 38 39 39 <div class="wikipage"> 40 <div id="searchable">$ page_html</div>40 <div id="searchable">${wiki_to_html(page.text)}</div> 41 41 </div> 42 42 43 43 ${list_of_attachments(attachments, attach_href, compact=True)} -
templates/changeset.html
105 105 <dd class="$prop.htmlclass">$prop.value</dd> 106 106 </span> 107 107 <dt class="property message">Message:</dt> 108 <dd class="message" id="searchable">${ changeset.message or ' '}</dd>108 <dd class="message" id="searchable">${wiki_to_html(changeset.message)}</dd> 109 109 </py:if> 110 110 <dt class="property files">${filter(None, changes) and 'Files:' or '(No files)'}</dt> 111 111 <dd class="files"> -
templates/milestone_edit.html
13 13 <link rel="stylesheet" type="text/css" 14 14 href="${chrome.htdocs_location}css/roadmap.css" /> 15 15 <script type="text/javascript"> 16 addEvent(window, 'load', function() { document.getElementById('name').focus()}); 16 addEvent(window, 'load', function() { document.getElementById('name').focus()}); 17 17 </script> 18 18 </head> 19 19 … … 82 82 <label for="description">Description (you may use <a tabindex="42" 83 83 href="${href.wiki('WikiFormatting')}">WikiFormatting</a> here):</label> 84 84 <p><textarea id="description" name="description" class="wikitext" rows="10" cols="78"> 85 ${milestone.description _source}</textarea></p>85 ${milestone.description}</textarea></p> 86 86 </fieldset> 87 87 </div> 88 88 <div class="buttons" py:choose="milestone.exists"> -
templates/query_div.html
56 56 <td colspan="${len(headers)}"> 57 57 <p class="meta">Reported by <strong>$result.reporter</strong>, 58 58 ${dateinfo(result.time)} ago${result.description and ':' or ''}</p> 59 <p py:if="result.description">$result.description</p>59 <py:if test="result.description">${wiki_to_html(result.description)}</py:if> 60 60 </td> 61 61 </tr> 62 62 -
templates/query.rss
17 17 <title>#$result.id: $result.summary</title> 18 18 <pubDate py:if="result.time">${http_date(result.time)}</pubDate> 19 19 <author py:if="result.reporter">$result.reporter</author> 20 <description>${unicode( result.description)}</description>20 <description>${unicode(wiki_to_html(result.description, absurls=True))}</description> 21 21 <category>Results</category> 22 22 <comments>$href#changelog</comments> 23 23 </item>
