From 946297389bdab0bc69925b30e53af63aa736eb0d Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 4 Feb 2011 04:58:42 -0700 Subject: [PATCH] GwR custom template exceptions --- resources/catalog/stylesheet.css | 208 ++++++++++++++----------------- src/calibre/library/catalog.py | 28 +++-- 2 files changed, 116 insertions(+), 120 deletions(-) diff --git a/resources/catalog/stylesheet.css b/resources/catalog/stylesheet.css index 4b32056400..55a7c9fbec 100644 --- a/resources/catalog/stylesheet.css +++ b/resources/catalog/stylesheet.css @@ -1,57 +1,10 @@ body { background-color: white; } -p.title { - margin-top:0em; - margin-bottom:0em; - text-align:center; - font-style:italic; - font-size:xx-large; - } - -p.series_id { - margin-top:0em; - margin-bottom:0em; - text-align:center; - } - a.series_id { font-style:normal; font-size:large; } -p.author { - font-size:large; - margin-top:0em; - margin-bottom:0em; - text-align: center; - text-indent: 0em; - } - -p.author_index { - font-size:large; - font-weight:bold; - text-align:left; - margin-top:0px; - margin-bottom:-2px; - text-indent: 0em; - } - -p.genres { - font-style:normal; - margin-top:0.5em; - margin-bottom:0em; - text-align: left; - text-indent: 0.0in; - } - -p.formats { - font-size:90%; - margin-top:0em; - margin-bottom:0.5em; - text-align: left; - text-indent: 0.0in; - } - /* * Minimize widows and orphans by logically grouping chunks * Some reports of problems with Sony (ADE) ereaders @@ -77,71 +30,6 @@ div.initial_letter { page-break-before:always; } -p.author_title_letter_index { - font-size:x-large; - text-align:center; - font-weight:bold; - margin-top:0px; - margin-bottom:0px; - } - -p.date_index { - font-size:x-large; - text-align:center; - font-weight:bold; - margin-top:1em; - margin-bottom:0px; - } - -p.series { - font-style:italic; - margin-top:2px; - margin-bottom:0px; - margin-left:2em; - text-align:left; - text-indent:-2em; - } - -p.series_letter_index { - font-size:x-large; - text-align:center; - font-weight:bold; - margin-top:1em; - margin-bottom:0px; - } - -p.read_book { - text-align:left; - margin-top:0px; - margin-bottom:0px; - margin-left:2em; - text-indent:-2em; - } - -p.unread_book { - text-align:left; - margin-top:0px; - margin-bottom:0px; - margin-left:2em; - text-indent:-2em; - } - -p.wishlist_item { - text-align:left; - margin-top:0px; - margin-bottom:0px; - margin-left:2em; - text-indent:-2em; - } - -p.date_read { - text-align:left; - margin-top:0px; - margin-bottom:0px; - margin-left:6em; - text-indent:-6em; - } - hr.annotations_divider { width:50%; margin-left:1em; @@ -175,6 +63,102 @@ hr.merged_comments_divider { border-left: solid white 0px; } +p.date_read { + text-align:left; + margin-top:0px; + margin-bottom:0px; + margin-left:6em; + text-indent:-6em; + } + +p.author { + font-size:large; + margin-top:0em; + margin-bottom:0em; + text-align: center; + text-indent: 0em; + } + +p.author_index { + font-size:large; + font-weight:bold; + text-align:left; + margin-top:0px; + margin-bottom:-2px; + text-indent: 0em; + } + +p.author_title_letter_index { + font-size:x-large; + text-align:center; + font-weight:bold; + margin-top:0px; + margin-bottom:0px; + } + +p.date_index { + font-size:x-large; + text-align:center; + font-weight:bold; + margin-top:1em; + margin-bottom:0px; + } + +p.formats { + font-size:90%; + margin-top:0em; + margin-bottom:0.5em; + text-align: left; + text-indent: 0.0in; + } + +p.genres { + font-style:normal; + margin-top:0.5em; + margin-bottom:0em; + text-align: left; + text-indent: 0.0in; + } + +p.series { + font-style:italic; + margin-top:0.25em; + margin-bottom:0em; + margin-left:2em; + text-align:left; + text-indent:-2em; + } + +p.series_id { + margin-top:0em; + margin-bottom:0em; + text-align:center; + } + +p.series_letter_index { + font-size:x-large; + text-align:center; + font-weight:bold; + margin-top:1em; + margin-bottom:0px; + } + +p.title { + margin-top:0em; + margin-bottom:0em; + text-align:center; + font-style:italic; + font-size:xx-large; + } + +p.wishlist_item, p.unread_book, p.read_book { + text-align:left; + margin-top:0px; + margin-bottom:0px; + margin-left:2em; + text-indent:-2em; + } + td.publisher, td.date { font-weight:bold; text-align:center; diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 092cc66ff9..b9c151309c 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -4447,20 +4447,32 @@ then rebuild the catalog.\n''').format(author[0],author[1],current_author[1]) self.generateAuthorAnchor(book['author'])) if publisher == ' ': - publisherTag = body.find('td', attrs={'class':'publisher'}) - publisherTag.contents[0].replaceWith(' ') + try: + publisherTag = body.find('td', attrs={'class':'publisher'}) + publisherTag.contents[0].replaceWith(' ') + except: + pass if not genres: - genresTag = body.find('p',attrs={'class':'genres'}) - genresTag.extract() + try: + genresTag = body.find('p',attrs={'class':'genres'}) + genresTag.extract() + except: + pass if not formats: - formatsTag = body.find('p',attrs={'class':'formats'}) - formatsTag.extract() + try: + formatsTag = body.find('p',attrs={'class':'formats'}) + formatsTag.extract() + except: + pass if note_content == '': - tdTag = body.find('td', attrs={'class':'notes'}) - tdTag.contents[0].replaceWith(' ') + try: + tdTag = body.find('td', attrs={'class':'notes'}) + tdTag.contents[0].replaceWith(' ') + except: + pass emptyTags = body.findAll('td', attrs={'class':'empty'}) for mt in emptyTags: