def get_cover_html(img_w, img_h):
img_htmls = []
img_msg = ' \n'
img_htmls.append('\n')
img_htmls.append('\n')
img_htmls.append('\n')
img_htmls.append('
\n')
img_htmls.append(' Cover\n')
img_htmls.append('\n')
img_htmls.append('\n')
img_htmls.append(' \n')
img_htmls.append(' \n')
img_htmls.append('
\n')
img_htmls.append('\n')
img_htmls.append('')
return img_htmls
def text2htmls(chap_name, text):
text_lines = text.split('\n')
text_body = []
text_body.append('\n')
text_body.append('' + chap_name + '
\n')
for text_line in text_lines:
if text_line.startswith('[img:'):
img_no = text_line[5:7]
text_line_html = f'
\n'
else:
text_line_html = '' + text_line + '
\n'
text_body.append(text_line_html)
text_body.append('\n')
text_head = []
text_head.append('\n')
text_head.append('\n')
text_head.append('\n')
text_head.append('\n')
text_head.append(''+ chap_name+'\n')
text_head.append('\n')
text_head.append('\n')
text_htmls = text_head + text_body + ['']
return text_htmls
def get_toc_html(title, chap_names):
toc_htmls = []
toc_htmls.append('\n')
toc_htmls.append('\n\n')
toc_htmls.append('\n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append('\n')
toc_htmls.append(' '+ title +'\n')
toc_htmls.append('\n')
toc_htmls.append('\n')
for chap_no, chap_name in enumerate(chap_names):
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' '+ chap_name +'\n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append(' \n')
toc_htmls.append('\n')
toc_htmls.append('')
return toc_htmls
def get_content_html(title, author, num_chap, num_img, img_exist=False):
content_htmls = []
content_htmls.append('\n')
content_htmls.append('\n')
content_htmls.append(' \n')
content_htmls.append(' urn:uuid:942b8224-476b-463b-9078-cdfab0ee2686\n')
content_htmls.append(' zh\n')
content_htmls.append(' '+ title +'\n')
content_htmls.append(' '+ author +'\n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
if img_exist:
content_htmls.append(' \n')
for chap_no in range(num_chap):
content_htmls.append(' - \n')
for img_no in range(num_img):
content_htmls.append('
- \n')
content_htmls.append('
\n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
for chap_no in range(num_chap):
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append(' \n')
content_htmls.append('\n')
return content_htmls
def get_container_html():
container_htmls = []
container_htmls.append('\n')
container_htmls.append('\n')
container_htmls.append(' \n')
container_htmls.append(' \n')
container_htmls.append(' \n')
container_htmls.append('\n')
return container_htmls
def get_color_html(colorimg_num):
color_htmls = []
color_htmls.append('\n')
color_htmls.append('\n')
color_htmls.append('\n')
color_htmls.append(' 彩插\n')
color_htmls.append('\n')
color_htmls.append('\n')
for i in range(1, colorimg_num):
color_htmls.append('
\n')
color_htmls.append('\n')
color_htmls.append('')
return color_htmls
def check_chars(win_chars):
win_illegal_chars = '?*"<>|:/'
new_chars = ''
for char in win_chars:
if char in win_illegal_chars:
new_chars += '\u25A0'
else:
new_chars += char
return new_chars