Allow text-indent and text-align to be inherited.

This commit is contained in:
Kovid Goyal 2007-05-09 23:32:33 +00:00
parent e383232fe9
commit b1ee960066
3 changed files with 13 additions and 8 deletions

View File

@ -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',

View File

@ -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:

View File

@ -4,7 +4,7 @@
.toc { page-break-after: always; text-indent: 0em; }
</style>
</head>
<h1>Demo of <span style='font-family:monospace'>html2lrf</span></h1>
<h1>Demo of <span style='font-family:monospace'>html2lrf</span></h1>
<p>
This file contains a demonstration of the capabilities of <span style='font-family:monospace'>html2lrf,</span> the HTML to LRF converter from <em>libprs500.</em> To obtain libprs500 visit <span style='font:sans-serif'>https://libprs500.kovidgoyal.net</span>
</p>
@ -70,7 +70,7 @@
<h2><a name='images'>Inline images</a></h2>
<p>
Here I demonstrate the use of inline images in the midst of text. Here is a small image <img src='small.jpg' /> embedded in a sentence. Now we have a slightly larger image that is automatically put in its own block <img src='medium.jpg' /> 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. <img src='large.jpg' />
Here I demonstrate the use of inline images in the midst of text. Here is a small image <img src='small.jpg' /> embedded in a sentence. Now we have a slightly larger image that is automatically put in its own block <img style="text-align:center" src='medium.jpg' /> 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. <img src='large.jpg' />
</p>
<p class='toc'>
<hr />