diff --git a/setup.py b/setup.py index ab072e7b2e..68935a5fbd 100644 --- a/setup.py +++ b/setup.py @@ -240,6 +240,12 @@ if sys.hexversion < 0x2050000: print >> sys.stderr, "If you are using easy_install, try easy_install-2.5" sys.exit(1) +try: + from PIL import Image +except ImportError: + import Image + print >>sys.stderr, "You do not have the Python Imaging Library correctly installed." + sys.exit(1) setup( name='libprs500', diff --git a/src/libprs500/lrf/html/convert_from.py b/src/libprs500/lrf/html/convert_from.py index 8141976c27..7238b6b722 100644 --- a/src/libprs500/lrf/html/convert_from.py +++ b/src/libprs500/lrf/html/convert_from.py @@ -582,7 +582,6 @@ class HTMLConverter(object): align = "foot" elif val == "center": align = "center" - css.pop('text-align') if align != self.current_block.textStyle.attrs['align']: self.current_para.append_to(self.current_block) self.current_block.append_to(self.current_page) @@ -616,14 +615,15 @@ class HTMLConverter(object): print >>sys.stderr, err def sanctify_css(self, css): - """ Make css safe for use in a SPAM Xylog tag """ + """ Return a copy of C{css} that is safe for use in a SPAM Xylog tag """ + css = copy.copy(css) for key in css.keys(): test = key.lower() - if test.startswith('margin') or \ + if test.startswith('margin') or test.startswith('text') or \ 'padding' in test or 'border' in test or 'page-break' in test \ or test.startswith('mso') or test.startswith('background')\ - or test in ['color', 'display', 'text-decoration', \ - 'letter-spacing', 'text-autospace', 'text-transform', + or test in ['color', 'display', \ + 'letter-spacing', 'font-variant']: css.pop(key) return css @@ -867,7 +867,6 @@ class HTMLConverter(object): self.lstrip_toggle = True if tag_css.has_key('text-indent'): indent = Span.unit_convert(tag_css['text-indent']) - tag_css.pop('text-indent') if not indent: indent=0 else: diff --git a/src/libprs500/lrf/html/demo/demo.html b/src/libprs500/lrf/html/demo/demo.html index 22992c5636..0de23a3e09 100644 --- a/src/libprs500/lrf/html/demo/demo.html +++ b/src/libprs500/lrf/html/demo/demo.html @@ -4,7 +4,7 @@ .toc { page-break-after: always; text-indent: 0em; } -

Demo of html2lrf

+

Demo of html2lrf

This file contains a demonstration of the capabilities of html2lrf, the HTML to LRF converter from libprs500. To obtain libprs500 visit https://libprs500.kovidgoyal.net

@@ -70,7 +70,7 @@

Inline images

- Here I demonstrate the use of inline images in the midst of text. Here is a small image embedded in a sentence. Now we have a slightly larger image that is automatically put in its own block and finally we have a large image which is automatically placed on a page by itself and prevented from being autoscaled when the user changes from S to M to L. Try changing sizes and see how the different embedding styles behave. + Here I demonstrate the use of inline images in the midst of text. Here is a small image embedded in a sentence. Now we have a slightly larger image that is automatically put in its own block and finally we have a large image which is automatically placed on a page by itself and prevented from being autoscaled when the user changes from S to M to L. Try changing sizes and see how the different embedding styles behave.