source: divers/txt2html@ 234

Last change on this file since 234 was 234, checked in by garnier, 19 years ago

ajout de txt2html

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/sh
2#Ce script txt2html permet de convertir tous les caractères nom
3#html d'un fichier en format HTML.
4
5#Usage : source txt2html fichier
6#"source" est indispensable pour que le script est access au path.
7#Un "fichier.old" est créé systématiquement.
8
9if [ -f txt2html_convert.sed ]; then
10 rm txt2html_convert.sed
11fi
12echo "s/\é/\&eacute\;/g
13s/\Ú/\&egrave\;/g
14s/\Ã/\&agrave\;/g
15s/\Ë/\&Agrave\;/g
16s/\ˆ/\&agrave\;/g
17s/\à/\&agrave\;/g
18s/\‡/\&aacute\;/g
19s/\å/\&Acirc\;/g
20s/\‰/\&acirc\;/g
21s/\â/\&acirc\;/g
22s/\Ì/\&Atilde\;/g
23s/\‹/\&atilde\;/g
24s/\À/\&Aacute\;/g
25s/\Â/\&1circ\;/g
26s/\/\&Aring\;/g
27s/\Œ/\&aring\;/g
28s/\€/\&Auml\;/g
29s/\Š/\&auml\;/g
30s/\á/\&agrave\;/g
31s/\ä/\&auml\;/g
32s/\®/\&AElig\;/g
33s/\Ÿ/\&aelig\;/g
34s/\‚/\&Ccedil\;/g
35s/\Ç/\&Ccedil\;/g
36s/\/\&ccedil\;/g
37s/\ç/\&ccedil\;/g
38s/\ƒ/\&Eacute\;/g
39s/\Ž/\&eacute\;/g
40s/\é/\&eacute\;/g
41s/\/\&egrave\;/g
42s/\è/\&egrave\;/g
43s/\æ/\&Ecirc\;/g
44s/\/\&ecirc\;/g
45s/\ê/\&ecirc\;/g
46s/\è/\&Euml\;/g
47s/\‘/\&euml\;/g
48s/\ë/\&euml\;/g
49s/\’/\&iacute\;/g
50s/\“/\&igrave\;/g
51s/\”/\&icirc\;/g
52s/\î/\&icirc\;/g
53s/\•/\&iuml\;/g
54s/\ï/\&iuml\;/g
55s/\ñ/\&ntilde\;/g
56s/\–/\&tilde\;/g
57s/\~/\&tilde\;/g
58s/\—/\&oacute\;/g
59s/\˜/\&ograve\;/g
60s/\™/\&ocirc\;/g
61s/\ô/\&ocirc\;/g
62s/\›/\&otilde\;/g
63s/\õ/\&otilde\;/g
64s/\š/\&ouml\;/g
65s/\ö/\&ouml\;/g
66s/\œ/\&uacute\;/g
67s/\/\&ugrave\;/g
68s/\†/\&Uuml\;/g
69s/\Ÿ/\&uuml\;/g
70s/\ü/\&uuml\;/g
71s/\ž/\û\;/g
72s/\û/\û\;/g
73s/\~/\&#126\;/g
74s/\¢/\&#162\;/g
75s/\£/\&#163\;/g
76s/\€/\&#167\;/g
77s/\¬/\&#168\;/g
78s/\©/\&copy\;/g
79s/\»/\&#170\;/g
80s/\š/\&reg\;/g
81s/\ø/\&#175\;/g
82s/\±/\&#177\;/g
83s/\«/\&#180\;/g
84s/\Š/\&#182\;/g
85" > txt2html_convert.sed
86
87if [ -d "$1" ] ; then
88 echo "Conversion d'accents pour tous les fichiers du dossier actuel"
89 for i in `ls $1`
90 do
91 if [ -f $1/$i ]; then
92 mv $1/$i $1/$i.old
93 sed -f "txt2html_convert.sed" "$1/$i.old" > "$1/$i"
94 count=`diff $1/$i.old $1/$i | wc -c`
95 if [ $count == "0" ] ; then
96 echo "$1/$i : 0 caracteres convertis"
97 rm $i.old
98 else
99 echo "$1/$i : Caracteres convertis, un fichier $1/$i.old a ete genere"
100 fi
101 fi
102 done
103else
104 echo "Conversion d'accents pour le fichier $*"
105 mv $* $*.old
106 sed -f txt2html_convert.sed "$*.old" > "$*"
107 count=`diff $*.old $* | wc -c`
108 if [ $count == "0" ] ; then
109 echo "$* : 0 caracteres convertis"
110 rm $*.old
111 else
112 echo "$* : Caracteres convertis, un fichier $*.old a ete genere"
113 fi
114
115
116fi
117if [ -f txt2html_convert.sed ]; then
118 rm txt2html_convert.sed
119fi
120if [ -f txt2html_convert.sed.old ]; then
121 rm txt2html_convert.sed.old
122fi
Note: See TracBrowser for help on using the repository browser.