From 25b631efadee8dda707a06d704788366b9bfda56 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Apr 2016 09:50:49 +0530 Subject: [PATCH] Make the reset CSS styles inline --- resources/content-server/index.html | 8 +++++++- src/calibre/utils/rapydscript.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/content-server/index.html b/resources/content-server/index.html index 8a2aaf3eba..f5347addf3 100644 --- a/resources/content-server/index.html +++ b/resources/content-server/index.html @@ -6,7 +6,6 @@ -
@@ -22,9 +21,16 @@ }
+ + + + ICONS + diff --git a/src/calibre/utils/rapydscript.py b/src/calibre/utils/rapydscript.py index 2ad4b7eba0..040b36f3af 100644 --- a/src/calibre/utils/rapydscript.py +++ b/src/calibre/utils/rapydscript.py @@ -104,6 +104,8 @@ def compile_srv(): g = {'__file__': iconf} execfile(iconf, g) icons = g['merge']().encode('utf-8') + with lopen(os.path.join(base, 'resources', 'content-server', 'reset.css'), 'rb') as f: + reset = f.read() rapydscript_dir = os.path.join(base, 'src', 'pyj') rb = os.path.join(base, 'src', 'calibre', 'srv', 'render_book.py') with lopen(rb, 'rb') as f: @@ -113,7 +115,7 @@ def compile_srv(): with lopen(fname, 'rb') as f: js = compile_pyj(f.read(), fname).replace('__RENDER_VERSION__', rv).encode('utf-8') with lopen(os.path.join(base, 'index.html'), 'rb') as f: - html = f.read().replace(b'MAIN_JS', js).replace(b'ICONS', icons) + html = f.read().replace(b'RESET_STYLES', reset, 1).replace(b'ICONS', icons, 1).replace(b'MAIN_JS', js, 1) with lopen(os.path.join(base, 'index-generated.html'), 'wb') as f: f.write(html)