diff --git a/src/calibre/ebooks/mobi/reader/markup.py b/src/calibre/ebooks/mobi/reader/markup.py index 71b7fe549b..bf9c0e559f 100644 --- a/src/calibre/ebooks/mobi/reader/markup.py +++ b/src/calibre/ebooks/mobi/reader/markup.py @@ -334,7 +334,7 @@ def handle_media_queries(raw): return '@media screen {' return m.group() - return re.sub(r'@media\s[^{]*{', replace, raw) + return re.sub(r'@media\s[^{;]*?[{;]', replace, raw) def expand_mobi8_markup(mobi8_reader, resource_map, log): # First update all internal links that are based on offsets