[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu
Subject:    [kde-edu]: [KTouch] perl-generator
From:       "Julien Richard-Foy" <julien.rf () no-log ! org>
Date:       2008-09-26 16:58:41
Message-ID: 200809261858.41556.julien.rf () no-log ! org
[Download RAW message or body]

I forward a previous mail sent to the current maintainer of KTouch with no 
answer...
I hope here is the right place.
Julien

----------  Message transmis  ----------

Sujet : [KTouch] perl-generator
Date : dimanche 7 septembre 2008
De : "Julien Richard-Foy" <julien.rf@no-log.org>
À : haavard@users.sourceforge.net

Hi,

I played a bit with the perl training generator and found one bug : the end 
tag "</KTouchLecture>" was not right (the "/" was missing).
BTW I added the ability to specify the title of a training file directly from 
the configuration file.

I found that the python generator was really interesting too, especially with 
the "type" parameter for each level, specifying the kind of word that has to 
be generated. I don't know Perl at all, since I was not able to add this 
feature to the current perl generator (and even if I was able to do it, I did 
not find a smart way to modify the configuration files format without breaking 
the curent format).
Do you plan to improve the perl generator ? Or maybe I could modify the python 
generator to produce the current xml format... But I think it would be nicer 
if we could have only one generator to maintain.

In addition, I got troubles with non-ascii characters when I tried to generate 
training files. My conf file is encoded in utf-8, my console too, but when the 
file is generated I see wrong characters instead of non-ascii characters. 
Where's my mistake ? I joined the conf file and the generated training file to 
this email. Maybe you could help me...

Greetings,
Julien Richard-Foy

-------------------------------------------------------

["fr_bepo2.ktouch.xml" (application/xml)]
["conf" (text/plain)]

length-of-line 20
number-of-line 5
title Français bépo (auto-généré)

te
si
ru
na
vo
TSRNEIUAVO
dp
DP
lé
LÉ
jb
JB
c,è
C;È
mz
MZ
çw
ÇW
'.
?:
kq
QK
gx
GX
yh
YH
à f
ÀF
êîûâëï

["patch.diff" (text/x-patch)]

Index: ktouch-gen.pl
===================================================================
--- ktouch-gen.pl	(révision 857995)
+++ ktouch-gen.pl	(copie de travail)
@@ -6,6 +6,7 @@
 # default values
 $length_of_line = 40;
 $number_of_line = 10;
+$title = "Put your title here";
 
 
 # genword( accumulated, core )
@@ -108,7 +109,7 @@
 {
     return
 	"<KTouchLecture>\n".
-	"    <Title>Put your title here</Title>\n".
+	"    <Title>".$title."</Title>\n".
 	"    <Comment>KTouch training file generated ".localtime(time())."\n".
 	"Perl Script written by Steinar Theigmann &amp; Håvard Frøiland.</Comment>\n\n";
 }
@@ -145,6 +146,10 @@
     {
 	$number_of_line = $_;
     }
+    elsif(s/title//)
+    {
+	$title = $_;
+    }
     elsif($_) # Add to config if not empty
     {
 	push @config,$_;
@@ -183,4 +188,4 @@
 }
 
 
-print "<KTouchLecture>\n";
+print "</KTouchLecture>\n";


_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic