1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-11-04 17:23:18 +00:00

Merge branch 'html-fixes'

This commit is contained in:
Jan Broer
2016-04-03 23:33:43 +02:00
8 changed files with 18 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
import mimetypes
import logging
import sys
import textwrap
mimetypes.add_type('application/xhtml+xml','.xhtml')
from flask import Flask, render_template, session, request, Response, redirect, url_for, send_from_directory, make_response, g, flash, abort
from cps import db, config, ub, helper
@@ -123,6 +124,14 @@ def url_for_other_page(page):
app.jinja_env.globals['url_for_other_page'] = url_for_other_page
## custom jinja filters
@app.template_filter('shortentitle')
def shortentitle_filter(s):
if len(s) > 60:
s = s.split(':', 1)[0]
if len(s) > 60:
s = textwrap.wrap(s, 60, break_long_words=False)[0]+' [...]'
return s
def admin_required(f):
"""