From e5b4b23cc7c1bed1aad3b8a0eb8acfd8a94d4f88 Mon Sep 17 00:00:00 2001 From: autocat Date: Wed, 15 Apr 2020 13:43:27 -0400 Subject: [PATCH 1/3] CoverPages.py changes --- CoverPages.py | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/CoverPages.py b/CoverPages.py index 7d17d23..fcc56ef 100644 --- a/CoverPages.py +++ b/CoverPages.py @@ -18,7 +18,7 @@ import cherrypy import six import textwrap from libgutenberg import GutenbergGlobals as gg - +import re import BaseSearcher class CoverPages (object): @@ -34,28 +34,13 @@ class CoverPages (object): cherrypy.response.headers['Content-Type'] = 'text/html; charset=utf-8' cherrypy.response.headers['Content-Language'] = 'en' - s = """ - - + s = """ + - -
-->""" +--> +""" for row in rows: url = '/' + row.filename @@ -63,25 +48,21 @@ class CoverPages (object): title = gg.xmlspecialchars (row.title) title = title.replace ('"', '"') title_len=len(title) - #title = re.sub (r'\s*\$[a-z].*', '', title) + title=re.sub(r"\-+"," ",title) + #title = re.sub (r"\-+"," ",title) + #new_title= re.sub(r'\-+',' ',title) title= title.splitlines()[0] if(title_len>80): - title=textwrap.wrap(title,50)[0] - + title=textwrap.wrap(title,80)[0] s += """
{title}
{title}\n
\n""".format ( + >
{title}
{title}\n
\n""".format ( url = url, href = href, title = title, size = size) -<<<<<<< HEAD return (s + '\n').encode ('utf-8') -======= - return (s + '
\n').encode ('utf-8') ->>>>>>> 0253c4308e81c77c840eed00fd2df1fe998dc5f5 - def index (self, count, size, order, **kwargs): """ Internal help function. """ From 60dde5f96c9717e18ae2e42a62624e8469db8b90 Mon Sep 17 00:00:00 2001 From: autocat Date: Mon, 20 Apr 2020 11:49:39 -0400 Subject: [PATCH 2/3] Adding new variables causes issues --- CoverPages.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CoverPages.py b/CoverPages.py index fcc56ef..2b128e6 100644 --- a/CoverPages.py +++ b/CoverPages.py @@ -46,19 +46,20 @@ class CoverPages (object): url = '/' + row.filename href = '/ebooks/%d' % row.pk title = gg.xmlspecialchars (row.title) + #Declaring this variable causes autocat service to fail + #short_title = title title = title.replace ('"', '"') - title_len=len(title) - title=re.sub(r"\-+"," ",title) - #title = re.sub (r"\-+"," ",title) + title_len = len(title) + title = re.sub(r"\-+"," ",title) + #title = re.sub (r"\-+"," ",title) #new_title= re.sub(r'\-+',' ',title) - title= title.splitlines()[0] + title = title.splitlines()[0] if(title_len>80): - title=textwrap.wrap(title,80)[0] + title = textwrap.wrap(title,80)[0] - s += """
{title}
{title}\n
\n""".format ( + s += """
+
{title} +
{title}
\n""".format ( url = url, href = href, title = title, size = size) return (s + '\n').encode ('utf-8') From d672cc3bf9b8bed9ee03fa5cbd3dc5c80b352af1 Mon Sep 17 00:00:00 2001 From: autocat Date: Wed, 29 Apr 2020 13:01:39 -0400 Subject: [PATCH 3/3] Changes for the cover title --- CoverPages.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CoverPages.py b/CoverPages.py index 2b128e6..adb80eb 100644 --- a/CoverPages.py +++ b/CoverPages.py @@ -46,21 +46,21 @@ class CoverPages (object): url = '/' + row.filename href = '/ebooks/%d' % row.pk title = gg.xmlspecialchars (row.title) - #Declaring this variable causes autocat service to fail - #short_title = title - title = title.replace ('"', '"') + #Shortening long titles for latest covers + short_title = title + short_title = short_title.replace ('"', '"') title_len = len(title) - title = re.sub(r"\-+"," ",title) + short_title = re.sub(r"\-+"," ",short_title) #title = re.sub (r"\-+"," ",title) #new_title= re.sub(r'\-+',' ',title) - title = title.splitlines()[0] + short_title = short_title.splitlines()[0] if(title_len>80): - title = textwrap.wrap(title,80)[0] + short_title = textwrap.wrap(short_title,80)[0] s += """
{title} -
{title}
\n""".format ( - url = url, href = href, title = title, size = size) +
{short_title}
\n""".format ( + url = url, href = href, title = title, short_title = short_title, size = size) return (s + '\n').encode ('utf-8')