Debian Codegraph @

eyesjunior/helpFiles/aj-arrange-files.sh

raw
1 #! /bin/sh
2
3 #############################################
4 # This script updates help files for eyes17 #
5 #############################################
6 #
7 # it operates from a directory containing 'pics' and 'schematics' directories.
8 # the directory also contains all language directories,
9 # with their own 'pics' and 'schematics' inside.
10 #
11 # Script changes files inside the language tree to symlinks if they are same
12 # as the ones inside the master 'pics' and 'schematics' directories.
13 #
14 #####################################
15 # Managing translation of SVG files #
16 #####################################
17 #
18 # When one wants to translate a vectorial image (SVG format), one must first
19 # delete the symlink from the language tree's 'schematics' directory,
20 # rework the SVG file from the common 'schematics' directory, and save it
21 # as a plain file with the same name, but inside the language tree's directory.
22
23 destdir=$1
24 shift
25 languages=$@
26 echo "Working in" $destdir "for Languages" $languages
27
28
29
30 echo "Removing duplicates in pics"
31
32 for l in $languages; do
33 echo "language = $l"
34 for f in $destdir/$l/pics/*.*; do
35 b=$(basename $f)
36 if [ -f $destdir/pics/$b ]; then
37 if cmp $f $destdir/pics/$b >/dev/null 2>&1; then
38 rm -f $f
39 ln -s ../../pics/$b ./$destdir/$l/pics
40 else
41 echo -n '.'
42 fi
43 fi
44 done
45 done
46
47
48 echo "Removing duplicates in schematics"
49
50 for l in $languages; do
51 echo "language = $l"
52 for f in $destdir/$l/schematics/*.*; do
53 b=$(basename $f)
54 if [ -f $destdir/schematics/$b ]; then
55 if cmp $f $destdir/schematics/$b >/dev/null 2>&1; then
56 # we have two files with the same content
57 rm -f $f
58 ln -s ../../schematics/$b ./$destdir/$l/schematics
59 else
60 echo -n '.'
61 fi
62 fi
63 done
64 done
65
66 echo "converting RST to HTML"
67 for l in $languages; do
68 echo "language = $l"
69 for f in $destdir/$l/_sources/*.rst; do
70 b=$(basename $f)
71 echo $b
72 rst2html "$f" "$destdir/$l/${b%.*}.html"
73 done
74 done
75
76 echo "Image files simplification and rst to html conversion done."
77
78
79
80
81