Add embed page utility
This commit is contained in:
parent
479d8eecc0
commit
99af43d499
1 changed files with 12 additions and 4 deletions
16
app.py
16
app.py
|
|
@ -33,7 +33,7 @@ try:
|
|||
except Exception:
|
||||
markdown_strikethrough = None
|
||||
|
||||
__version__ = '0.4-dev'
|
||||
__version__ = '0.4'
|
||||
|
||||
#### CONSTANTS ####
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ forbidden_urls = [
|
|||
'create', 'edit', 'p', 'ajax', 'history', 'manage', 'static', 'media',
|
||||
'accounts', 'tags', 'init-config', 'upload', 'upload-info', 'about',
|
||||
'stats', 'terms', 'privacy', 'easter', 'search', 'help', 'circles',
|
||||
'protect', 'kt'
|
||||
'protect', 'kt', 'embed'
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -519,8 +519,6 @@ app.secret_key = 'qrdldCcvamtdcnidmtasegasdsedrdqvtautar'
|
|||
app.url_map.converters['slug'] = SlugConverter
|
||||
|
||||
|
||||
|
||||
|
||||
#### ROUTES ####
|
||||
|
||||
@app.before_request
|
||||
|
|
@ -708,6 +706,16 @@ def view_unnamed(id):
|
|||
flash('The URL of this page is a reserved URL. Please change it.')
|
||||
return render_template('view.html', p=p, rev=p.latest)
|
||||
|
||||
@app.route('/embed/<int:id>/')
|
||||
def embed_view(id):
|
||||
try:
|
||||
p = Page[id]
|
||||
except Page.DoesNotExist:
|
||||
return "", 404
|
||||
rev = p.latest
|
||||
return "<h1>{0}</h1><div class=\"inner-content\">{1}</div>".format(
|
||||
html.escape(p.title), rev.html())
|
||||
|
||||
@app.route('/p/most_recent/')
|
||||
@app.route('/p/most_recent/<int:page>/')
|
||||
def view_most_recent(page=1):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue