[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

l10n-check 0.2.3



Bonjour,

après utilisation avec la dwn 3, voici quelques nouvelles corrections.

journal des modifications :
version 0.2.3
  - add: letter next to the text to choose (easier for long lines)
  - remove: old comment
  - bug fix:
    - change: match regexp for comments

La rustine est attachée, le script complet ici :
http://perso.wanadoo.fr/nico.bertol/l10n-check/l10n-check.txt

À la demande de Denis, un tarball est aussi disponible ici :
http://perso.wanadoo.fr/nico.bertol/l10n-check/l10n-check.tar.gz
(n'oubliez pas le fichier caché .l10n-check).

J'ai aussi attaché le nouveau fichier de règles wml.


Nicolas
-- 
--- l10n-check_0.2.2.txt	Mon Jan 21 09:10:16 2002
+++ l10n-check_0.2.3.txt	Mon Jan 21 21:52:06 2002
@@ -104,7 +104,7 @@
 #		  'post_fix'    => [ post_fix0, ... ] },
 #   ... }
 
-my $version = "0.2.2";
+my $version = "0.2.3";
 
 # Test if configuration as been made
 my @dir=split("/", $rules_dir);		# get all subdirs
@@ -161,6 +161,7 @@
 
 	debug 1, "filename $file";
 
+	return "wml" if ($file =~ /.wml.relu$/);
 	return "wml" if ($file =~ /.wml$/);
 
 	open FILE, $file	|| suicide "Can't open $file: $!";
@@ -247,7 +248,7 @@
 	debug 3, "choose correction";
 
 	my $letter = "a";					# letter counter for choice
-	my $sp  = " " x length($l); 				# space for nice presentation
+	my $sp;							# space for nice presentation
 	my $s = length $c;
 	   $s = $s<length($_)?length($_):$s foreach(@choices);	# maximum choice length
 
@@ -255,10 +256,18 @@
 
 	if ($align) {			# write choices
 		print "$LC>$NC$l$HC$c".(" " x ($s-length($c)))."$NC$r\n";
-		(print ($LC.$letter++.$NC.$sp.$HC.$_.(" " x ($s-length($_))).$NC.$r."\n")) foreach (@choices);
+		foreach (@choices) {
+			length($l) < 3 ? ($sp = " " x  length($l))		   :
+					 ($sp = " " x (length($l) - 2).$letter." ");
+			print ($LC.$letter++.$sp.$HC.$_.(" " x ($s-length($_))).$NC.$r."\n");
+		}
 	} else {
 		print "$LC>$NC$l$HC$c$NC\n";
-		(print ($LC.$letter++.$NC.$sp.$HC.$_.$NC.$r."\n")) foreach (@choices);
+		foreach (@choices) {
+			length($l) < 3 ? ($sp = " " x  length($l))		   :
+					 ($sp = " " x (length($l) - 2).$letter." ");
+			print ($LC.$letter++.$sp.$HC.$_.$NC.$r."\n");
+		}
 	}
 
 	$letter = chr(ord($letter)-1);				# last available choice letter
@@ -411,7 +420,7 @@
 			my $r;
 
 			if ($in_comment) {
-				/($Comments->{$id}{'stop'})/;	# search stop comment tag
+				m/$Comments->{$id}{'stop'}/;	# search stop comment tag
 				($l, $c, $r) = ($`, $&, $');
 				$l = $_ unless $c;			# all is comment if no tag found
 				$c = '' unless $c;			# no tag
@@ -423,7 +432,7 @@
 			} else {
 				foreach my $i (keys %{ $Comments }) {
 					pos $_ = 0;
-					/($Comments->{$i}{'start'})/;	# search start comment tag
+					m/$Comments->{$i}{'start'}/;	# search start comment tag
 					($l, $c, $r) = ($`, $&, $');
 					$id = $i;
 					last if $&;
@@ -432,7 +441,6 @@
 				$l = $_ unless ($l || $c);			# all is string if no tag found
 				$c = '' unless $c;			# no tag
 				$r = '' unless $r;			# nothing more
-				#$fixed .= parse_line($l);		# add checked string
 				push (@comments, parse_line($l));	# add checked string
 				$fixed .= pop @comments;
 				$fixed .=	     $c;		# add start tag
# comment rules
comment = "comment"
	start = "^#"
	stop  = ".*$"
comment = "tag"
	start = "<"
	stop  = ">"

# rules for wml files

rule = "(\s+)?:"
id   = "url"
		 pre_valid  = "(ftp|http|file)"
		post_valid  = "//"
id   = "espace"
		 pre_valid  = "&nbsp;"
		post_valid  = "(\s|$)"
 pre_hint   = "Espace insécable avant les deux-points, cf. FAQ § 5.1"
post_hint   = "Espace normale après les deux-points, cf. FAQ § 5.1"
 pre_fix    = "&nbsp;:"
 pre_insert = "&nbsp;"
post_insert = " "

rule = "(\s+)?;"
id   = "mot clé"
		 pre_valid  = "&\w+"
id   = "espace"
		 pre_valid  = "&nbsp;"
		post_valid  = "(\s|$)"
 pre_hint   = "Espace insécable avant le point-virgule, cf. FAQ § 5.1"
post_hint   = "Espace normale après le point-virgule, cf. FAQ § 5.1"
 pre_fix    = "&nbsp;;"
 pre_insert = "&nbsp;"
post_insert = " "

rule = "(\s+)?!"
id   = "espace"
		 pre_valid  = "&nbsp;"
		post_valid  = "(\s|$)"
 pre_hint   = "Espace insécable avant le point d'exclamation, cf. FAQ § 5.1"
post_hint   = "Espace normale après le point d'exclamation, cf. FAQ § 5.1"
 pre_fix    = "&nbsp;!"
 pre_insert = "&nbsp;"
post_insert = " "

rule = "(\s+)?\?"
id   = "espace"
		 pre_valid  = "&nbsp;"
		post_valid  = "(\s|$)"
 pre_hint   = "Espace insécable avant le point d'interrogation, cf. FAQ § 5.1"
post_hint   = "Espace normale après le point d'interrogation, cf. FAQ § 5.1"
 pre_fix    = "&nbsp;?"
 pre_insert = "&nbsp;"
post_insert = " "

rule = "«(\s+)"
id   = "espace"
		post_valid  = "&nbsp;"
post_hint   = "Espace insécable après « « », cf. FAQ § 5.1"
post_fix    = "«&nbsp;"
post_insert = "&nbsp;"

rule = "(\s+)?»"
id   = "espace"
		  pre_valid = "&nbsp;"
 pre_hint   = "Espace insécable avant « » », cf. FAQ § 5.1"
 pre_fix    = "&nbsp;»"
 pre_insert = "&nbsp;"


Reply to: