![[IMG]](https://i.imgur.com/Vnlbiull.jpg?1)
![[IMG]](https://i.imgur.com/JEsirqS.png)
![[IMG]](https://i.imgur.com/V60N1j1.png)
![[IMG]](https://i.imgur.com/s4aKeru.png)
![[IMG]](https://i.imgur.com/5JsyNzK.png)
![[IMG]](https://i.imgur.com/15NgQlB.png)
![[IMG]](https://i.imgur.com/IiSoA8U.png)
![[IMG]](https://i.imgur.com/Go34k7r.png)
![[IMG]](https://i.imgur.com/dC0s84x.png)
![[IMG]](https://i.imgur.com/N4XesVx.png)
![[IMG]](https://i.imgur.com/D8wTRZI.png)
![[IMG]](https://i.imgur.com/balSg5r.png)
![[IMG]](https://i.imgur.com/wPAZTXP.png)
![[IMG]](https://i.imgur.com/Bd5VaOy.png)
<p class="chuthich">Chú Thích</p>
![[IMG]](https://i.imgur.com/E4TCSkK.png)
\^\[(.*?)\](?s)(.*?</p>)(.*?)( </body>)
[*]\2\3<p>[*]\1</p>\4
![[IMG]](https://i.imgur.com/G5xtNvP.png)
![[IMG]](https://i.imgur.com/j9qVbvU.png)
![[IMG]](https://i.imgur.com/Q13N9YN.png)
![[IMG]](https://i.imgur.com/DSakBlh.png)
![[IMG]](https://i.imgur.com/tZ5omd1.png)
![[IMG]](https://i.imgur.com/dG5ujqK.png)
![[IMG]](https://i.imgur.com/s6cD6MN.png)
![[IMG]](https://i.imgur.com/3AGBuo4.png)
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
note_number = '%d' % number
return "[" + note_number + "]"
# Ensure that when running over multiple files, the files are processed
# in the order in which they appear in the book
replace.file_order = 'spine'
![[IMG]](https://i.imgur.com/7RSoqCI.png)
![[IMG]](https://i.imgur.com/gUyHpCa.png)
![[IMG]](https://i.imgur.com/r4EKiSp.png)
![[IMG]](https://i.imgur.com/HIQBKAI.png)
![[IMG]](https://i.imgur.com/jlCMEec.png)
![[IMG]](https://i.imgur.com/DCt3XbW.png)
![[IMG]](https://i.imgur.com/Ob0Of1W.png)
![[IMG]](https://i.imgur.com/LZpmbTf.png)
![[IMG]](https://i.imgur.com/oUHPXFd.png)
![[IMG]](https://i.imgur.com/GydSCst.png)
![[IMG]](https://i.imgur.com/aNaVdKt.png)
![[IMG]](https://i.imgur.com/5ACi3Er.png)
![[IMG]](https://i.imgur.com/ALaIDCk.png)
![[IMG]](https://i.imgur.com/y5Wpqxi.png)
![[IMG]](https://i.imgur.com/Kz91ESy.png)
p{ /*Thẻ p sẽ được định dạng tổng quát cho toàn bộ ebook*/
margin:0;
text-indent: 2em;
text-align: justify;
}
div.tho p { /*ý nghĩa combo: định dạng cho các thẻ p nằm trong cặp thẻ div có class tho*/
text-indent: 0;
text-align: center;
color: blue;
font-style: italic;
}
div.chapter p{ /*ý nghĩa combo: định dạng cho các thẻ p nằm trong cặp thẻ div có class chapter*/
text-indent: 0;
text-align: center;
background-color: pink;
color: red;
font-size: 1.2em;
}
div.chapter + p{ /*ý nghĩa combo: định dạng cho thẻ p nằm ngay sau cặp thẻ div có class chapter*/
text-indent: 0;
}
div.chapter + p:first-letter{ /*ý nghĩa combo: định dạng cho ký tự đầu tiên của thẻ p nằm ngay sau cặp thẻ div có class chapter*/
font-size: 3em;
float: left;
margin: -0.2em 0em -0.2em 0em; /*top right bottom left*/
}
![[IMG]](https://i.imgur.com/4sDEiua.png)
![[IMG]](https://i.imgur.com/Q7Oi6NM.png)
![[IMG]](https://i.imgur.com/kzDPf4O.png)
![[IMG]](https://i.imgur.com/b74Wag8.png)
![[IMG]](https://i.imgur.com/UpbY57h.png)
![[IMG]](https://i.imgur.com/PQHj2XG.png)
![[IMG]](https://i.imgur.com/w9ArchF.png)
![[IMG]](https://i.imgur.com/Q3kUqvO.png)
![[IMG]](https://i.imgur.com/j9VHg94.png)
/* Styles cho trang mục lục đính vào nội dung ebook */
ul.level1 li{
text-indent: 0;
text-align: center;
font-size: 0.8em;
margin: 0.5em 0em 0.5em 0em; /*top right bottom left*/ /* xác định khoảng cách giữ các thẻ li*/
line-height: 1.5em; /* xác định khoảng cách xuống dòng cho thẻ br trong thẻ li */
}
![[IMG]](https://i.imgur.com/GceqxJv.png)
![[IMG]](https://i.imgur.com/3ls76WK.png)
![[IMG]](https://i.imgur.com/dl9yrf6.png)
![[IMG]](https://i.imgur.com/fikL5Xp.png)
![[IMG]](https://i.imgur.com/aP3cLDy.png)
..\Calibre\Calibre\app\resources\dictionaries
![[IMG]](https://i.imgur.com/oS0RrY1.png)
![[IMG]](https://i.imgur.com/TynMxao.png)
![[IMG]](https://i.imgur.com/RWynrXJ.png)
![[IMG]](https://i.imgur.com/oe8kZ9X.png)
![[IMG]](https://i.imgur.com/9ukFOWm.png)
![[IMG]](https://i.imgur.com/NELvrdw.png)
(<p>\(\*{1,}\).*?</p>|<p>\[\d+\].*?</p>)
#Find: (<p>\(\*{1,}\).*?</p>|<p>\[\d+\].*?</p>)
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
f=file_name
note=match.group(1)+f
print(note)
return ''
replace.file_order = 'spine'
![[IMG]](https://i.imgur.com/ltcNAfT.png)
![[IMG]](https://i.imgur.com/j8PFlm6.png)
![[IMG]](https://i.imgur.com/oou5xcB.png)
![[IMG]](https://i.imgur.com/MSFvSme.png)
![[IMG]](https://i.imgur.com/GNlEmzl.png)
#Tạo 1 html với tên jacket.html để ở đầu ebook.
#Gõ chữ jacket vào phần nội dung html.
#Điền thêm tên người dịch, tên của bạn, tên trang xuất bản ebook vào các mục phù hợp giữa 2 dấu nháy đơn.
#Find: (jacket) và Replace all
import datetime
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
title=metadata.title
author='Tác giả: '+metadata.authors[0]
trans='Người dịch: '+'tên dịch giả'
publisher='Người tạo ebook: '+'tên của bạn'
pubdate='Ngày hoàn thành: '+'{:%d/%m/%Y}'.format(datetime.date.today())
footer='trang ebook của bạn'
jacket='''
<style>
.cbj_banner {
background: #eee;
color: black;
border: thin solid black;
margin: 1em;
padding: 1em;
border-radius:8px;
}
/*
** Title
*/
table.cbj_header td.cbj_title {
font-size: 1.5em;
font-style: italic;
text-align: center;
}
/*
** Author
*/
table.cbj_header td.cbj_author {
text-align: center;
}
/*
** Publisher/published
*/
table.cbj_header td.cbj_pubdata {
text-align: center;
}
/*
** Table containing Rating and Tags
*/
table.cbj_header {
width: 100%;
}
/*
** General formatting for banner labels
*/
table.cbj_header td.cbj_label {
font-family: sans-serif;
text-align: right;
width: 33%;
}
/*
** General formatting for banner content
*/
table.cbj_header td.cbj_content {
font-family: sans-serif;
text-align: left;
width:67%;
}
/*
** Metadata divider
*/
hr.metadata_divider {
width:90%;
margin-left:5%;
border-top: solid white 0px;
border-right: solid white 0px;
border-bottom: solid black 1px;
border-left: solid white 0px;
}
/*
** To skip a banner item (Series|Published|Rating|Tags),
** edit the appropriate CSS rule below.
*/
table.cbj_header tr.cbj_series {
/* Uncomment the next line to remove 'Series' from banner section */
/* display:none; */
}
table.cbj_header tr.cbj_pubdata {
/* Uncomment the next line to remove 'Published (year of publication)' from banner section */
/* display:none; */
}
hr {
/* This rule controls formatting for any hr elements contained in the jacket */
border-top: 0px solid white;
border-right: 0px solid white;
border-bottom: 2px solid black;
border-left: 0px solid white;
margin-left: 10%;
width: 80%;
}
.cbj_footer {
font-family: sans-serif;
font-size: 0.8em;
margin-top: 8px;
text-align: center;
}
.cbj_comments {
font-family: sans-serif;
}
</style>
<div class="cbj_banner">
<table class="cbj_header">
<tbody><tr>
<td class="cbj_title" colspan="2">'''+title+'''</td>
</tr>
<tr>
<td class="cbj_author" colspan="2">'''+author+''' | '''+trans+'''</td>
</tr>
<tr>
<td class="cbj_pubdata" colspan="2">'''+publisher+'''</td>
</tr>
<tr>
<td class="cbj_pubdata" colspan="2">'''+pubdate+'''</td>
</tr>
<tr>
<td class="cbj_author" colspan="2"><hr class="metadata_divider"/></td>
</tr>
</tbody></table>
<div class="cbj_footer">'''+footer+'''</div>
</div>
'''
return jacket
replace.file_order = 'spine'
![[IMG]](https://i.imgur.com/uOYfu0z.png)
![[IMG]](https://i.imgur.com/6Cke8bg.png)
![[IMG]](https://i.imgur.com/rfwAhyS.png)
![[IMG]](https://i.imgur.com/GvZ00Hf.png)
Bài mới