mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-06-07 13:15:53 +02:00
Added background paper to epub output.
This commit is contained in:
+11
-1
@@ -1,6 +1,7 @@
|
||||
from typing import Mapping
|
||||
from html.parser import HTMLParser
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from ebooklib import epub, ITEM_STYLE
|
||||
from docutils import core
|
||||
@@ -58,8 +59,17 @@ def create_epub(
|
||||
content=style,
|
||||
)
|
||||
book.add_item(css)
|
||||
toc = ["nav"]
|
||||
# Add paper background
|
||||
with open(Path(__file__).parent / "forms/paper.jpg", mode="rb") as fp:
|
||||
bg_img = fp.read()
|
||||
paper = epub.EpubItem(
|
||||
file_name="images/paper.jpg",
|
||||
media_type="image/jpeg",
|
||||
content=bg_img,
|
||||
)
|
||||
book.add_item(paper)
|
||||
# Create the separate chapters
|
||||
toc = ["nav"]
|
||||
html_chapters = []
|
||||
for chap_title, content in chapters.items():
|
||||
chap_fname = chap_title.replace(" - ", "-").replace(" ", "_").lower()
|
||||
|
||||
@@ -5,7 +5,8 @@ h1, h2, h3, h4, h5, h6 {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
body {
|
||||
background: #f4ecdb;
|
||||
/* background: #f4ecdb; */
|
||||
background-image: url("../images/paper.jpg");
|
||||
}
|
||||
table {
|
||||
/* background: #ECEEE3; */
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user