Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # Copyright: 2012 MoinMoin:CheerXiao | 1 # Copyright: 2012 MoinMoin:CheerXiao |
2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann | 2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann |
3 # Copyright: 2011 MoinMoin:AkashSinha | 3 # Copyright: 2011 MoinMoin:AkashSinha |
4 # Copyright: 2011 MoinMoin:ReimarBauer | 4 # Copyright: 2011 MoinMoin:ReimarBauer |
5 # Copyright: 2008 MoinMoin:FlorianKrupicka | 5 # Copyright: 2008 MoinMoin:FlorianKrupicka |
6 # Copyright: 2010 MoinMoin:DiogenesAugusto | 6 # Copyright: 2010 MoinMoin:DiogenesAugusto |
7 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au> | 7 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au> |
8 # Copyright: 2001 Juergen Hermann <jh@web.de> | 8 # Copyright: 2001 Juergen Hermann <jh@web.de> |
9 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. | 9 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. |
10 | 10 |
11 """ | 11 """ |
12 MoinMoin - frontend views | 12 MoinMoin - frontend views |
13 | 13 |
14 This shows the usual things users see when using the wiki. | 14 This shows the usual things users see when using the wiki. |
15 """ | 15 """ |
16 | 16 |
17 | 17 |
18 import re | 18 import re |
19 import difflib | 19 import difflib |
20 import time | 20 import time |
21 import mimetypes | 21 import mimetypes |
22 import json | 22 import json |
23 import markdown | 23 import markdown |
Thomas.J.Waldmann
2015/08/11 16:23:08
did you look at our own parsers first (see convert
vipul
2015/08/12 06:59:05
ok I will try how it works
| |
24 from datetime import datetime | 24 from datetime import datetime |
25 from collections import namedtuple | 25 from collections import namedtuple |
26 from functools import wraps, partial | 26 from functools import wraps, partial |
27 | 27 |
28 from flask import request, url_for, flash, Response, make_response, redirect, ab ort, jsonify | 28 from flask import request, url_for, flash, Response, make_response, redirect, ab ort, jsonify |
29 from flask import current_app as app | 29 from flask import current_app as app |
30 from flask import g as flaskg | 30 from flask import g as flaskg |
31 from flask.ext.babel import format_date | 31 from flask.ext.babel import format_date |
32 from flask.ext.themes import get_themes_list | 32 from flask.ext.themes import get_themes_list |
33 | 33 |
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2384 return render_template('tickets.html', | 2384 return render_template('tickets.html', |
2385 results=results, | 2385 results=results, |
2386 query=query, | 2386 query=query, |
2387 status=status, | 2387 status=status, |
2388 tags=tags, | 2388 tags=tags, |
2389 selected_tags=selected_tags, | 2389 selected_tags=selected_tags, |
2390 current_timestamp=current_timestamp, | 2390 current_timestamp=current_timestamp, |
2391 ) | 2391 ) |
2392 | 2392 |
2393 | 2393 |
2394 @frontend.route('/+comment', defaults=dict(item_name=u''), methods=['POST', 'GET ']) | 2394 @frontend.route('/+comment', defaults=dict(item_name=u''), methods=['POST']) |
2395 def comment(item_name): | 2395 def comment(item_name): |
2396 itemid = request.args.get('refers_to') | 2396 itemid = request.form.get('refers_to') |
2397 reply_to = request.args.get('reply_to') | 2397 reply_to = request.form.get('reply_to') |
2398 data = request.args.get('data') | 2398 data = request.form.get('data') |
2399 if data: | 2399 if data: |
2400 current_timestamp = datetime.now().strftime("%Y_%m_%d-%H_%M_%S") | 2400 current_timestamp = datetime.now().strftime("%Y_%m_%d-%H_%M_%S") |
2401 item_name = unicode(itemid) + u'/' + u'comment_' + unicode(current_times tamp) | 2401 item_name = unicode(itemid) + u'/' + u'comment_' + unicode(current_times tamp) |
2402 item = Item.create(item_name) | 2402 item = Item.create(item_name) |
2403 item.modify({}, data=markdown.markdown(data), element=u'comment', conten ttype_guessed=u'text/x.moin.wiki;charset=utf-8', \ | 2403 item.modify({}, data=data, element=u'comment', contenttype_guessed=u'tex t/x-markdown;charset=utf-8', \ |
Thomas.J.Waldmann
2015/08/11 16:23:08
why is it markdown AND wiki here?
vipul
2015/08/12 06:59:05
I used u'text/x-markdown;charset=utf-8' earlier bu
Thomas.J.Waldmann
2015/08/18 16:07:19
if you just create a normal new wiki page, you can
| |
2404 refers_to=itemid, reply_to=reply_to, author=flaskg.user.name[0]) | 2404 refers_to=itemid, reply_to=reply_to, author=flaskg.user.name[0]) |
2405 html = render_template('comments.html', | 2405 html = render_template('comments.html', |
2406 data=data, | 2406 data=data, |
2407 author=flaskg.user.name[0], | 2407 author=flaskg.user.name[0], |
2408 timestamp=time.ctime(), | 2408 timestamp=time.ctime(), |
2409 commentid=item.fqname.value, | 2409 commentid=item.fqname.value, |
2410 itemid=reply_to, | 2410 itemid=reply_to, |
2411 item=item, | 2411 item=item, |
2412 ) | 2412 ) |
2413 return html | 2413 return html |
2414 | 2414 |
2415 | 2415 |
2416 | |
2417 @frontend.route('/+new', methods=['GET', 'POST']) | 2416 @frontend.route('/+new', methods=['GET', 'POST']) |
2418 def new(): | 2417 def new(): |
2419 # TODO: Implement creation of blog entries and ticket items | 2418 # TODO: Implement creation of blog entries and ticket items |
2420 raise NotImplementedError | 2419 raise NotImplementedError |
2421 | 2420 |
2422 | 2421 |
2423 @frontend.errorhandler(404) | 2422 @frontend.errorhandler(404) |
2424 def page_not_found(e): | 2423 def page_not_found(e): |
2425 return render_template('404.html', | 2424 return render_template('404.html', |
2426 item_name=e.description), 404 | 2425 item_name=e.description), 404 |
LEFT | RIGHT |