Hi,
I finally got around to getting into the parser, and I added a few lines
to <p> handling. I mostly just ripped it out of the <div> handling, so I
may have been a little over-enthusiastic about keeping the add_vspace from
the <div> code.
Anyway, the changes seem to work well for the documents I tested it on,
mainly with <p align="center"> tags.
Nick
--
#include<stdio.h> /* SigMask 0.3 (sig.c) 19990429 PUBLIC DOMAIN "Compile Me" */
int main(c,v)char *v;{return !c?putchar(*v-1)&&main(0,v+ /* Tweaks welcomed. */
1):main(0,"Ojdl!Wbshjti!=obwAqbusjpu/ofu?\v\1");} /* build: cc -o sig sig.c */
*** TextParser.py.orig Wed May 23 10:33:19 2001
--- TextParser.py Wed May 23 10:10:14 2001
***************
*** 1058,1069 ****
def start_p (self, attributes):
self.do_p (attributes)
-
def end_p (self):
! pass
!
def do_p (self, attributes):
if self._needs_newpara ():
--- 1058,1084 ----
def start_p (self, attributes):
+ attribs = _list_to_dict (attributes)
+ alignment = self._doc.get_alignment ()
+ if attribs.has_key ('align'):
+ align = string.lower (attribs['align'])
+ if align == 'left':
+ alignment = 0
+ elif align == 'center':
+ alignment = 2
+ elif align == 'right':
+ alignment = 1
+ elif align == 'justify':
+ alignment = 3
+ else:
+ print "Unknown alignment '%s' requested in <div>" % align
+ self._doc.add_vspace (0)
+ self._doc.set_alignment (alignment)
self.do_p (attributes)
def end_p (self):
! self._doc.add_vspace (0)
! self._doc.unset_alignment (value=None)
def do_p (self, attributes):
if self._needs_newpara ():