ChristopherLenz: wiki2x_in_templates.2.diff
| File wiki2x_in_templates.2.diff, 4.2 kB (added by cmlenz, 2 years ago) |
|---|
-
trac/wiki/web_ui.py
396 396 if page.name == 'WikiStart': 397 397 data['title'] = '' 398 398 399 page_html = comment_html = attach_href = '' 400 latest_page = WikiPage(self.env, page.name) 401 399 comment_html = attach_href = '' 402 400 if page.exists: 403 page_html = wiki_to_html(page.text, self.env, req, db)401 latest_page = WikiPage(self.env, page.name) 404 402 if version: 405 403 comment_html = wiki_to_oneliner(page.comment or '--', 406 404 self.env, db) 407 405 else: 408 406 if not req.perm.has_permission('WIKI_CREATE'): 409 407 raise HTTPNotFound('Page %s not found', page.name) 410 page_html = html.P('Describe "%s" here' % data['page_name'])411 408 412 409 # Show attachments 413 410 attachments = attachments_data(self.env, req, db, 'wiki', page.name) … … 419 416 WikiSystem(self.env).get_pages(prefix)] 420 417 421 418 data.update({'action': 'view', 422 'page_html': page_html,423 419 'comment_html': comment_html, 424 420 'latest_version': latest_page.version, 425 421 'attachments': attachments, -
trac/web/chrome.py
36 36 format_time, http_date 37 37 from trac.web.api import IRequestHandler, HTTPNotFound 38 38 from trac.web.href import Href 39 from trac.wiki import IWikiSyntaxProvider39 from trac.wiki import wiki_to_html, wiki_to_oneliner, IWikiSyntaxProvider 40 40 41 41 def add_link(req, rel, href, title=None, mimetype=None, classname=None): 42 42 """Add a link to the HDF data set that will be inserted as <link> element in … … 427 427 data['format_time'] = partial(format_time, tzinfo=tzinfo) 428 428 data['fromtimestamp'] = partial(datetime.fromtimestamp, tz=tzinfo) 429 429 430 # Wiki-formatting functions 431 data['wiki_to_html'] = partial(wiki_to_html, env=self.env, req=req) 432 data['wiki_to_oneliner'] = partial(wiki_to_html, env=self.env, req=req) 433 430 434 def load_template(self, filename, method=None): 431 435 """Retrieve a Template and optionally preset the template data. 432 436 … … 468 472 return stream.render('text') 469 473 else: 470 474 doctype = {'text/html': DocType.XHTML_STRICT}.get(content_type) 475 req.environ['trac.chrome.links'] = {} 476 req.environ['trac.chrome.scripts'] = [] 477 data['chrome'].update({ 478 'post_links': req.environ['trac.chrome.links'], 479 'post_scripts': req.environ['trac.chrome.scripts'], 480 }) 471 481 return stream.render(method, doctype=doctype) -
templates/layout.html
50 50 <div id="main"> 51 51 ${select('*|text()')} 52 52 53 <script type="text/javascript" py:if="chrome.post_links"> 54 <py:for each="link in chrome.post_links.get('stylesheet')"> 55 $.loadStyleSheet("${link.href}", "${link.title}"); 56 </py:for> 57 </script> 58 <script py:for="script in chrome.post_scripts" 59 type="${script.type}" src="${script.href}"></script> 60 53 61 <div id="altlinks" py:if="chrome.links.alternate"> 54 62 <h3>Download in other formats:</h3> 55 63 <ul> -
templates/wiki_view.html
40 40 </table> 41 41 </py:if> 42 42 43 <div class="wikipage searchable"> 44 $page_html 43 <div class="wikipage searchable" py:choose=""> 44 <py:when test="page.exists"> 45 ${wiki_to_html(page.text)} 46 </py:when> 47 <py:otherwise> 48 Describe ${page.name} here. 49 </py:otherwise> 45 50 </div> 46 51 47 52 ${list_of_attachments(attachments, attach_href, compact=True)}
