Adjust for enchanted library stories

This commit is contained in:
Joakim Soderlund 2022-03-16 13:15:28 +01:00
parent b39c916da3
commit ef541b799f
3 changed files with 6 additions and 7 deletions

View file

@ -46,7 +46,7 @@ TARGET = 'target.epub'
TIMEOUT = 300 TIMEOUT = 300
PROGRAM = 'ebook-convert' PROGRAM = 'ebook-convert'
ARGUMENTS = ('--no-default-epub-cover',) ARGUMENTS = ('--cover', 'cover.jpg')
proc = partial(run, stderr=STDOUT, timeout=TIMEOUT, check=True) proc = partial(run, stderr=STDOUT, timeout=TIMEOUT, check=True)

View file

@ -8,15 +8,12 @@
<body> <body>
{%- autoescape false %} {%- autoescape false %}
{%- if authors_note_position == 'top' %} {%- if authors_note_position == 'top' %}
<h1>{{ "Author's Note" | e }}</h1> <h2>{{ "Author's Note" | e }}</h2>
<div id='authors-note'>{{ authors_note_html }}</div> <div id='authors-note'>{{ authors_note_html }}</div>
<hr/>
{%- endif %} {%- endif %}
<h1>{{ title | e }}</h1>
<div id='content'>{{ content_html }}</div> <div id='content'>{{ content_html }}</div>
{%- if authors_note_position == 'bottom' %} {%- if authors_note_position == 'bottom' %}
<hr/> <h2>{{ "Author's Note" | e }}</h2>
<h1>{{ "Author's Note" | e }}</h1>
<div id='authors-note'>{{ authors_note_html }}</div> <div id='authors-note'>{{ authors_note_html }}</div>
{%- endif %} {%- endif %}
{%- endautoescape %} {%- endautoescape %}

View file

@ -30,7 +30,7 @@ from urllib.parse import unquote
from zipfile import ZipFile from zipfile import ZipFile
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup, Tag
from fimfarchive.exceptions import StorySourceError from fimfarchive.exceptions import StorySourceError
from fimfarchive.stories import Story from fimfarchive.stories import Story
@ -80,6 +80,8 @@ class ImageLoader:
else: else:
tag.attrs['src'] = self.fetch(url) tag.attrs['src'] = self.fetch(url)
tag.wrap(Tag(name='center'))
return dom.decode_contents().encode() return dom.decode_contents().encode()
def entries(self) -> Iterator[Tuple[str, bytes]]: def entries(self) -> Iterator[Tuple[str, bytes]]: