[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice
Subject: patch: KPresenter conversion script...
From: Werner Trobin <wtrobin () mandrakesoft ! com>
Date: 2000-08-29 8:43:12
[Download RAW message or body]
Hi!
This one's funky:
In the old file format Reggie used horzAlign="a" where
a=0 was left, a=1 was center, and a=2 was right alignment.
In the new file format he uses align="b". b is a
Qt::AlignmentFlags variable (i.e. 1=left, 2=right,
4=hcenter)
The patch ensures that it's converted correctly (and it
works, I've tested it). However, I'm sure I can save a
few lines so please enlighten me!
Disclaimer: I learned Perl last Sunday afternoon :p
BTW: Please don't suggest:
tr/01/14/ if s/<blah>/<foo>/ because this doesn't work
(there are other values which get tr'ed too then. Yes,
I tried that one first ;)
--
Werner Trobin - wtrobin@mandrakesoft.com
["kpresenter.diff" (text/plain)]
Index: kprconverter.pl
===================================================================
RCS file: /home/kde/koffice/kpresenter/kprconverter.pl,v
retrieving revision 1.4
diff -b -u -p -r1.4 kprconverter.pl
--- kprconverter.pl 2000/07/17 00:27:55 1.4
+++ kprconverter.pl 2000/08/29 08:34:50
@@ -23,6 +23,12 @@ while (<INPUT>)
{
$insideParag=1;
s/<PARAGRAPH /<P /;
+ # In the old format we had horzAlign="[0|1|2]" 0=left, 1=center, 2=right
+ # In the new one it's align="..." and uses the Qt::AlignmentFlags enums.
+ # Qt::AlignLeft=1, AlignRight=2, AlignHCenter=4
+ $alignment=$1 if(/horzAlign=(\"[0-2]+\")/);
+ $alignment =~ tr/01/14/;
+ s/horzAlign=\"[0-2]+\"/align=$alignment/;
s/>$/ type=$objType>/;
}
elsif (/<\/PARAGRAPH>/)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic