Edit Book: Do not condense CSS rules when saving AZW3 files regardless of the value of Preferences->Common Options->Look & Feel->Expand CSS

This commit is contained in:
Kovid Goyal 2017-01-26 08:45:12 +05:30
parent 27e92631c7
commit b447e85bf0

View File

@ -155,11 +155,12 @@ class KF8Writer(object):
def extract_css_into_flows(self): def extract_css_into_flows(self):
inlines = defaultdict(list) # Ensure identical <style>s not repeated inlines = defaultdict(list) # Ensure identical <style>s not repeated
sheets = {} sheets = {}
passthrough = getattr(self.opts, 'mobi_passthrough', False)
for item in self.oeb.manifest: for item in self.oeb.manifest:
if item.media_type in OEB_STYLES: if item.media_type in OEB_STYLES:
sheet = self.data(item) sheet = self.data(item)
if not self.opts.expand_css and hasattr(item.data, 'cssText'): if not passthrough and not self.opts.expand_css and hasattr(item.data, 'cssText'):
condense_sheet(sheet) condense_sheet(sheet)
sheets[item.href] = len(self.flows) sheets[item.href] = len(self.flows)
self.flows.append(sheet) self.flows.append(sheet)
@ -495,4 +496,3 @@ class KF8Writer(object):
def create_kf8_book(oeb, opts, resources, for_joint=False): def create_kf8_book(oeb, opts, resources, for_joint=False):
writer = KF8Writer(oeb, opts, resources) writer = KF8Writer(oeb, opts, resources)
return KF8Book(writer, for_joint=for_joint) return KF8Book(writer, for_joint=for_joint)