[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice
Subject: Re: patch: Perl again ;)
From: Werner Trobin <wtrobin () mandrakesoft ! com>
Date: 2000-08-31 5:26:12
[Download RAW message or body]
David Faure wrote:
>
> At 20:49 30/08/00 +0200, you wrote:
> >Hi!
> >
> >I got my hands on a few old files and found a few bugs.
> >(the fixes are already in CVS). However, the loading
> >still didn't work, so I started to hack the conversion
> >script again.
> >
> >This works for me and as it looks it can't harm and other
> >files. The problem is that it doesn't handle xpm properly
> >(dunno why). I'll check that now.
>
> I'm surprised by this patch, because it looks a change (in kpr's
> image collection) that would be anterior to the new textobject ?
> Why didn't everyone have a problem with that change then ?
> Are you sure kpresenter doesn't have support for loading both
> types of file formats ? I thought so...
Well - IMHO KPresenter has problems with loading "medieval" files
(i.e. before KPresenter fully supproted the tgz storage stuff).
As far as I can tell KoStore issued a *lot* of warnings about all
the files it couldn't find. Then I found out the way it's done
(pheew! ;) and decided that this is a job for the Perl script,
because these files get converted anyways. In the <PIXMAPS> tag
all the image <KEY>s are mapped to a internal filename in the
storage. These specific generation of files has no name attribute,
so I simply create one. This attribute is used to load the file
from the storage. It consists of: The file's URL, the filename
attrib of the KEY tag, a "_", and the date/time (nearly in the
standard format, only some spaces are missing in some cases).
> [...]
> > {
> >+ # store the url because this is a prart of the "path" for the images
> >+ $url=$1 if(m/url=\"(.*)\"/);
> I think this should be
>
> $url=$1 if(m/url=\"([^\"]*)\"/);
>
> otherwise with
> url="blah" key="value"
> you'll get in $1:
> blah" key="value
Okay, I'll change that. I didn't notice that because url is always
the last attribute. :)
::snip::
> >+ if(/\s+name=\"/)
> >+ {
> >+ # Aha - this file is not version 2 but was created as "proper"
> tgz storage... medieval times :)
> >+ print "Found a name attribute, no need to create one.\n";
> >+ }
> >+ elsif (/<KEY(.*)\/>/)
> >+ {
> >+ # Okay - plain old kpresenter magic...
> >+ $key=$1;
> >+ # Note: The .*? is needed because it would be too greedy otherwise
> see above... .*? looks very strange to me. What does it do ? :)
Okay ;)
The default setting for those REs is that they are "greedy."
This means they try to match as much as the can.
For example:
Without that .*? matching this line:
a="x" b="y" c="z"
would result in x" b="y" c="z.
However - this ? makes the RE non-greedy. This means it matches
only as much as it "has" to. In this case this would simply
result in:
x
That's exactly what we want here (and above ;)
> >+ # Okay. Now let's cat the whole caboodle...
> /msg apt dict caboodle ? :-)
ca·boo·dle
n. Informal
1.The lot, group, or bunch: donated the whole caboodle.
2.A crowd or collection of people.
> Wow, you're getting very good at perl ! :)
Hehe - thanks to Carsten!
Please send some kpr files or post URLs where I can find
them. ;)
--
Werner Trobin - wtrobin@mandrakesoft.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic