<p class="chuthich">Chú Thích</p>
\^\[(.*?)\](?s)(.*?</p>)(.*?)( </body>)
[*]\2\3<p>[*]\1</p>\4
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'
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*/ }
/* 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 */ }
..\Calibre\Calibre\app\resources\dictionaries
(<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'
#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'
Bài mới