mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalog generation: Handle user supplied templates more robustly
This commit is contained in:
commit
f4c90184f6
@ -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;
|
||||
|
@ -4456,20 +4456,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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user